Dear friends
I use cr1000, sdm-sw8a and sdm16ac as a control valve,
I want to make a condition when the button [input(5)] is pressed then Control(1) and Control(2) is on and Control(5) will be on too as condition that control 1 & 2 ready, but if one of them or both is off then Control(9) will be on,
========================
Public Control(16)
Public Input(8)
BeginProg
Scan(1,Sec,0,0)
If (Input(5)=1) Then 'button
Control(1)=1
Control(2)=1
If (Input(1)=1 AND Input(2)=1) Then
Control(5)=1 'Start Indicator
Control(9)=0
Else
Control(5)=0
Control(9)=1 'error indicator
EndIf
Else
Control(1)=0
Control(2)=0
Control(5)=0
Control(9)=0
EndIf
EndIf
SDMSW8A (Input(),8,0,0,1,1.0,0)
SDMCD16AC(Control(),1,2)
NextScan
EndProg
=================
problem is Control(9) always on first and then Control(5) on, Control(9) seemed always read first the conditions of the 'else' then followed by Control(5)
Any idea how to solve this problem?
Any information would be greatly appreciated. Thank you.
Some quick suggestions....
You have 1 too many Endif statements. Delete the one above your SDMSW8A (Input(),8,0,0,1,1.0,0) statement.
Try adding "SequentialMode" to the beginning of the program so the logger executes the statements in the order you have them programmed.
IslandMan