LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

modbus mask

Solved!
Go to solution

 

Hello,

 

I have a question about MODBUS/TCP.

 

I have to write individual BITS to a holding register. Unfortunally, holding registers only accept unsigned values (numbers).

Therefore I need to convert my bit value (e.g. 101000 > 5).

 

But now I want to write a single bit value, without touching the other bit values. I think I need some kind of MASK for this to tell LabVIEW which individual bits I want to write.

 

Example in attachement.

 

 

Does anyone have any experience with a MASK in MODBUS/TCP in LabVIEW?

I have found on the internet things about "Holding Register Bit Mask Writes" and that Function Code 22 should be used, but I do not know how this can be used in LabVIEW.

 

 

Info about a mask in MODBUS (top of page 3)

http://www.micronor.com/products/files/AN112/AN112_NIModbusTutorial.pdf

 

How a mask should be used in writing a register (section 4.3.4 Mask write register (FC 22))

http://www.rtaautomation.com/modbustcp/

 

 

Thanks

 

Arjen

 

0 Kudos
Message 1 of 4
(5,243 Views)
Solution
Accepted by topic author Arjennn
First read holding register then set your bit later write it. Its same only
--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 4
(5,230 Views)

 

Hello Ranjeet_Singh,

 

Thank you for your reply.

I have thought of that way of "fixing" it, but this solution will create extra (unnecesary) data traffic. It is not a nice solution.

 

There must be another way to do this ??

0 Kudos
Message 3 of 4
(5,229 Views)

Hello Arjennn,

 

Do you have the hardware available.

Have you already tried to work with the NI Modbus Library and taken a look at the examples?


Do you have the hardware available so that you can do some tests?

Kind Regards,
Thierry C - CLA, CTA - Senior R&D Engineer (Former Support Engineer) - National Instruments
If someone helped you, let them know. Mark as solved and/or give a kudo. 😉
0 Kudos
Message 4 of 4
(5,182 Views)