Manipulating L# data type in ML1400

RPax

Member
Join Date
Feb 2004
Posts
125
Hi, I was wondering if you could help. I am using a Micrologix 1400 where I have an 11 digit number loaded in a L# data type (doubleword). This comes from a barcode scanner.

I need to send this value to another ethernet connection (Via TCP IP) which only accepts either Word or Real. When i move the L# data type to a floating point and use the MSG instruction the value comes out truncated on the other side.

I was wondering is it possible to split the L# data type 11 digit number and send as 2words\integers i.e 6 digits in one word and 5 in the other or something to that effect. On the recieving side I can put back together.

Appreciate your help on this - Rpax
 
Even using 6 digits is outside the range of a word/int. Can you use a ST file to store the 11 digit string as ascii code? I guess it depends on what your receiving device is capable of understanding and how flexible it is to piece something back together. I would think you could transmit the ascii string in word chunks, as long as your receiver can be told to interpret the result as ascii characters.
 
My mistake, looks like you can directly reference each bit in the L file. If this is the case, just have each bit turn on a bit in an N file.

ex. XIC L9:1/0 OTE N7:0/0...etc

Once you have that, just send the data across (N7:0 and N7:1 in this case) and piece it back together in the receiver. Just be aware it won't show up properly in the PLC as the N words ae signed ints.
 
Thanks for the reply, as a matter of interest is it possible to move an L# Long Word into a floating point without the number being rounded up? Thanks again
 
Thanks again for you replies. Unfortunetely, my mapping from the L data type bit to two interger bits wasn't sucessfull as when I sent the data to the processor on the other side it picked up the digital number incorrectly. I also couldn't map over a floating point due to the rounding up issue as Bernie mentioned.

What I plan to do is take a 9 digit scanned number in an L data type and break it up into 3 seperate 3 digit numbers i.e. 123456789 will now be loaded into integers as N7:20 123, N7:21 456 and N7:22 789 and send over.

Due to the problems with the rounding up issue in calculations I was wondering would the following few code lines be correct(attached PDF) to do the above?. Appreciate any advice on this RPax
 

Similar Topics

Using a 1769-L16ER-BB1B We are receiving a DINT from an external device. Then changing the sign using a SWPB order mode REVERSE dest Dint_2 same...
Replies
7
Views
3,060
I have a barcode scanner reading bin labels and handing a string to an Laser Guided vehicle to place the bin in its appropriate location based on...
Replies
1
Views
1,265
Hello, Have aoi written in Ladder to pass in and out string variables. String VAriables that interact with PLC program are declared as InOut...
Replies
5
Views
4,307
Hello everyone. I have a quick question regarding dates in Structured text. What I´m trying to do is to take the current date, add/subtract days...
Replies
3
Views
1,624
I'm looking for a decent way to set independent statusbits of the statusword in simatic Step7. (CC0 - CC1 - OV - BR - etc...) When I want to set...
Replies
17
Views
3,377
Back
Top Bottom