Scorpio
Member
Converting Floating point to two integers in PLC 5
I am working with AB PLC 5 and a Laser Control System that will only pass data via Integers.
When I need 32 bit integers I receive data in two words, which is easy to convert to a floating point to see actual data.
When I need to SEND a 32-bit word I do not understand how to convert this to two integers.
Example Reading Data:
When I reach my set point, the laser sends me the location in MM
N12:3 = -22151
N12:4 = 2
I convert this to a Floating Point
F8:0 = 174458
Another example is
N12:3 = 23921
N12:4 = 1
F8:0 = 89458
So as I have all my locations stored in a separate Data Table, I intended on simply moving the floating point value of the location, calculating the correct integers and sending these to my laser. Easy pleasy… But I can’t figure out the conversion…
Any help would be appreciated… (A LOT)
Ummmm I have been cookied so long at work with the board here, I forget my password...
I used to be called Rsviewrulz... Just so ya all know I have been around a little while.. (long enough to be forgetful)
Thanks...
Sam
I am working with AB PLC 5 and a Laser Control System that will only pass data via Integers.
When I need 32 bit integers I receive data in two words, which is easy to convert to a floating point to see actual data.
When I need to SEND a 32-bit word I do not understand how to convert this to two integers.
Example Reading Data:
When I reach my set point, the laser sends me the location in MM
N12:3 = -22151
N12:4 = 2
I convert this to a Floating Point
F8:0 = 174458
Another example is
N12:3 = 23921
N12:4 = 1
F8:0 = 89458
So as I have all my locations stored in a separate Data Table, I intended on simply moving the floating point value of the location, calculating the correct integers and sending these to my laser. Easy pleasy… But I can’t figure out the conversion…
Any help would be appreciated… (A LOT)
Ummmm I have been cookied so long at work with the board here, I forget my password...
I used to be called Rsviewrulz... Just so ya all know I have been around a little while.. (long enough to be forgetful)
Thanks...
Sam