Oh Dear ive just discovered MODBUS


andybdjuk

Recommended Posts

Hi, i have just bought a solar control regulator and found it can be connected using MODBUS. I know very little and have been playing.

With the below i have followed the DAQFactory Manual but im not receiving any data. I dont understand all the options in the I/O Type. With the information below are you able to point me in the right direction to get some meaningful data, for the example below of Battery Voltage and help start my new learning curve.

I have attachect my channel setup

Thanks

Andy

FROM THE MANIFACTURES MANUAL

The TriStar supports RTU mode only.

16bit MODBUS addresses (per the modbus.org spec)

The serial communication parameters are

BPS: 9600 baud

Parity: None

Data bits: 8

Stop bits: 2

Flow control: None

All addresses listed are for the request PDU.

The TriStar defaults to server address of 0x01.

Variable_name

[Logical Address][PDU Address] (Units). Short description.

Definition.

adc_vb_f

[09][0x008] (V). battery voltage, filtered.

Voltage measured directly at the battery connection on the TriStar.

MODBUS_Test_1.ctl

Link to comment
Share on other sites

Don't feel bad. It appears even the manufacturer of this device doesn't truly understand Modbus. They forgot to tell you whether its a holding or input register, and the logical address for PDU address 0x008 is not 9, but either 30,009 or 40,009 depending on whether its a holding or input register. Logical address 9 would be a coil (digital output). The Battery voltage is obviously an analog and so must have a logical address between 30,001 and 49,999.

Anyhow, you are close. Change the I/O type to Read Holding (U16), and the channel # to 8 and you will likely get some data. If not, try Read Input. If not check to make sure your modbus ID (they call it server address) is in fact 1, then contact the manufacturer and ask them for an example PDU that would work and post it here.

Link to comment
Share on other sites

Good man, i have data comming in and visable in Comm Monitor set to all chars as ascii & Display codes as hex.

One of the RX lines Reads RX: \x01\x03\x02\x0F\xA9\x7D\xCA

Could you identify all the bits of the string i am getting and how to get a sensible number out of it. using DAQ Factory.

I found a reference if that helps:

Examples

Scaling

Scaling Battery voltage, filtered (τ ≈ 2.5s)

Read Holding Register Value: 0x1007

Scaling for this variable: n

Link to comment
Share on other sites

\x01\x03\x02\x0F\xA9\x7D\xCA

I'm assuming you stripped out the leading 6 bytes of modbus TCP. \x01 = modbus id, \x03 = read holding, \x02 = 2 registers returned, remaining bytes are the data. Now, I don't know how you have things setup, but you either told DAQFactory to read a single 32 bit value (S32 or float for example), or created two consecutive channels of 16 bits each. You should let DAQFactory do the conversion from these binary values into real numbers, but you need to make sure and select the right I/O type. Often this requires experimentation, though I can tell you that the battery voltage looks to be the S16 type because of the /32768.

To convert the modbus value into engineering units, create a Conversion and apply it to the channel. For battery voltage, the conversion is simply:

Value * 96.667 / 32768

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.