frobate Posted February 27, 2012 Share Posted February 27, 2012 Hello I have a need to read multiple channels (pressure transducers) and when any of those channels go above 1.5 volts, I want a Digital output to change states. I have done this with a SWITCH statement but I cannot get the sequence to run continuously. Looking at the definition of the switch it looks like I may be using the wrong function. So, how bout this; WHILE (1) IF (INPUT [0] >1.5) DIO_1=1 ELSE DIO_1=0 ENDIF DELAY(1) ENDWHILE This seems to work for one channel but how can I include all 8 input channels? Maybe put an event on each channel that writes to DIO_1? Link to comment Share on other sites More sharing options...
AzeoTech Posted February 27, 2012 Share Posted February 27, 2012 a) you aren't using switch(), you are using if(), and truthfully, you want to use if() I would expect that sequence to run continuously, as long as Input and DIO_1 exist. If it is stopping, what is the error? c) you don't want to use channel events because the logic would be wrong. You really want a boolean OR. Anyhow, just change the if() in your sequence to something like: if ((input[0] > 1.5) || (input1[0] > 1.5) || (input2[0] > 1.5)) Repeat for all 8 channels, changing the input, input1, input2, etc to your real channel names. This does a boolean OR and if any of the channels are above 1.5 it will turn DIO_1 on, but if all are below, it turns it off. Link to comment Share on other sites More sharing options...
frobate Posted February 28, 2012 Author Share Posted February 28, 2012 Thank you, I was not aware of how to format an OR statement in the IF line. Link to comment Share on other sites More sharing options...
AzeoTech Posted February 28, 2012 Share Posted February 28, 2012 See section 4.12.2 in the user's guide for more info... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.