SLC 5/03, MVI46-GSC, Barcode handling

Automate

Member
Join Date
Aug 2004
Location
Sydney
Posts
38
Hi need help with an application that I working on and I'm having trouble in manipulation of a barcode which I need to extract data from.

Hardware - SLC 5/03 with a Prosoft MVI46-GSC module
Barcode Scanner is on Port 1 of the MVI46-GSC
and a panelview600 is attached to the 5/03's DF1 port

So far I have configured the ports and I can get a barcode in successfully (ends up in the N12 register). I can also get the panelview to read the barcode as well. So as far as cabling and comms all is OK.

Where my problem lies is how can I extract part of the barcode if the following is what I need

RAW BARCODE is
"051001AB02 -109860"

WHAT I NEED to display is
"109860"

The hard part is that the barcodes are variable length, BUT there is always a dash in front of the portion that I need to extract.

If anybody out there has an example of code that I can use please help me out.
 
It looks like your raw data is in string format, but if it's in the N12 data file I would think it's in integer format. Check the properties of the data file for type of data (integer, string, etc.) If it's in integer format, set up an ST data file for string data. Use the AIC instruction to get the N12 integer into ST string format. Then use the AEX instruction to extract the digits you want. If it is a string already then just use AEX. In AEX, Index is the first character you want (counting left to right), and Number is how many characters after the index you want. The RSLogix 500 instruction set help has some good detail on these instructions.
 
I replied before I read your entire post... sorry about that. There is an instruction called ASC, string search. If your data is in string format, you can set up an ST file, such as ST9, and have for example ST9:1 be the dash character. Then use the ASC instruction to return the position of the dash in the string. Then you can calculate the start position used in the AEX instruction.
 
yobnoj said:
I replied before I read your entire post... sorry about that. There is an instruction called ASC, string search. If your data is in string format, you can set up an ST file, such as ST9, and have for example ST9:1 be the dash character. Then use the ASC instruction to return the position of the dash in the string. Then you can calculate the start position used in the AEX instruction.

No problem will try tomorrow, but I think I already tried it today but the result actually gave me a 0 instead of the actual position. The total barcode is spread across N12:1 to N12:10 and when viewing in HEX I've got the following
N12:1 = 3035
N12:2 = 3130
N12:3 = 3031
N12:4 = 4142
N12:5 = 3032
N12:6 = 2020
N12:7 = 2D31
N12:8 = 3039
N12:9 = 3836
N12:10 = 300D

Also just out of curiosity is there an instruction to separate the 2 characters from the 1 word in N12:10 as I would like to strip the 0D (carrage return)
 
Each Integer contains Two characters seperate it search for 55dec(2Dhex) in seperated location for "-" find it & manupulate
 
rPraveenkum said:
Each Integer contains Two characters seperate it search for 55dec(2Dhex) in seperated location for "-" find it & manupulate

It's late and I'm not thinking straight!!! What do you mean? also the decimal 55 to me as I see it is the character "7" not a dash (-). Looking it up in my xreference chart 55 octal is a dash. Besides all of that, I still don't really understand what you mean in you statement above!
 
Doesn't this table that you refer to also indicate that 55dec = chr 7 and that 45dec = chr - ... or is it just me?????
Decimal Octal Hex Binary Value
------- ----- --- ------ -----

045(Dec) - 055(Oct) - 02D(Hex) - 00101101(Bin) = -(minus or dash)

and that

055(Dec) - 067(Oct) - 037(Hex) - 00110111(Bin) = 7
 
Hello guys,

You are both right, but in a different radix:

ASCII_dash2.jpg



Hope this helps,
Daniel Chartier
 
Yes daniel your right... but I can't help it if Rpraveenkum doesn't know that there is a major difference if a value is specified in octal or decimal.

45 in DECIMAL = MINUS SYMBOL & 55 in OCTAL = MINUS SYMBOL, but 55 in DECIMAL DOES NO WAY = MINUS SYMBOL!

I can't put it simpler than that Rpraveenkum, but PLEASE can we get off this bandwagon and concentrate on the real issue... what do I do to manipulate it and does anybody have a sample *.RSS file I could look at that could possibly work.
 
Copy the INTegers into a string file and use the ASC and AEX commands to find and extract just what you want...I don't have RSLogix on this machine yet, so I can't post an example...As you've seen, it can be tricky to do it with integers since you dont know which nybble the "-" symbol will end up in. Use the ST file to overcome this issue.

When creating the ST type data file, keep it small, each element takes 40 words of memory! (80 characters, one nybble each...)

And the COPy instruction length should be set to the desired length of the destination file type...

Hope this helps,
Paul
 
Last edited:
Ok have copied it into an ST format and it appears that I now have the barcode but for some reason it doesn't have in it the first 2 characters... any clues?
 

Similar Topics

I have some equipment with Allen Bradley SLC 504 PLC's, that have a Prosoft MVI46 ethernet module installed. I would like to configure it to talk...
Replies
1
Views
3,157
I’m attempting to send a temperature from a SLC-5/02 to an EZiMarquee display. The vendor said to use a MSG instruction to send the data to the...
Replies
1
Views
95
Hello all. I have a few SLCs in my plant and of late we've seen a weird issue: The system will be running normally and then randomly the outputs...
Replies
2
Views
104
I am working on setting up a Prosoft Datalogger model PLX51-DLplus-232. This unit will be collecting data from a SLC 5/05 on the DB9 port set to...
Replies
3
Views
111
I have a redundant ControlLogix being set up. This program reads a value from a remote site which happens to be SLC PLC. Rockwell mentions SLC...
Replies
2
Views
104
Back
Top Bottom