Modbus TCP Codesys Comunication

skrdem507

Member
Join Date
Nov 2014
Location
Panama
Posts
6
Hi guys this is my first post i have been searching for information about how to link a AC500 via modbus tcp with a network analyzer M2M ABB
 
I have used Modbus/TCP with the AC500 family for several project, and it is extremely confusing. The addressing is very difficult to figure out. There are a number of steps to do, both in the configuration area and in CoDeSys. Do you have any documentation or app notes?
 
Here you go. Sample read. The 1st part is the program definition + variables. The 2nd part is the code.


PROGRAM PLC_PRG
VAR
MBTCPMast :ETH_MOD_MAST; (* ModbusTCP master function block *)
pollTON :TON; (* Timer for message polling *)
MBinData : ARRAY[1..10] OF WORD; (* Data read from remote device *)
END_VAR

VAR_GLOBAL CONSTANT
MBfcode_ReadRegs : BYTE := 3;
MBfcode_WriteRegs : BYTE := 16;
END_VAR


(*-----------------------------------------------------------------*)

pollTON(IN:= NOT pollTON.Q, PT:= t#100ms, Q=> , ET=> );

MBTCPMast(
EN:= pollTON.Q,
SLOT:= 0,
IP_ADR:= IP_ADR_STRING_TO_DWORD('192.168.1.2'),
UNIT_ID:= 0,
FCT:= MBfcode_ReadRegs, (* Modbus function code *)
ADDR:= 0, (* Modbus address = 400001*)
NB:= (SIZEOF(MBinData)/2), (* Communications block size (in words, not bytes) *)
DATA:= ADR(MBinData), (* Pointer to ComBlock *)
DONE=> ,
ERR=> ,
ERNO=> );
 
The documentation i got is the general information of the SLAVE (M2M), and the one you get in the help instruction in the codesys, im gonna try your code ill reply to u later on how i did. if u guys got some examples or printscreens from ur projects i will be more than gratefull.
 
Feel free to contact me. It's going to be a hairy week but I check the site daily.

Good luck!

Yosi
 

Similar Topics

I have a program for a PLC, but I don't have the PLC now. I am running the PLC program in the Codesys simulation mode. Can I connect SCADA to...
Replies
2
Views
1,758
I'm going to be adding Modbus TCP communications to a Turck Codesys system. There will be more than one HMI hitting the Turck hardware, hopefully...
Replies
0
Views
1,056
Hi all, A couple of years ago, I ran some tests with MODBUS TCP communication between rPi running CodeSYS and a couple of Arduino's. I remember...
Replies
6
Views
3,087
Hi folks, I'm running eCockpit version 1.3.1.4 I have set up a Modbus client function using the standard library module: FbMbMasterTcp. My...
Replies
4
Views
3,859
Hello! Is there any readily avalaible function blocks for this?! Found heaps of Codesys 2.3 stuff, but the libraries have changed and can´t be...
Replies
15
Views
11,112
Back
Top Bottom