Hex values in ccw 12

Join Date
Sep 2021
Location
lima
Posts
4
Good day if anyone can help

I am trying to display my data in hex values, but only find that decimal works in ccw12. is there any way to display those decimal numbers in hex?
 
Note: this would be much cleaner in ST.



Here is the main program running.

  • Variable "the_dint" is a DINT with a value of -2.
  • Variable "the_hex" is an 8-character string.
  • User function i2hex takes a DINT as input and returns an 8-character string as output.

zzz.png

Here are the first few rungs of the i2hex user function. The last rung is duplicated five more times with the REPLACE instruction Pos parameter being reduced by one per rung ...

xxx.png

Here are the last two rungs of user function i2hex. the final nibble is converted to a hexadecimal character and inserted into variable "lcl_str," then "lcl_str" is copied to be the output of user function i2hex.

yyy.png

Here are the variables for user function i2hex. The key is the 16-element array of 1-character strings s15s; one low nibble at a time is extracted from the local DINT copy of the input DINT, and the resulting nibble is subtracted from the local DINT and the rest of the local DINT is shifted down by four bits. The nibble's value in the range [0..15] is used to select a one-character element of s15s and REPLACE one character in the lcl_str output string. Finally, lcl_str is copied to be the output of user function i2hex.

aaa.png
 

Similar Topics

Hi Everyone, Just wondering if anyone could help me with an issue I'm having? I'd like to display a fault code that is referenced in Hex on an...
Replies
2
Views
1,594
Hello everyone, I'm working in RSLogix 5000. I have an ASCII string of letters & numbers (call it String_3) which I have used INSERT to add a...
Replies
3
Views
2,323
Gurus, I have a question for rslogix 5000, is there any command that can convert dec to hex value and then swap the bits around? For example...
Replies
4
Views
3,072
Hi I have a DB with 512 config bits that i wish to get the inverse of into another DB (ie if bit 1=1 in DB14 then i wish bit 1=0 in DB13) I am...
Replies
5
Views
4,143
Hello, I'm trying to setup a TCP connection from a Compactlogix 5069-L306ER to a TDI checkweigher to receive real-time weight data of the...
Replies
6
Views
335
Back
Top Bottom