Jump to content

Addressing single bit


dingin

Recommended Posts

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!

Link to comment
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.

Link to comment
...

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).

Link to comment

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).

Link to comment

: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!

post-7081-1165068957.png?width=400

post-7081-1165068986.png?width=400

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.