Dear,
I have a problem on the 1st steps of my cycle with the function TimeIntoInterval.
When I send a new programm or restart with the power in, the 1st cycle does not start at the 1st step, but starts with the 2nd or 3rd step. It is random for the 1er cycle and I do not understand. I would like start with the 1st step...
Once the 1st cycle has been completed, the 1st step (and others) works well for each cycle.
Could you help me for the 1st cycle please ?
I would like to have some variable like this for my SDM (maybe the problem is here), but I tried severals things before to come here and I didnt find.
Thank you very much for your help !
Maxime from France.
Example for my programm :
Public SDM(16) As Long = 0
Public Active_Chamber As Long = 1
Public Air_out As Long = 5
Public Lid_close As Long = 9
Public Lid_open As Long = 13
Const total_chambers = 2 'You can change the total chambers here (de 1 a 4)
BeginProg
Scan (1,Sec,1,0)
If TimeIntoInterval(0,90,Sec) Then
SDM(Active_Chamber)= 1 'Switch solenoid for Air flow in : open
SDM(Air_out)= 1 'Switch solenoid for Air flow out : open
SDMCD16AC(SDM(),1,0) 'Sending the command to SDM
SW12(1) '1 = ON
EndIf
If TimeIntoInterval(10,90,sec) Then
SDM(Lid_close) = 1 'ports 9 to 12 on the SDM close lids 1 to 4
SDMCD16AC(SDM(),1,0) 'Sending the command to SDM : Lid is closing
EndIf
Etc...
If TimeIntoInterval(30,90,Sec) Then
SDM(Lid_open) = 1 'ports 13 to 16 on the SDM close lids 1 to 4
SDMCD16AC(SDM(),1,0) 'Sending the command to SDM : Lid is opening
Etc...
'Last step
If TimeIntoInterval(70,90,Sec) Then
SDM(Lid_open) = 0 'Stop opening
SDMCD16AC(SDM(),1,0) 'Sending the command to SDM
'- Pump stopping
SW12(0) '0 = OFF
'- Solenoids closing
SDM(Active_Chamber)= 0 'Switch solenoid for Air flow in : close
SDM(Air_out)= 0 'Switch solenoid for Air flow out : close
SDMCD16AC(SDM(),1,0) 'Sending the command to SDM
'Step stop now
If Active_Chamber <= total_chambers Then
Active_Chamber = Active_Chamber + 1 'open solenoid for air flow in to next chamber ;
Air_out = Air_out + 1 'open solenoid for air flow out to next chamber ;
Lid_close = Lid_close + 1
Lid_open = Lid_open + 1
EndIf
'When cycle of total chambers is finished, start a new cycle
If Active_Chamber > total_chambers Then
Active_Chamber=1 'The first 4 ports on the SDM open solenoids : 1 to 4
Air_out=5 'The next 4 ports on the SDM open solenoids : 5 to 8
Lid_close=9 'The first 4 ports on the SDM close lids : 9 to 12
Lid_open=13 'The last 4 ports on the SDM open lids : 13 to 16
EndIf
EndIf
NextScan
EndProg