Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about Continuous Digital Output [C/C++]

Solved!
Go to solution

Hello,

 

I am currently developing for the NI-6503 in MS Visual Studio 2008, and so far the ANSI-C text-based examples Read Dig Chan and Write Dig Chan are excellent and work as intended. However, writing to the digital channel using the write example only happens once, and I just need to be able to write either '0' or '1' constantly (keeping it in a logical on or off state as a switch). I was wary about placing everything into a while loop though since I have looked at the other buffered and counter examples and they seemed to require an extra hardware component; I wanted to know what you would recommend as a simple software implementation for this. I appreciate your reply, thanks.

0 Kudos
Message 1 of 3
(3,652 Views)

Hello,

 

Thank you for using NI forums.   The WriteDigChan VI should maintain the state of that line whenever you finish the program.  If you are experiencing problems with this then you can use one of the continuous examples (there's one that continuously writes to a digital port but you can modify it so that it will just write to a channel instead).  Please let me know if you are still experiencing problems with this.

Message Edited by B.E.Z. on 09-29-2009 06:12 PM
0 Kudos
Message 2 of 3
(3,632 Views)
Solution
Accepted by topic author OfMagnitude

Thanks for the prompt reply - you are correct in saying that the WriteDigChan VI should maintain the state of that line whenever the program terminates. I did some more research and learned that the reason why I was having such trouble performing Read and Write is because on the NI-6503, you can only configure a whole port as Input and Output and not individual pins (without resetting the state of the entire port). So each time I ran my program, I noticed the state of the switch go from low to high for a split second, but as soon as the program execution went from WriteDigChan to ReadDigChan, the value was reset and all I got was 0x0.

 

For anyone else who is looking into this problem, NI posted an article that states which devices DIO lines can be configured individually:

http://digital.ni.com/public.nsf/websearch/FDEE00034B16F5E086256119005DC75A?OpenDocument

0 Kudos
Message 3 of 3
(3,617 Views)