Codesys convert word to bytes

Intelduopower

Member
Join Date
Aug 2017
Location
Michigan
Posts
2
Hello,

I am new to Codesys 3.5 and I am trying to figure out how to convert a word into 2 bytes to send to another plc via ethernet/ip. Could someone share copy of code that will make this work please?

Thank you
Intelduopower
 
Hello,

I am new to Codesys 3.5 and I am trying to figure out how to convert a word into 2 bytes to send to another plc via ethernet/ip. Could someone share copy of code that will make this work please?

Thank you
Intelduopower
Hello and welcome to the forum. What is the other PLC brand?
It is important to understand this because EtherNet/IP has different mechanisms for communication. Codesys has EtherNet/IP scanner functionality with the basic license; so you can talk to a PLC which supports EtherNet/IP adapter functionality. It has an optional license for EtherNet/IP adapter with which it can communicate with an EtherNet/IP scanner. If the other PLC is a Logix processor, which supports CIP symbolic messaging, you can write a program that allows the Codesys program to read or write Logix tags directly. This is not trivial endeavour but fortunately there is a post in which some of us cracked this problem and may be useful for you.
It is a long post so you may want to go to page 5 directly.
http://www.plctalk.net/qanda/showthread.php?t=127087&page=5
 
Hello,

I am new to Codesys 3.5 and I am trying to figure out how to convert a word into 2 bytes to send to another plc via ethernet/ip. Could someone share copy of code that will make this work please?

Thank you
Intelduopower

Not sure I understand the issue here. The data is stored in bytes regardless. All you need to do is to provide a pointer to your source data and reference the data in byte format in your destination. With atomic data the only issue you will encounter is arrays of BOOL data which is stored as DWORDs (each DWORD = 32 bits) in ControlLogix PLCs. If you're reading data structures you'll have to take padding into account.

Hope this helps,

(8{)} :) .)
(Yosi)
 
I am sorry I forgot to add the second PLC. I am trying to get a Codesys 3.5 to pass an analog value over to a Automation Direct Productivity 2000 plc. I have attached a jpeg of the code that takes 2 bytes and converts them into a word. I had help from Eaton on this code but was trying to figure out on my own how to take a word and convert it to 2 bytes. The P2000 requires a array of bytes. All of the I/O is in Codesys so I am pass the data only one way. I have already got the two plc's communicating and can send bool's back and forth so I know that is working.

codesys 3.5 bytes to word.JPG
 

Similar Topics

Hello experts :) I'm new to Codesys (3.5) and I am trying to make a program which takes a number 1-50 (read from some tags UID) and outputs each...
Replies
15
Views
7,468
Hi, It's been a while since I've been doing PLC work as I've been concentrating on a large security project. However I have a TIME variable in a...
Replies
11
Views
16,230
Hello, I am using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
267
Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
86
Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
133
Back
Top Bottom