RSLOGIX 500 Decimal to Hex

maverick2986

Member
Join Date
Jul 2006
Location
Murfreesboro
Posts
2
Hello,

I'm currently working on a vision system project where a camera takes a stored image of a pattern and compares it to an image just taken via a trigger (in this case sent from the PLC) and calculate the offset (X, Y in units of pixels; R in degrees). This ASCII string is then read into the PLC. I then "chop it up" into separate ASCII strings to extract the X, Y, and R from the data string. This then get concatenated with a transmission start code ($) along with a few other things and sent to a robot to calculate the offset before moving. I have the format roughly down, however I do have two problems. 1) The string output must be in Hex format so a "-2300" must be output as "FFFFF704". I have no idea of how to do this conversion. Even if I were to convert the ASCII value to an integer, how would I be able to then go ahead and convert it back into an ASCII value but in Hexadecimal format? 2) Many times the offset value is rather large and would probably cause an overflow if I were to convert the ASCII value to an integer. I thought about converting it to a Float but could not find an instruction for ASCII to FLOAT conversion.

Any help would be appreciated. Thank you.

Brian
 
There are instructions to convert ASCII to integer (ACI) and vice versa (AIC). As long as the values don't exceed the limits of a 16-bit integer you can do this in one word. Converting the integer to its hex equivalent in ASCII is tedious but not impossible. What I'd do is write a loop or subroutine to evaluate each 4-bit NIBL in turn and convert it to its hex ASCII representation and then concatenate (ACN) the resulting characters into the complete value.

If the values do exceed 16-bit limits there are multiple threads addressing the FLOATS to INTS conversion problem.
 

Similar Topics

Hi my problem may have a simple solution but i cant work it out. I need to use the Divide function but it wont let me use a decimal point in...
Replies
3
Views
1,712
Hi all, I am working offline on some code where I am comparing two values. B3:20 = 0000 0111 (7) N7:17 = 7 If I compare the two in an EQU...
Replies
9
Views
3,859
Hello, Haven't been on in a while. I need to generate a bit level pdf of the I/O for RSLogix 500. I can generate a report but it just shows the...
Replies
1
Views
115
I would like to copy register N61:131 thru N61:147 into ST252:0 I keep failing What happens is I copy into ST252:0,1, 2 etc. What am i missing...
Replies
18
Views
488
I'm trying to fix a mess of code on an older machine that's running a Micrologix 1400 and an RS232 ASCII barcode scanner. The previous guy had...
Replies
3
Views
308
Back
Top Bottom