Modbus Write command format

Hi
I'm trying to understand how to write to a modbus register.
I purchased an Active X control from Modbustools.,com
My goal is to read/write data values in an Automation Direct productivity 2000 P2-550 cpu. via Ethernet.
Once installed in my Visual Basic 2010 application I was able to connect to the PLC and read bits, & registers with no trouble.

When I try to write however I'm having difficulties.
The command I'm sending is
Result = WsmbtControl1.WriteSingleRegister( UnitID, Address,Register) where the UnitID is 0, the Address is 5 (I'm trying to write to modbus 40005) and the data is 0
I keep getting a Popup box displaying "Illegal data address"

I've contacted the company I bought the activex control from several times and they have not been as helpful as I'd like. I don't want anyone to write my application I need to know how to format a correct write to register command.
What about the command I'm sending is wrong with the address?
Does anyone know what I"m talking about?
Dana
 

Attachments

Top