ReadHoldingU16(Station, Starting Address, Num Points)


c3lighting

Recommended Posts

I have followed the example in the user guide page 308 and have setup Register10 - 17. My device (Modbus_RS_485) is working using force coil and read coil status.

I am using the same device for testing the following sequence:

Sequence name: Read_Coil_Status_1

private data

while (1)

data = Device.Modbus_RS_485.ReadHoldingU16(32,10,8)

Register10.AddValue(Private.data[0][0])

Register11.AddValue(Private.data[0][1])

Register12.AddValue(Private.data[0][2])

Register13.AddValue(Private.data[0][3])

Register14.AddValue(Private.data[0][4])

Register15.AddValue(Private.data[0][5])

Register16.AddValue(Private.data[0][6])`

Register17.AddValue(Private.data[0][7])

delay(1)

endwhile

Daqfactory is sending: 20 03 00 0A 00 08 62 BF

My PIC code is responding with: device 20, function 03, number bytes 08, data 0 01, data 1 01, data 2 01, data 3 01, data 4 01, data 5 01, data 6 01, data 7 01, CRC 47 9A

The error I get in the command alert window is: P-ModbusRTU 0010: Timeout: Read_Status_Reg_1 Line 3 - Uncaught error in sequence Read_Status_Reg_1

I am not sure why I am getting the error.

Regards,

Bob

Link to comment
Share on other sites

Sorry, I'm going to get on your case about this since you are doing a modbus implementation in firmware and I / DAQFactory may not catch all your errors: reread the Modbus spec carefully! When a modbus master requests 8 values, it expects 8 words, not 8 bytes. A register in Modbus is 16 bits, not 8. You need to return 00 01 for each value. DAQFactory doesn't look at the number bytes in the response (byte 3) as it is unnecessary. It can easily calculate what the expected response length should be. That's why its failing, it expects another 8 bytes.

If it makes you feel better, a customer using DAQFactory with a new model of a Unitronics PLC was getting timeout or some other error in DAQFactory. On close inspection, we discovered that there was a bug in the Unitronics modbus slave implementation. Fortunately, Unitronics was receptive to this and fixed it right away. I will admit that DAQFactory has its quirks and issues, but the Modbus implementation is pretty darn solid. If you are getting errors, you most likely have a bug in your firmware. I'm not trying to discourage you from posting questions here at all and am glad to help.

Link to comment
Share on other sites

Thanks - not blaming DaqFactory - I see the error in my understanding / firmware and it is an easy fix. I know that it is nearly impossible to catch every off-nominal that someone can throw at DaqFactory.

My boss is very happy with the speed at which I've been able to create a control panel in DaqFactory and control our LED dimmers and now read the ADC value from the PIC to show the amperage / wattage usage on each channel in DaqFactory.

The investors are excited about our "clean tech" LED control system and fixtures and the fact that we can use a PC to handle the energy management.

Regards,

Bob

Link to comment
Share on other sites

No worries, and I'm sorry if I was getting on your case too much. I'm just trying to help you make a good Modbus slave implementation.

BTW: if you guys are interested in an OEM arrangement with DAQFactory, or to provide simple, secure Internet access to your LED control systems (without a PC) in an OEM arrangement, please contact us directly. It looks like you may be headed that way a little with your Intellis product, but it is unclear if you are doing what everyone else does (put a webserver locally, which is a pain to setup and not particularly secure) or another arrangement. There are a lot of options with the DAQConnect product.

Link to comment
Share on other sites

We are very much interested in an OEM arrangement with DAQFactory. I've had these dicussions with my boss already. As soon as we firm up our requirements I'll be in touch. Let me know the best way to communicate with you all.

Currently our main markets are medical lighting (MRI suites), quick service restaurants (menu board retro-fit), and general archtecial lighting. DAQFactory fits in where we can use a tablet PC based solution and give customers remote access to there energy management data.

Link to comment
Share on other sites

Archived

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