LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I modify the MB example serial slave and master to read values only?

Hi,

I'm new to programming and labview. Can anyone help me to understand how I can communicate a modbus protocol device using labview.  I checked out the examples but am still unsure how the registers work.  

Thanks

0 Kudos
Message 1 of 8
(4,028 Views)
Are you communicating via RS232?  If so you should be able to send the ModBus commands directly to the device (be sure to calculate your CRC-16!) using the shipping example: "Advanced Serial Write and Read". 
0 Kudos
Message 2 of 8
(4,026 Views)

Hi jmcbee,

Thanks for your response.  Yes, the device communicates via RS232; however, I tried the MB CRC-16 example and did not get any reading.  Currently, i'm trying to set up the CRC-16, but after reading through some CRC-16 posts and the communication guide for my device, I found that the CRC-16 direction for your previous post resembled mine.   According to the guide:

 

1. Load a 16 bit register with FFFF (all 1’s). Call this the CRC register.
2. Exclusive OR the first 8 bit byte of the message with the low-order byte of the 16 bit CRC
register, putting the result back into the CRC register
3. Look at the Least Significant Bit of the CRC register and remember it. Call it the LastBit
4. Shift the CRC register one bit right, putting 0 in the top bit
5. If the LastBit was 1, Exclusive OR the CRC register with value A001h (1010 0000 0000
0001)
6. Repeat steps 3,4,5 until 8 shifts have been performed
7. Repeat from step 2 for the next byte of the message until all bytes have been processed
8. The final contents of the CRC register is the CRC value to use
9. When the CRC is placed in the message, the Least Significant Byte is sent first, then the
Most Significant Byte

 

So, I'm wondering if I can see your vi for SI-M communication card?

thanks

Devin

0 Kudos
Message 3 of 8
(3,979 Views)
See the CRC-16 VI I am using below.  It is saved in LV 8.6
0 Kudos
Message 4 of 8
(3,977 Views)

download the ni modbus library. http://sine.ni.com/devzone/cda/epd/p/id/4756

 

There are many examples in the forums for doing reads and writes.

 

see the llb file i put in this thread.

http://forums.ni.com/ni/board/message?board.id=170&message.id=200988&requireLogin=False

0 Kudos
Message 5 of 8
(3,959 Views)

Thanks Unclebump, but can you send the link for Modbus library for LV 7.0? 

0 Kudos
Message 6 of 8
(3,940 Views)

Thanks for your help jmcbee,

I have a question regarding the advanced serial write and read. You mentioned that I can read directly off my device using the vi.  However, is this true only for a RS232 communicating device since I always thought that I would need to read off the holding register to get, for instance, the temperature that the device reads?  Also, for the CRC-16, do I simply connect the read string to the vi?  

Thanks, sorry for the trouble. 

0 Kudos
Message 7 of 8
(3,933 Views)
Modbus Library for LabVIEW 6.1 and newer.
---

Peter Flores
Applications Engineer
0 Kudos
Message 8 of 8
(3,917 Views)