04-25-2006 02:50 PM
04-26-2006 10:15 AM
Hi Wpar,
If you use single Bits with a channel it doesn't matter whether you put all the 8 bits in one Byte of the message or every single bit in his own byte in one message. The driver takes CARE of writing the right number during the database conversion.
See the attached example which uses 4 bits in different bytes and 2 bytes of them in the first byte together.
1. yes it writes the whole byte but updates only the Bit (Channel you changed
2. the only way to get the state of the bit is to read the bit (channel)
3. Yes the read function starts reading immediately if you use the input mode and if no data is available because the write function has not completed yet, it reads the default value from your database. Use the timestamped mode instead which reads only the real message and therefore the sample rate is ignored. See the attached example for more info.
Hope that helps
04-27-2006 01:19 AM
Hi DirkW
In this case writing and changing only one channel sate works ok. My application include several test steps (different vi's). They run one after another. I would like to change one channel in one vi and another in the next vi. When I do it in this way I reset the previous setting.
Also in the example I can change the channel state but I can't read the status of this changed channel. Maybe this is problem with Arbitration ID (it is different in DI and DO).
I will send you my channel configuration. Maybe I make some mistake.
04-27-2006 01:19 PM
Hi Wpar,
The key to overcome this problem is using a Task. All channels initialized in one Task belong together. Then you need a global variable for the state of each channel. With every write you use, you have to read first the global, to get the last state, change the state of the channel you want to change and write the whole array to the write then.
If you change a Output state, there is no way to read the state again, because the communication is CAN BUS based, you would need to request a message from the node which belongs to the channel. The only chance is to store the written Value to the globel and read from this global instead id you need the status again.
DirkW
04-29-2006 07:00 AM
05-01-2006 08:15 AM
Hi Wpar,
Well it depends on your Hardware System, you are writing to. Normaly there is a way to send a special Status ID to get the status for all Inputs.
Or the Modules send it periodically, but you have to enable it first. Refer to the Manual for the Hardware or contact their Support.
DirkW