kevilay

Issue Converting to String

2 posts in this topic

Hey Guys,

I am saving some stuff to a memory card on a cj2m PLC.

Barcode, P for pass f for fail, value

It would should look like

B12345 P 1790

However where I am having an issue is with the value. The data is a DINT and currently I am testing with a value of HEX 6FE, DEC, 1790, Binary 110 1111 1110. I am using a STR8 function to convert from the dint to a string however I end up with the HEX value (Shown Below). I tried an ASC function as well but ended up with a similar result.

B12345 P 6FE


Any ideas how to get the decimal value instead of the hex value.

 

Thanks,

Kevin 

Share this post


Link to post
Share on other sites

STR8 converts a 8-digit hexadecimal number to ASCII string.
Convert DINT to BCD first, using BDSL instruction.

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