LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read 16 bytes directly from the Modbus??

Solved!
Go to solution

Hello,

I got problem regarding to modbus register.

Means I have call  serial no. Which is given on address 5000 and serial no is 16 bytes and each bytes has high and low bits.

When I call from address 5000 by using Modbus then I can read only first two bytes (4 bits) can you guide me please how can I read my Bytes serial no. Directly by using modbus.

May be I am not good enough in explanation so here I have attaché one diagram in that right hand side in redbox indicate serial no.which I gave.

And LHS it show the register address and 12594 value is decimal may be and then 16 bytes.each bytes has high and low bits.

I want to make Vi by using that I can see my serial no directly on front  pannel.

right now i am only able to see 12594 value that i dont want i want serial no.which i have given on RHS side of pic.

Can you please guide me how can I do so...

also i am attaching example vi which i got from NI forum.

Thank you very much in advance............

Download All
0 Kudos
Message 1 of 5
(2,841 Views)

May be problem is solved now i can read the value which i want....

 

0 Kudos
Message 2 of 5
(2,832 Views)

Hello,

I want read different bit values from the single location.

Here in attachment I have attached screen shot of my modbus address from where I want to read the values,and also attached my vi which I made but I got one problem that I don't know how to read three different bit  from the same location.

I have to read 3 different bit from the register 11 for Digital output 1,2 and 3.i have assigned bit 4 for digital output1 ,5 for digital output 2 and 6 for digital output3.

Will you please guide me .

Thank you very much.

Download All
0 Kudos
Message 3 of 5
(2,803 Views)
Solution
Accepted by AnkitRamani

This is basic boolean math.

 

Read the byte.  If you want to determine the value of a particular bit, then you need to AND it with another value.  For bit 0 AND it with 1, for bit 1 AND with 2.  ANDing with 128 will give you the value of bit 7 (8th and highest bit).  If the result is 0, then that bit is false.  If the result is >0, then the bit is true.

 

Even easier is to take the Number and convert it to a boolean array through the Number to Boolean Array function on the boolean palette.  Then you can index out the particular boolean you want from the array.

Message 4 of 5
(2,794 Views)

Hi,

    I am using modbus communication between PLC and Labview, this communication is very slow. We are using 6-reading blocks & 40-writing blocks connecting serially with a single modbus master block which i have attached with this post.

 

Can anyone, please suggest me whether the above procedure is correct?

Also suggest me how to speedup the communication between PLC to Labview.

0 Kudos
Message 5 of 5
(2,746 Views)