You are on page 1of 1

Start by looking at Help->Examples .. Project Examples->FB Protocol.

You'll read barcodes as strings via the RS232 port and extract the data you want
using the String functions.
Beat on it a bit and post your code for more specific help from the forum.

First, you cannot put number 569960 in MI for thhe same reasons you cannot put
elefant family in a small car. MI is 16 bit signed register. The range there is
from -32768 to +32767. Maybe you need ot use ML or DW...?

Then - why not to use ASCII ot NUM function to convert the whole ASCII string to
number in one cut?

If you still want to work the way you offer:

Store the fist number in a buffer;

Multiply the second number by 10 and add it to buffer;

Multiply the second number by 100 and add it to buffer;


===========

UniGuru
MVP 2015

261
Posted March 20, 2012
This is more simple than you think. When I first looked at this I was going down
the hard road too till the EE accross the hall set me straight. As long as you bar
code reads are always the same general positions just multiply the numbers by there
relative position then add them together to come up with the final number. So for
your example of:

is (0*1) + (6*10) +(9*100) + (9*1000) + ....... Ect.

However, in this example it will not fit in an MI. I have asked the question about
using a standard MI without reserving the negative sign so that you can show the
number you have in your example. The answer was that you can not, you can only show
MIs as -32768 to 32767. So in your example even if you are able to functionally do
what you want you will have to save the value in an ML and not an MI.

A general question to anyone else is there an SB82 long integer function like there
is for M90/91 and JAZZ models to act on the the next two MIs as a pair? (or some
other way to not use MLs since there just are not that many MLs available).

You might also like