Realwa

S7-1500 Ascii

1 post in this topic

Hi All

need to convert a Decimal Value into Ascii code to send out on serial 485. eg. Weight comes in as Int 12345 i need to send it out in Ascii as 23 32 20 31 32 33 34 35. I have created an array 0 of 8 (Word) DB. Is there an easy way split the int into Digits convet in into HEX and slot the value into the various array positions?

Array 0 of 8 = 23 means #

Array 1 of 8 = 32 means 2 (Station ID)

Array 2 of 8 = 20 means Space

Array 3 of 8 = 31 means 1

Array 4 of 8  = 32 means 2

Array 5 of 8 = 33 means 3

Array 6 of 8 = 34 means 4

Array 7 of 8 = 35 means 5

Array 8 of 8 = D means CR   

this sends the value of 12345 to Display ID 2 . need help to convert the decimal number in ascii. the decimal number will be max of 5 digits and less than 32000

 

any help will be greatly appreciated.

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