See script below
What I'm having problems with is getting the port to open and close.
Within the loop I need to be able to open port , keep it open for a set time
then close the port.
Re-cal to open port time
and then re-do the loop process.
I "noob" at this and very sure I've done something wrong.
What does happen is it open the port once , goes through the loop and at end of loop closes port.
Thank you to any who can assist.
Sub Globals
'Declare the global variables here.
Dim EVtemp
Dim FinalEV
Dim SHUTTER_METERED
Dim intDelay
Dim Shoot
Dim Total_Exposures
Total_Exposures = 0
Dim Expos_Begin_Counter
Dim Begin_Exposure_Speed
Dim Current
Current = " "
Shot_Count = 0
tempcount = 0
Dim ex
ex=0
Exposures.text=0
Dim dly
dly=0
Delay.text=0
Dim nm
nm=0
NumerMeter.text=0
Dim dm
dm=0
DenumMeter.text=0
Dim nev
nev=0
NumerEV.text=0
Dim Minutes_Between_Shots
End Sub
Sub App_Start
Shooter.Show
serial.New1
'***serial.New2 (1,9600,"N",8,1)
End Sub
Sub Button1_Click
Current.Text = " "
serial.PortOpen = True
Shot_Count = 0
Dim ex
ex=Exposures.text
Dim dly
dly=Delay.text
Dim nm
nm=NumerMeter.text
Dim dm
dm=DenumMeter.text
Dim nev
nev=NumerEV.text
Minutes_Between_Shots = (Minutes.Text * 60 )*1000 Total_Exposures = ex
' ***Do Math Below***
Expos_Begin_Counter = ((ex - 1)/2)
EVtemp = nev
SHUTTER_METERED = nm / dm
If EVtemp * 2 <= 1 Then
FinalEV = (EVtemp + 1)*2
Else
FinalEV = Evtemp * 2
End If
If SHUTTER_METERED < 1 Then '***Test for Whole Seconds***
Begin_Exposure_Speed = dm
Do While Expos_Begin_Counter > 0 '***Do Fraction Routine here***
Begin_Exposure_Speed = Begin_Exposure_Speed / FinalEV
Expos_Begin_Counter = Expos_Begin_Counter - 1 Loop
' ***Do Suhtter Routine Below***
This_Exposure = Begin_Exposure_Speed
Shot_Count = 1
Computed_Time = 1 / This_Exposure
'***Loop for port open close
Do While Shot_Count <= Total_Exposures
Sleep((dly * 1000))
serial.DTREnable = True '***open port date send
Sleep(Computed_Time * 1000) '***hold port open for time
serial.DTREnable = False '***close port
'***re-cal time and bump up loop count
This_Exposure = This_Exposure * 2
Computed_Time = 1 / This_Exposure
Shot_Count = Shot_Count + 1
Loop
Else
'***If Whole Seconds do whole second routine***
End If
Sleep((dly * 1000))
Current.Text = "Done"
serial.PortOpen = False
End Sub
What I'm having problems with is getting the port to open and close.
Within the loop I need to be able to open port , keep it open for a set time
then close the port.
Re-cal to open port time
and then re-do the loop process.
I "noob" at this and very sure I've done something wrong.
What does happen is it open the port once , goes through the loop and at end of loop closes port.
Thank you to any who can assist.
Sub Globals
'Declare the global variables here.
Dim EVtemp
Dim FinalEV
Dim SHUTTER_METERED
Dim intDelay
Dim Shoot
Dim Total_Exposures
Total_Exposures = 0
Dim Expos_Begin_Counter
Dim Begin_Exposure_Speed
Dim Current
Current = " "
Shot_Count = 0
tempcount = 0
Dim ex
ex=0
Exposures.text=0
Dim dly
dly=0
Delay.text=0
Dim nm
nm=0
NumerMeter.text=0
Dim dm
dm=0
DenumMeter.text=0
Dim nev
nev=0
NumerEV.text=0
Dim Minutes_Between_Shots
End Sub
Sub App_Start
Shooter.Show
serial.New1
'***serial.New2 (1,9600,"N",8,1)
End Sub
Sub Button1_Click
Current.Text = " "
serial.PortOpen = True
Shot_Count = 0
Dim ex
ex=Exposures.text
Dim dly
dly=Delay.text
Dim nm
nm=NumerMeter.text
Dim dm
dm=DenumMeter.text
Dim nev
nev=NumerEV.text
Minutes_Between_Shots = (Minutes.Text * 60 )*1000 Total_Exposures = ex
' ***Do Math Below***
Expos_Begin_Counter = ((ex - 1)/2)
EVtemp = nev
SHUTTER_METERED = nm / dm
If EVtemp * 2 <= 1 Then
FinalEV = (EVtemp + 1)*2
Else
FinalEV = Evtemp * 2
End If
If SHUTTER_METERED < 1 Then '***Test for Whole Seconds***
Begin_Exposure_Speed = dm
Do While Expos_Begin_Counter > 0 '***Do Fraction Routine here***
Begin_Exposure_Speed = Begin_Exposure_Speed / FinalEV
Expos_Begin_Counter = Expos_Begin_Counter - 1 Loop
' ***Do Suhtter Routine Below***
This_Exposure = Begin_Exposure_Speed
Shot_Count = 1
Computed_Time = 1 / This_Exposure
'***Loop for port open close
Do While Shot_Count <= Total_Exposures
Sleep((dly * 1000))
serial.DTREnable = True '***open port date send
Sleep(Computed_Time * 1000) '***hold port open for time
serial.DTREnable = False '***close port
'***re-cal time and bump up loop count
This_Exposure = This_Exposure * 2
Computed_Time = 1 / This_Exposure
Shot_Count = Shot_Count + 1
Loop
Else
'***If Whole Seconds do whole second routine***
End If
Sleep((dly * 1000))
Current.Text = "Done"
serial.PortOpen = False
End Sub