08-28-2005 04:10 PM
08-29-2005 09:27 AM
Here's my (edited) answer from an earlier post.... the licensing stuff may not apply in your case.. and the ModbusSlave solution should work with a non-driver tag as well:
Hi,
I would strongly advise against using any undocumented features, because of that fact. Its support may at any time be dropped. As it is undocumented, NI does not have an obligation to continue supporting it.
Anyways, one (legal) way of getting the individual bits of a number is to use the ModbusSlave Object. The ModbusSlave object, normally, is used to turn the process into a virtual Modbus RTU. However, as a side benefit, we can use its datamembers to get the bits of a number.
The datamembers H4xxxx.fx give us the individual bits for the register 4xxxx. So, to get the bits of a number, you would first connect it to say, ModbusSlave1.40001. Then, reading the ModbusSlave1.H40001.f1 through ModbusSlave1.H40001.f16 would give its 16 bits as logical values.
Similarly, ModbusSlave1.H42345.f8 would give you the 8th bit of the number connected to register ModbusSlave1.H42345, for example.
For 32-bit integer numbers (as in your case), you would wire the number to the "D" registers. Like, ModbusSlave1.D40001, etc. And then read the two adjacent "H" registers, giving 16 bits each to make up the 32-bits. So, you would read ModbusSlave1.H40002.fx (for bits 0-15) and ModbusSlave1.H40001.fx (for bits 16-31).
Hope this makes sense. For 32-bit floating point numbers, you would use the "F" registers. But since the 32-bit floating point numbers are implemented as per the IEEE format, getting the indivdual bits is much more involved. See the following KB articles for details:
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/2de82ef20b2cc991862567f600432e33?OpenDocument
http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/4ef459f549fcc7028625660a000a7629?O...
Hope this helps.
Regards,
Khalid
ps: Just in case one is wondering why wouldn't NI implement such a simple feature within Lookout : since Lookout pricing is based on IO points, such a feature could be potentially misused to avail more IO points than what is paid for (could end-up getting 16 IO points for the price of one!). NOTE: the ModbusSlave does add to the IO points; hence is a "legal" solution 😉
08-29-2005 04:09 PM
09-05-2005 08:48 PM
09-05-2005 08:49 PM