09-02-2010 04:58 PM
I am confused about how to program a cDAQ NI 9481 module. I have the lower two relays connected (of the four available). In LabVIEW, I have an Initial Array function with boolean FALSE connected to element. I'm guessing that the dimension size should be "four" because there are four channels, but the code that I inherited uses "one". I follow that with two "Insert Into Array" functions, both with "new element set TRUE, one with index "zero" and one with index "one". The inherited code uses indices "one" and "two". I'm told the inherited code works. I can't test it right now... no access to hardware. Any thoughts on whether the inherited code is good or is my approach the correct method?
09-03-2010 01:03 PM
Hi Dark Hollow-
You can actually simulate your hardware by right-clicking on Devices and Interfaces in MAX and selecting Create New»Simulated DAQmx Device. Then you can test your code as you develop it with a simulated 9481.
The way you describe your code will create a 6-channel array. When you use the Insert Into Array function, it will insert an element at the index you specify and simply push other elements out of the way (as opposed to just replacing it). So inserting two elements into a 4 element array will make a 6 element array. Instead what you can do is select the dimension size to be 0 and just insert the two trues into the array, then you can just pick the two channels you are writing to as your physical channel constants.
The way you describe the code you inherited seems to me that it would create a 3 element array, which would work, but you would just need to pick three of the four available channels as your physical channels.
I hope this helps. Best of luck with your application!
09-03-2010 02:20 PM
I had no idea about the hardware simulator. That's great. I eventually got on some hardware today and played with the device. I soon realized that the implementation was less than intuitive. I changed the implementation to initialize a 4 element array and then used "subtitute array" instead of "insert array" to set the non-zero bits. Much better. I also carry the array forward and use it over and over, just switching bits when necessary. The previous code actually recreated the array each time it was needed.
Is it possible to read the Relay Output module? Must be, but I can't find a user guide that discusses software operation of the module. It's all hardware stuff... mechanical / electrical specs.
09-07-2010 02:34 PM - edited 09-07-2010 02:36 PM
Here is a blurb from the NI 9481 Operating Instructions and Specifications Guide:
Each channel has an LED that indicates the state of the channel.
When a channel LED is lit, the channel is on. When the LED is
dark, the channel is off. The LEDs are disabled when the chassis
is in sleep mode.
Is this what you meant by 'reading' the output? The outputs are either on or off, and the LED will indicate that. I hope this helps. Best of luck with your application!
09-09-2010 08:36 AM
I would like to be able to "read" the state of the digital output via code. I know that when I set it, I know what state it is in. But there critical applications where I'd like the program to be able to verify the state of the relay.
09-10-2010 12:05 PM
There is unfortunately no way to programmatically read the output state of the channels. You can read the output state if you have a digital input module and read the signal that way.
Have a great day!