NickCivco Posted March 20, 2012 Report Share Posted March 20, 2012 Hey all... Probably a simple question that I am overlooking. We have a barcode scanner hooked up to our 570, and it is scanning and putting data where we need it. We are converting the ASCII characters to numbers and putting each number in an MI. How do I connect the 6 MI's with a single digit in them, to make 1 MI with a 6 digit number. Basically: MI 10= 5 MI 11=6 MI 12=9 MI 13=9 MI 14=6 MI 15=0 and I would like MI 16 to read 569960. I have been racking my brain for about 5 hours on this, and can't seem to get it quite right. Thanks in advance. Link to comment Share on other sites More sharing options...
Emil Posted March 20, 2012 Report Share Posted March 20, 2012 Hi, 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; ... Link to comment Share on other sites More sharing options...
Walkerok Posted March 20, 2012 Report Share 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: 5 6 9 9 6 0 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). Thanks Keith Link to comment Share on other sites More sharing options...
NickCivco Posted March 20, 2012 Author Report Share Posted March 20, 2012 Thank you for the tips! @Keith- your way worked well! I got it to put together a full number, but not to display that in a text box, it shows up as an equation and not the number Any tips? @Emil I am working on getting your way to work. Am I thinking right that I need to scan the bar code, Save it to an ML, convert that ML ASCII to a number? Thanks again! Nick Link to comment Share on other sites More sharing options...
Emil Posted March 20, 2012 Report Share Posted March 20, 2012 The easiest way is to define in FB Protocol variable "Numeric" and to get the number from bar code direct a number. Other option - if you already have the ASCIII string, you can use ASCII to NUM function (Strings menu) to convert the number with one function. Both these ways seem to me very elegant. Link to comment Share on other sites More sharing options...
NickCivco Posted March 20, 2012 Author Report Share Posted March 20, 2012 I can get it to directly output to an ML now as a number. When I go to display this number in a Text Box it shows up as h2*. What else am I doing wrong? Sorry...I'm a PLC newbie, and we are trying to complete someone else half finished project! Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 21, 2012 MVP 2023 Report Share Posted March 21, 2012 Is your display object set up as a numeric variable or a string variable? If you're loading it to an ML the display object needs to be a properly sized numeric. Joe T. Link to comment Share on other sites More sharing options...
NickCivco Posted March 22, 2012 Author Report Share Posted March 22, 2012 Joe, Thanks for the heads up...one of my colleagues had pointed out I had an ASCII box instead of a Numeric Value box...thankfully an easy fix. Next issue...now that I have the 6 digit number scanning into an ML, I am having troubles getting this to Compare to a value in a data table. We have it setup now so you can manually enter a lot number and from the data table it will pulll a part number and rev. I am trying to make it so you can scan the barcode of the item number, and it will query the Data table, match the value, and pull the rest of the row in. I feel like I am close, but just can't quite get it! Thanks again! Nick Link to comment Share on other sites More sharing options...
MVP 2023 Joe Tauser Posted March 24, 2012 MVP 2023 Report Share Posted March 24, 2012 Have you looked at the "Data Tables-Find Row" function block? Joe T. Link to comment Share on other sites More sharing options...
NickCivco Posted March 26, 2012 Author Report Share Posted March 26, 2012 We had a conference call with our Unitronics distributor, and got that all figured out. Next question...probably more simple... I have a number box that the scanned number goes into just fine now. I have keypad entry turned on. Is there anyway to make that box so I can enter numbers via keypad or have them come in through the scanner? Thanks in advance! Nick Link to comment Share on other sites More sharing options...
Walkerok Posted March 26, 2012 Report Share Posted March 26, 2012 Hi Nick, The way you asked your question I am not 100% sure I understand what you are asking. It sounds like you all ready have the ability to populate a memory location with either information from the barcode scanner or a user putting in a number. If you do not then it is just a mater of direct soring your barcode information into the same memory location as the referenced MI in your keypad entry. If however you were asking if you can make a keypad entry and disable it (or not) you can do this as well by making a disable bit for the number entry box an d whenever the bit was true the ability to make keypad entries would be turned off. Keith Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now