Jump to content

Modbus RS 485 Communication with Radix instrument(Process Variable of floating point type)


Padmaja

Recommended Posts

Hi all,

I am facing one problem while communicating with Radix Instrument using Modbus RS 485 Interface,

can anybody help me in this,

The instrument which i am going to communicate is Radix ISOSCAN(16 Channel Temperature Scanner).post-16140-124841351697_thumb.jpgpost-16140-124841351697_thumb.jpg

The instrument is having Modbus RS 485 interface facility.

To that instrument,RS 485 Configuration is there.And I am using RS 485 to RS 232 Converter for communicating with my PC.

I downloaded Modbus VI Library from NI and I programmed using Modbus VIs.

I got the instrument Register Addresses also.From this instrument,I want to read 16 channel temperature values.For this,in Modbus terminology we will call as Process Variables(PV).

For this,I used Read Input Registers(Function Code 04) and I have doubt in configuring Starting Address terminal of "MB Serial Master Query.vi".Because,here if we see the datatype of this terminal,it is U16.But if we see the Instrument register addresses,it is of floating point type.

Can anybody help how can i go further ...,

Regards,

bujjin

Link to comment

Hi,

FYI I’ve not used Modbus under Labview, downloaded the lib just now(thanks for the tip, I did not know there was one:)). I noticed a few things you should be aware of.

That they give the addresses as 40000+ normally indicates that you need to use Read holding registers(FC 4), not read Input registers.

Here they specify that the "real" address for 40001 is 1, this is a bit unusual, normally it would be 0. If 1 does not work, trying 0 as starting register address might be worth a try.

"Basic" Modbus does not support 32 bit registers(Daniel option), so many instruments still use only 16 bit registers. Given the the address list you posted indicates two addresses per float, I assume they do this. In that case you need to read two 16 bit registers(u16), then type cast to single precision float. From what I’ve seen so far, the Modbus VIs does not support Daniel option, so you’re in luck. You might run into a bit of Endian trouble, so try swapping the words, maybe even the bytes as necessary.

The below might work(not tested).

post-16028-124844878513_thumb.png

Link to comment

Hi,first of all,thank you very much for your support,

Actually as i have to read(Read Only) 16 channel Data from the instrument,and as per the link mentioned in ni "Introduction to Modbus" topic,

http://zone.ni.com/devzone/cda/tut/p/id/7675

I selected "Read Input Registers" with Function Code "04".

Also as per my understanding from the documentation,for "Read Holding Registers",function code is "03".Kindly correct me if i am wrong....

Any how,i have checked both the cases with the code as per your design(figure attached),i.e.

Test 1:

Following as inputs for "Modbus Master Query.vi",

1.With Read Input Registers

2.With Starting address as "0",as suggested by you

Test 2:

Following as inputs for "Modbus Master Query.vi",

1.With Read Holding Registers

2.With Starting address as 1 also,

But in both the cases I am not getting any value from the Registers terminal of "Modbus Master Query.vi"

Also i have gone through the link which is in ni developer zone forums,i.e.

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

Also i observed one thing while running the code,it may help or may not..

I am using RS 485 to RS 232 converter for communicating with the instrument.

From this converter,there are two output terminals(TXD) and (RXD) with boolean indicators(one for the TXD and one for RXD).I think these are send and receive commands for serial communication(RS 232),again correct me if i am wrong :):)

Observation is that,whenever i am running the code,the boolean which correspond to TXD is blinking,

But there is no indication from boolean of RXD.

As per my knowledge,the code which is running in my PC is sending command but because of some reasons there is no reply(as there is no indication from RXD boolean) from the instrument.

I am thinking that the with the starting address what i am giving in the VI,its not able to search for the registers...,

Kindly suggest me if anythiong i have mistaken and kindly support me how to go further and solve this issue..

Regards,

Bujji

Link to comment

Hi,

My apologies, I put read holding registers(FC 4), I meant (FC 3).

It does sound like you might have an issue more fundamental then the Modbus details, I agreed that the Rx led not flashing likely indicates no reply. A good way to be certain whether or not you are getting anything back to your computer is using portmon.

I assume by the links you posted, that you double checked the basic settings match those of the instrument:

  • Modbus type(RTU/ASCI)
  • Modbus Address
  • Baudrate
  • Parity
  • Flow control(none).

Assuming that the serial link is OK, and that the problem is with modbus.
  • If the start address was wrong, the instrument should respond with an exception code saying so(unfortunately not all instruments do this). You could try asking for only two registers at other addresses, 4, 5, 40004 and 40005(last two should not work but...) as a simpler test.
  • If you have the wrong modbus address or protocol type, you should not get any reply, so double checking these could be a good idée.

Regarding the physical connection.

  • Many 232/485 converters require you to input the baud rate in the converter itself, so it knows how long to drive the lines after the start bit.
  • An RS485 link is supposed to have a third connection, common ground, however sometimes removing this can improve communication(this would normally indicate other problems).
  • For a short, slow connection, terminating resistors should not matter much, however it the converter and/or instrument has built in termination, and you have added termination manually, it might mess you up.
  • You always connect inverting to inverting, and non inverting to non inverting, however a few manufacturers use B for inverting, not A as is the standard. So try connecting A to B and B to A, even though it’s formally wrong.
  • If the converter is powered from the EIA232 connection(no external power or battery), this might cause the problem, some equipment, especially Laptops, deviate enough from the 232 standard, that the converters do not get powered correctly.
  • If you are using a cable between the computer and the converter, make sure the cable is of the right type(0-modem) and that it has all the connections, not just RX/TX and GND. (I doubt you have a problem here, as you have an indication on TX, but still might be worth a look).

Not a lot of help here, just further question I’m afraid. I hope they might have given you some debugging Ideas.
Would you mind posting:
  • The code you using
  • The make of the RS232/RS485 converter
  • A drawing of the physical connection
  • Further information about the instrument?

Best regards Espen

Link to comment

Hi,

I checked by giving starting addresses as 4,5,.. as specified by you,but still there is no value in the "Registers" indicator of "Modbus Serial Mater Query.vi" also nothing is indicating in "Exception Code" indicator of the same vi.

Regarding RS 485 to RS 232 Converter,

Make : Radix(Actually Radix makes Temperature Scanner and Converter also)

Connections:

In front end,one side, two terminals(D+ and D-) are connected to Instrument D+ and D- Terminals.

Another side,three terminals(230 VAC,Neutral and Earth) given supply Line,Neutral and Earth Terminals.

And in front end,9 Pin Female(RS 232) Connector is there and i used one Serial Female to Male cable for connecting my PC to the Converter RS 232 port.

Please find the attached front view of the RS 485 to RS 232 Connector drawing.

Please find the Code attached,

Information about the instrument(Related to Communication Part only i got from the Radix Design People) and please find the attachment.

Regards,

Bujjin

post-16140-124867891999_thumb.jpg

Modbus Communication RS 485(8.2).vi

MODBUS-RS485-STD.pdf

Link to comment

Hi,

Thank you for the extra information.

I could not find the converter on their web page, would you mind posting the documentation for it? I’m curious as to how they manage the timing(fixed 9600, adaptive, dip settings...), and if there might be some issue there.(Doubtful since same manufacturer, but you never know).Forget what I put about the cable, I don’t know why I was thinking 0-modem.

I realize that when I open the VI, I get the default values, and that you will have been testing with other inputs, I will still comment on a few things, just in case:

The modbus slave address was 0. Have you double checked that you use the same address as you setup in the instrument dip switches(0 is not an option), I must admit that I have often set up addresses wrong by looking at the switches upside down, or by calculating the hex value wrongly.

"Use MODBUS Data Unit?" was set to true, but Modbus data unit is not wired.

Quantity is set to 1, 2 is likely the minimum usable number.

I don’t see any problems in the code, but as I mentioned, I have not used these VIs my self, so I don’t know if there are any quirks in the setup. Did you get a chance to try portmon? If so, it would be cool if you could post the data that actually make it to the comport, I should be able to tell from that if there are any surprises.

Regards,

Espen

Link to comment

Hi,

I will contact with the Radix Design People and i will send you the details regarding the converter,

Also if any other types of converters are there, i will test...

And meanwhile i will check the Slave address of the instrument(Right now,I am using "0",because.If i give other values,Lab VIEW is gving"Time out error"

Actually,i dont know how to check this slave address,i think i have to open the instrument and see dip switched position,am i correct?

Also I never used Portmon till now,and as per your comments,I downloaded and when i am trying to connect to my computer,Its saying that "Local Computer cant be used for port Monitoring"

If you tell me how can i use this portmon,I will check that option also,

Thank you very much for giving immediate responses,

Regards,

Bujjin

Link to comment

Hi,

Modbus Slave address 0 is supposed to be a broadcast address, except only some manufacturers has any support for it, and most of those have differently implemented support. Time out error is what I would expect you to get if there was no data returning from the unit. Are you sure you are not receiving any response from the unit? You could verify this using Portmon. The documentation you sent me did not indicate any support for address 0, so I would open the unit and se the address as indicated in the documentation chapter 2. (OBS: Notice that in the drawing, it looks as though they are saying that if the switches are in the on position, they are actually off... Take care to reason it out before making changes.

The 232/485 converter documentation indicates that no setup is needed of it, cool. The connection it indicates is strange though. It specifies that for a Single unit connection, the connection should be D+ to D- and D- to D+. I can not se that working. Make sure you try with D+ connected to D+ and D- connected to D- as well.

I would try the following:

Monitor communication with Portmon or other software/hardware

Use the same modbus slave address as the instrument

Make sure "Use MODBUS Data Unit?"is false.

Set quantity to minimum 2.

Try both 0 and 1 as start address.

Try both FC 3 and 4.

Use baud rate 9600.

Connect D+ to D+. F the user manual.

Restart everything, including the coffee maker.

Espen

Link to comment

Hi,

Modbus Slave address 0 is supposed to be a broadcast address, except only some manufacturers has any support for it, and most of those have differently implemented support. Time out error is what I would expect you to get if there was no data returning from the unit. Are you sure you are not receiving any response from the unit? You could verify this using Portmon. The documentation you sent me did not indicate any support for address 0, so I would open the unit and se the address as indicated in the documentation chapter 2. (OBS: Notice that in the drawing, it looks as though they are saying that if the switches are in the on position, they are actually off... Take care to reason it out before making changes.

The 232/485 converter documentation indicates that no setup is needed of it, cool. The connection it indicates is strange though. It specifies that for a Single unit connection, the connection should be D+ to D- and D- to D+. I can not se that working. Make sure you try with D+ connected to D+ and D- connected to D- as well.

I would try the following:

Monitor communication with Portmon or other software/hardware

Use the same modbus slave address as the instrument

Make sure "Use MODBUS Data Unit?"is false.

Set quantity to minimum 2.

Try both 0 and 1 as start address.

Try both FC 3 and 4.

Use baud rate 9600.

Connect D+ to D+. F the user manual.

Restart everything, including the coffee maker.

Espen

Link to comment

Hi,

First of all thank you very much for giving an idea for me regarding use of Portmon or other software,

As i already told you that I am not able to connect to the instrument using portmon,

I searched in google for any other software for monitoring serial parameters using Modbus,after so many searches,

Modscan 32 (Win Application) is one of the results of searches,I simply installed and I read the instructions usind help? and gave setting as you told..

When i am selecting "Read Input Register", In output frame,address is starting from 30001,

When i am selecting "Read Holding Register", In output frame,address is starting from 40001,

Also as perthe reg addressed given by the instrument designers,Absolute addresses are starting from 40001,so i concluded that this is the first mistake i have done and

Also,I came to know from the Instruement Manufacturer that there is no any Dip Switches Configuration in the Instrument,

So I simply started from "0" as starting address

When i give starting address as "0",I am getting "Time out Error"

So i keep on increasing, and when i give "2",I am getting Data in the output frame...i.e.communication is happenning and my 2 LED s(TXD and RXD)keep on continuously blinking,And as per this settings,

I gave same setting in Lab VIEW Code,and When i run the VI,I am getting some values in the Register output of "Modbus Serial Master Query.vi" and as per your suggestion,i typecasted to SGL and I am getting exactly same data as the instrument is showing...

Thank a lot ,for helping me and without any "OPC SERVERS","DSC MODULES",I got it,its because of your guidence only,

thanks a lot once more,byeee

Thanks and regards,

Naresh.N

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.