Help with ASCII code reading in RSL5000

neilgehrke

Member
Join Date
Sep 2010
Location
napa, Ca.
Posts
26
I'm reading barcode info from a keyence reader. I have all the barcode info in my program, I can view it in decimal or ASCII and it is correct. Now I'm trying to display the read barcode on a PV+ 600. I tried COP from DINT to STRING and some of the data is there but some digits are missing from the beginning of the code. Example.

code is 10188985000301

But in my first string I only see 8985000301
The 1018 is not there. I'll attach a photo.

What am i doing incorrectly?🔨

Barcode.jpg
 
I don't know anything about this but my first thought is that the STRING isn't built up like the other variables. The first two bytes are information containing max length and current length. I haven't worked with string so much but this is a guess.
 
Last edited:
I agree; the data has to be copied into the SINT[x] character array starting at StringName.Data[0], and the length of the string needs to be set in the DINT element StringName.LEN.

Because you are displaying this on a PV+ it becomes a little trickier; the PV+ is notorious for not reading changing Length values correctly, and I know that's been patched in some firmware revisions but I haven't tracked which ones.

My general approach when displaying strings on the PV+ is to use a fixed Length if I can, and make sure that any unused characters are filled with null (hex 0x00, not ASCII Space) values.
 
Thanks jstolaruk. That was it. Now I am displaying the characters correctly but there's an extra digit at the end (a musical note symbol?) What do i need to do to not display that character? Do I need to extract?
 
In your string display, the string ends with a character shown as " $r ".

In RSLogix shorthand, that's a carriage return character.

It's hexadecimal 0x0D, or decimal 13, and in ASCII it's expressed as an 1/8 note symbol.

While the simple things to remove it from your string is to subtract one from the Length, as I mentioned the PanelView Plus is notorious for not updating the Length of the string it's displaying when the .LEN element of the data it's reading changes.

So you might have to remove it from the string before it gets to the particular String Tag that the PV+ is reading.
 
I think the best approach is to use the FIND and DELETE instructions.

FIND will let you determine exactly where the carriage return character is in the string, and DELETE will delete just that one character.

Those instructions can be applied to a string of any length. You can even apply the DELETE with the Source and Destination as the same tag.

Here's a screenshot example:

Remove_CR_at_end.jpg
 

Similar Topics

hi, i try to capture barcode data using UDT with SINT ascii array. i have all the data i need but it in array format, how can i convert to 1...
Replies
5
Views
3,043
I have a Horner PLC that is reading Ascii string from a device. When the device responds, it responds with the hex value in Ascii. I need to...
Replies
8
Views
2,368
I am very new to programming PLCs, and one of the first tasks I received was to create a program that creates a socket connection between my PLC...
Replies
5
Views
2,527
Hello Everyone, I am looking for some help on this dreaded 1769-Ascii module. I have been doing a lot of digging on this module in the forum...
Replies
2
Views
2,409
All, I have a 1769-L24ER-QBFC1B processor with a 1769-ASCII card that I am trying to get working on the bench. I have a standard serial cable...
Replies
3
Views
2,001
Back
Top Bottom