From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-01-2021 04:00 AM
Hi guys
I am trying to Read RTD data using Temperature controller PIC152 .I am using Serial communication's RS485 standard to read the temperature value with help of VISA and Modbus both.
Through MODBUS I can read the data but when reading using VISA I dont get any value .
I just get Warning -> Number of bytes transferred is equal to the requested input count.More data might be available .
I am using property node " bytes at port " to set VISA read byte parameter.
when we see through probe "Bytes at port " gives 0 bytes and above mentioned warning comes.
I have attached Image of VI's.
07-01-2021 04:44 AM
The simple answer could be: use MODBUS since it works. Why are you trying to use VISA?
MODBUS is a command based protocol: you ask some data to the device, the device will send an answer containing those data (hopefully).
In your VISA vi, you simply open the serial port and wait for incoming data: is the device setup to repeatedly send data automatically?
Even if the answer is yes, don't use Bytes at port! This property simply informs you whether any character is available in the input buffer of the serial port; it says nothing about the message itself. The right way to proceed depends on the features of the message to be received: is it ASCII or binary? is there a termination character? a starting character? is its length fixed?
07-02-2021 12:54 PM - edited 07-02-2021 01:11 PM
Although your device my be connected through a serial port your device uses Modbus, so it does NOT use VISA.
Use the NI Modbus library it's free and you can install it using VIPM
Actually you probably could use VISA but then you would basically have to reinvent the wheel when it comes to Modbus protocol over serial.
07-02-2021 01:02 PM
@pincpanter wrote:
MODBUS is a command based protocol: you ask some data to the device, the device will send an answer containing those data (hopefully).
Um... Not exactly... Modbus is a "Register Based" protocol.
Data, like measurements are stored in "Holding Registers" analogous to memory locations, to get a measurement you read a "holding register" (maybe two or more registers) and convert the integers returned to your measurement using the scaling information provided by the manufacturer.
To change settings you Write a holding register.
To open or close a relay contact you write a "coil"
07-02-2021 01:28 PM
What pincpanter said was right, you send commands to the slave device in order to retrieve the data stored in the holding register. Master device is not reading directly the registers in the slave device. Master device sends a command (0x03 or 0x04, according to input or holding register) and the slave device is the one in charge to answer to the READ command with the register required by Master device.
07-03-2021 10:53 AM
@RTSLVU ha scritto:
@pincpanter wrote:
MODBUS is a command based protocol: you ask some data to the device, the device will send an answer containing those data (hopefully).
Um... Not exactly... Modbus is a "Register Based" protocol.
It may not be the right, term, but, in practice, to read or write registers, you need to send a packet of data over the bus: and this packet is what I call a "command".
07-03-2021 12:27 PM - edited 07-03-2021 12:28 PM
@pincpanter wrote:
@RTSLVU ha scritto:
@pincpanter wrote:
MODBUS is a command based protocol: you ask some data to the device, the device will send an answer containing those data (hopefully).
Um... Not exactly... Modbus is a "Register Based" protocol.
It may not be the right, term, but, in practice, to read or write registers, you need to send a packet of data over the bus: and this packet is what I call a "command".
Right, there is read or write command in there someplace. But Modbus API pretty much abstracts that out. So it does not seem quite the same "command-response" based as querying a SCPI instrument.
07-03-2021 06:17 PM - edited 07-03-2021 06:19 PM
In terms of VISA communication which the NI Modbus library uses internally, the Modbus protocol is certainly a command/response protocol. The device never initiates any data transfer but the controller sends a command to read or write a register or coil. The device always responds with the read data or an acknowledge package (for write commands).
To implement the Modbus protocol is a fun exercise but not if you are starting out with serial communication. One of its modes (RTU) is very binary based and both modes are complex enough to be a real challenge to implement properly.
In any case if you start out with using Bytes at Serial port, you are already on the wrong path!
07-08-2021 04:44 AM
It is Modbus RTU so data type is Binary.
07-09-2021 12:48 AM
Thanks all for your responses .
After lot of exploration I found ,In order to read data from Modbus slave device we need to send command in following format.
slave address, function code, starting address ,quantity of registers ,CRCbits.
i have send command in above order but still I a not able to read the required data.
I am attaching the VI ,also the link of website where I read about the format,
and Parameter document(From where you can know slave id ,func code ,starting address ,quantity of registers).
also I want to know how to find what would be CRC bit if we are reading data.
link where i got above info- https://www.modbustools.com/modbus.html