Help sending ASCII via socket COMM

shallels

Member
Join Date
Jun 2018
Location
usa
Posts
2
I am very new to programming PLCs, and one of the first tasks I received was to create a program that creates a socket connection between my PLC and another company's computer.

By using Allen Bradley's socket manual, I was able to do so without issues. I can send messages to the guy's computer with no problems!

However, he is requesting I send specific messages in a specific order with ascii codes.

HERE is an example of what kind of message to send:


<STX>00001|KEEPALIVE<ETX>

Start of Text - # of message – Field Separator – Message Data – End of Text


I know CONCAT, and can combine all the strings etc, but how to I actually send the "STX and "ETX" in raw ascii code?

My PLC is a compactLogix 5380, and I use PuTTY to test everything.
 
Thanks for the reply. I have those codes on hand but how do I actually use them to send in a message?

Right now I have it set up to send a message in the form of a SINT[480].

How do I physically get the "start of text" and "end of text" in that?

I once had a task close to this, and did the following:

Make sure the first SINT in the array has the value of STX and the last value of your message to send has the value of ETX.

So your first SINT would be STX
Code:
00000010
and your last would be ETX
Code:
00000011
 
(Caveat - I am not an Allen Bradely/Rockwell user)

I googled non-printable ASCII characters for Rockwell and came up with this link http://literature.rockwellautomation.com/idc/groups/literature/documents/pm/1756-pm013_-en-p.pdf which is the "Logix 5000 Controllers ASCII Strings" manual which I believe should be relevant in general for your controller.

On page 18 of that document it shows an example that has in it:

The $14 counts as one character. The hex code for the Ctrl-T character.

I think this is the sort of thing that you are looking for.
 
To enter special characters you can use "$" prefix.
in String editor you can use $10 and $11 to represent STX and ETX

You can also use MOV instruction to populate specific charcters for example
MOV 16#10 MYSTRING.DATA[0]
MOV 16#11 MYSTRING.DATA[xx]
 

Similar Topics

I am new to programming in PLC, i have Allen Bradley SLC 5/03. I tried using AWT inst. with data in ST9:0 file directly but in 3 inst. getting...
Replies
4
Views
4,040
Hi I have a job to do which is to have a call button and a sounder on either end of a line so if the operator needs assistance they can press the...
Replies
10
Views
3,892
Hi all, awsome forum, great wealth of knowledge. Little about me, I have been programming plcs for about a year now and have a background of...
Replies
0
Views
2,708
Can anyone help place a message in a string data file so that it can be sent via email to the desired location.Any code using RSLogix 500 will be...
Replies
13
Views
2,269
Hi, We have an application that has a device that goes through a reboot (appears un-graceful) What then happens is the MVI module appears to hang...
Replies
0
Views
49
Back
Top Bottom