Sign in to follow this  
Followers 0
macg

ASCII !@#$!@#(*&^

4 posts in this topic

Hi Guys,

I need help/advice.  First, I'm not new to PLC programming and design. I've been doing this for 30 yrs.  OK that said, 30yrs ago I cared about things like PLC5 serial communications sending ASCII characters as it was a common thing.  Well, I've slept and drank a whole hell of a lot in 30yrs so I really don't care now but I need to do it again.

I'm working on a PLC5 to Control Logix conversion.  The company will not update this ancient chamber environmental control.  So, the ASCII coms need to stay.  The old PLC5 took the command string to change the temperature and did a AWA command and out port 0 the new temp setting went.  Logix however, it is not that pretty.  I'm using a Prosoft Technology PLX31 Ethernet to ASCII.  My problem is, the Prosoft device data table in the Logix is data type SINT.  How do I get the command string "L1S"+temperature value, example 27C, so the command would be "L1S27" into the data type array of SINT.   The header is constant.  The only thing that changes is the digits.  So would you guess I convert the L & 1and put those in the first address, S and the first digit of the temperature in next address and the remaining digits in the 3rd word?  

Perhaps I'm making it all too difficult.  From what this old memory is telling me, I need to convert each character into the ASCII Hex or Decimal equivalent.  So anybody out there still familiar with this s....tuff? 

Share this post


Link to post
Share on other sites

"27" is two bytes or characters or SINT.

"2" = 0x32 = 3x16+2 = 50 decimal

"7" = 0x37 = 3x16+7 = 55 decimal

 

Share this post


Link to post
Share on other sites

Hello,

You can assemble your command as a STRING datatype, then copy into the SINT output array to the prosoft... maybe something like this (note: assumes temperature is always 2 digits - you can extend with error handling and a few more "belts and braces"

 

Good luck,

vds

 

ASCII_toProsoft.jpg

1 person likes this

Share this post


Link to post
Share on other sites

Thanks VDS.... most helpful post of response.  

I'm sure you older guys understand my frustration.   This stuff was supposed to go away with our youth.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0