Controlling Fio State


Recommended Posts

I am trying to control the state of FIO 0 I wrote a small script:

 

 
While(true)
   If(Button_State ==1 )
      Output1 = 0
      delay(5)
      Output1 =1
      delay(5)
   endif   
endwhile 
 
I have a button that toggles Button_State between 0 an 1 and I also have a graph of Output1, the problem is that Output1 always returns to the high state and is not affected by the Button_State? Any help with this would be great, thanks in advance. What I really find interesting is that if I go into Kipling and set FIO 0 to an output, save the Kipling configuration, get out of Kipling, then go back into Kipling it is still set to the Ouput. But if I go into DaqFactory load my program, then go back to Kipling FIO is now set to an input? 
Link to comment
Share on other sites

No the button simply starts and stops the FIO sequence as described above, I do have a StartUp sequence that is written like this:

 

using("device.labjackm")
 
global Button_State
global pulseoutdionum = 4  //DIO0 is FIO0.  DIO4 is FIO4.  DIO8 is EIO0.  DIO16 is CIO0.
global pulsewidthus = 10000
 
try
   LJM_eWriteName(ID, "FIO_DIRECTION", 255) //Set all FIOs to output
   LJM_eWriteName(ID, "FIO_STATE", 0) //Set all FIO states to low
   DIGITAL_BIT,pulseoutdionum,0)
ErrorHandler(ID)
 
This sequence simply will not start? I really would just like to set the state of FIO 0 and FIO 1 and then control when and for how long the channel is low or high. Thank you for your response.
Link to comment
Share on other sites

You have a try without a matching catch() and endcatch() so the sequence won't compile or start.  Good indenting technique makes these errors much more obvious.  You should not have outdented for errorHandler(ID) as that is just a function call, not the end of a block level  statement like if(), while() or in this case, try.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.