Author Topic: TwinCAT with ModbusTCP using CX8000  (Read 2323 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
TwinCAT with ModbusTCP using CX8000
« on: August 24, 2014, 02:32:03 PM »
Just for a reference I wanted to post this information. I tested this with a CX8090 using flash card image version 353e

First off, this flash card version now allows the CX to work with the TwinCATCom driver which allows you to use variable names directly. This would be the preferred method. However I wanted to share how to use the ModbusTCP driver also.

The main bit of information I want to share is how a TwinCAT address converts to a Modbus address. Here is a sample variable that I created in TwinCAT:
Code: [Select]
VAR
ModbusOffset12288 AT %MW0 : WORD;
END_VAR

To show the value of this variable add a BasicLabel on the form and set the PLCAddressValue to 412289 (notice it is one higher than the offset, that's a typical modus thing).

The next TwinCAT address of %MW2 would be referenced by Modbus Address 412290. Notice that TwinCAT offsets are by byte and Modbus is by word, hence you add 2 to the Beckhoff address, but only add 1 to the Modbus address.
« Last Edit: August 24, 2014, 02:34:30 PM by Archie »