Mikeylikes
Member
Any one know how to take a floating point number and convert it so that it can be split to span 2 16-bit words in the +/- 0x7fffffff hex format, or signed 32-bit 2's compliment format? My application seems simple, but I can't seem to get it to work. I'm trying to control a servo motor using an Ultra3000i servo drive that is to be controlled from an Allen-Bradley SLC 5/04 PLC through Devicenet. The PLC does not support long integers, which would make this a snap. I've tried a few ways and I can't get it to come out in the right format. Maybe one of you has come across this in programming SLC's before.
In case you have the suggestion of using the 'COP' command, it won't work because it does not spit it out in the right format. It puts the signed bit in the low byte, which is not where it should be. Also, It puts an exponent value in there somewhere, which is not how the format is suppose to be. This is a stumbling block for me to be able to change drive parameters using the PLC, because some of my values that I want to be able change are high as 350,000.
In case you have the suggestion of using the 'COP' command, it won't work because it does not spit it out in the right format. It puts the signed bit in the low byte, which is not where it should be. Also, It puts an exponent value in there somewhere, which is not how the format is suppose to be. This is a stumbling block for me to be able to change drive parameters using the PLC, because some of my values that I want to be able change are high as 350,000.