AB micrologix 1400 counter move

These are two different data types: float and a string. You'll have to utilize the AIC instruction after breaking up the float into some integers. Have you tried a search in this forum, I have to believe its been addressed here before.
 
I tried moving to and integer file then to a st file but it causes a math overflow error. Im assuming because to value is to large
 
When moving a Float to a INT you need the change the length of the move instruction to "2". Float is 32 bit and INT is 16 bit.
Example:
F8:0 will fill two ints N7:0 and N7:1
 
Take a step back; these are totally different datatypes. Just 'moving' the values in their bytes doesn't work.

Let's say F8:0 has the value 123.456

MicroLogix controllers use a 32-bit single-precision IEEE 754 floating point datatype. In hexadecimal, that value is 0x42F6E979.

[Nifty online tool at SUNY Queens College]

Converting that to ASCII strings, especially in a MicroLogix, requires more than just moving a few bytes around.

The MicroLogix/SLC-500 operating system doesn't have a REAL-to-String conversion instruction like the ControlLogix/CompactLogix does.

So you'll have to write a routine to extract each digit of the floating-point number by division and truncation, then use the Integer to ASCII (or simpler math adding single digit values to the ASCII value for Zero) to put those values into a String.

It's a little tricky for a novice; I'd probably spend an hour writing and testing such a routine. Maybe somebody has an example handy, or you can find one in the archives.
 
Ron's been dead for... what, five years ? And he still contributes.

I didn't appreciate him as much as I should have.
 
As long as you are satisfied with the result I guess it's ok.

I, just for curiosity, would like to see the sequence of instructions you used, the final contents of the float,long and string and the significance of the value you are moving.
 
I think what Ken is saying (not about the dead guy) is that you might be able to make the move but if not done correctly the data won’t be valid after the move (Ken correct me if I’m wrong).
 
You're exactly right, Firejo.

The instruction will be verified by RSLogix 500, but I don't think Ateall217 will get the result he wants.

Using the MOV instruction will convert between datatypes automatically. For example:

Code:
MOV
Source   F8:30  
         12345678.910
Dest     L11:0
         12345678

MOV doesn't work on Strings, except to move ASCII codes into the string data elements.

Maybe ateall217 used the ASCII to Integer (AIC) instruction on the Long Integer value, to convert that to a String. In the MicroLogix 1400, both ordinary N files and long-integer L files can be used as the source for the AIC instruction.

I didn't recomend that at the beginning because he specifically asked about converting a floating point value, not the whole number portion of a floating point value.
 
I did use the AIC function to convert the long internet to string.yes, I should have been more spisific . I was trying to move a total counter with a value over 39000 to a string file. I tried posting a pic but was unsuccessful.
 

Similar Topics

trying to do division on the hsc:1 value which is on a Long (32bit) word. If I do a divide by 100 and try to put the result in an integer or even...
Replies
9
Views
2,404
hello Sir, I am trying to program for the speed(1000 rpm) with a sensor input and for this i used micrologix1400 BXB plc. I am not able to use...
Replies
1
Views
2,531
Hi all I have a Micrologix 1400 1766-L32BXB and I want to use one input as a pulse counter from flow meter. I don't want to use HSC to save on...
Replies
4
Views
2,992
Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
60
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
118
Back
Top Bottom