04-04-2023 01:27 PM - edited 04-04-2023 01:33 PM
Hello,
I am trying to monitor some holding registers on a KEP Supertroll 2 flow computer via modbus RTU RS-232. I have a DB9 to USB cable.
I have followed as many of the troubleshooting steps that an can from the NI suggestions: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019L3mSAE&l=en-US
I have confirmed that everything is connected properly
I have confirmed the cable is working properly via the recommended serial loopback test
I have run the shipping example with the same timeout result.
I have completed an I/O trace (I will attached the results of the trace)
Based on the results of the trace and that the flow computer is rather old I am skeptical that I need to implement a wait time between the read and write commands but I am not sure how to do so.
I am using an almost identical code for a RS-485 device without any issues.
Any help is appreciated!
Thanks!
04-05-2023 02:32 AM - edited 04-05-2023 02:40 AM
- The sub VIs are not part of LV, so the code cannot run on other computers
- ModBus registers always are on even numbers. Why deduct 1 from the address which the front panel shows as 256 so it becomes 255? I suppose that's the reason, an invalid address.
04-05-2023 07:35 AM - edited 04-05-2023 07:36 AM
Thanks MaSta,
The register address of 256 is the default starting value in the other LV program I referenced. That device had a register offset so I added the deduct for simplicity on the front panel control. If not needed for this device I intend to remove it. I just have not changed the default value yet as I have not been successful in communicating with the new device via LV. Below are the register values I will eventually be reading. I have tried multiple register numbers and variations of the register numbers and have not had any success.
04-05-2023 10:21 AM - edited 04-05-2023 10:23 AM
Ok, but in the code you still deduct 1 from the address. So register 40001 would be read from address 40000, given you enter 40001 as starting address from that list.
04-05-2023 04:34 PM
@MaSta wrote:
Ok, but in the code you still deduct 1 from the address. So register 40001 would be read from address 40000, given you enter 40001 as starting address from that list.
I keep forgetting that modbus counts from 1, but code starts with zero. Or did I remember that incorrectly?
04-05-2023 04:49 PM
With 232 you might need to make sure both your serial adapter and device have matching flow control settings (RTS/CTS). Modbus protocol doesn't specify what it should be, but if your device wants to use RTS/CTS your adapter will have to support those lines and you may need to dig into the Plasmonique vi's to see if you can set it there.
Also 232 protocol is only point to point so some devices don't bother with addressing, but again, you would have to check the manual.
04-06-2023 07:51 AM
@billko wrote:
@MaSta wrote:
Ok, but in the code you still deduct 1 from the address. So register 40001 would be read from address 40000, given you enter 40001 as starting address from that list.
I keep forgetting that modbus counts from 1, but code starts with zero. Or did I remember that incorrectly?
Actually address 40001 is Modicon address mode.
The 4 means that it is a Holding Register , the remaining 4 decimals are the register number but that is 1 based while the address range is really 0x0000 - 0xFFFF. But with 4 decimals you can go at most to 9999 which corresponds to address 0x270E. To achieve the full address range in Modicon address mode, sometimes 6 digits are used like 400001.
04-06-2023 09:45 AM
Thanks StevenD,
I tried every option out of desperation with no successes.
I have been able to communicate with the flow computer using the manufacturers service software so I know that the cable/communication controls are compatible. Was hoping I just had to pick the right one. Below are all the options available with this specific VI.
04-06-2023 09:48 AM
Thanks for the information,
I also tried removing the 4 from the register address today and unfortunately unsuccessful as well. Also tried this in combination with StevenD's suggestion of flow control settings. Still no luck!
04-06-2023 10:50 AM
Fire up a serial port sniffer while using the manufacturer's software?
-AK2DM