dingin Posted December 1, 2006 Report Share Posted December 1, 2006 hi everyone I am working with datasocket and OPC server. The data comes in 2 forms, a 32 bit float and single bit. I can read and send the 32 bit tag by using the numeric data type single precision, but as for the single bit, the smallest numeric data type LV has is 1 byte. The OPC explorer program allows me to address the entire byte or each bit which represent valve on/off states. In LabView I just want to be able to address a particular bit, not the entire byte. Any suggestions would be greatly appreciated! Quote Link to comment
LAVA 1.0 Content Posted December 1, 2006 Report Share Posted December 1, 2006 Any suggestions would be greatly appreciated! As far as I know the smallest addressable memory element in C++ is one byte i.e. 8-bits. If your OPC interface uses something like 1 bit variables, they very probably are really 8-bit variables of which only 1-bit is used. Can you provide the defenition of the OPC method API you are trying to pass bits and how these bits are defined in the API. Quote Link to comment
dswaine Posted December 1, 2006 Report Share Posted December 1, 2006 ...I am working with datasocket and OPC server. ... In LabView I just want to be able to address a particular bit, not the entire byte. Any suggestions would be greatly appreciated! Apologies if I'm missing something but ... If you're using frontpanel Datasocket connections: have you tried just linking a boolean/switch to a particular bit? If you're using the Datasocket VIs: have you tried DataSocket Write Boolean.vi or DataSocket Read Boolean.vi (from ... \LabVIEW xx\vi.lib\platform\dataskt.llb). Quote Link to comment
Louis Manfredi Posted December 1, 2006 Report Share Posted December 1, 2006 Hi Dingin: Welcome to LAVA :thumbup: Although you may be forced to pass your boolean data around as eight bit bytes, you certainly can break it into booleans using LV. See below for a couple of may ways... Hope this helps, Best Regards, Louis Quote Link to comment
Omar Mussa Posted December 1, 2006 Report Share Posted December 1, 2006 A 1-bit number simply means its value can be 0 or 1. And luckily enough, a rose is a rose... If you use any of the int type of data and send a 0 or 1 your code should work. Reads and Writes to that value shouldn't require any 'bit banging' because the value is just 0 or 1 (there is nothing to manipulate). Quote Link to comment
dingin Posted December 2, 2006 Author Report Share Posted December 2, 2006 :worship: I tried each of the suggested methods, and they all work! -Using front Panel Datasocket connection to OPC, 1) write a True or False to boolean control (V3.1,3.2 in my example) 2) send 0 or 1 to I8 unsigned byte (V4.1,4.2, in my example) 3) convert 8 element 1D boolean array (with boolean array to number function) and pass to I8 unsigned byte. -In the block diagram 3)Use a datasocket write boolean subVi from dataskt.llb (V6 in my example). I had tried the boolean and I8 in the front panel DS connection before without success. My OPC server must have hosed up somehow on that occasion. Thanks everyone! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.