ASCII characters to ST data file

jbriley

Member
Join Date
Jul 2004
Location
McAllen, TX
Posts
3
I am having a problem with getting 2 ASCII characters into a String data file. We use a 2 ASCII character part identifier. We have barcode readers that use theese characters to compare to the read barcode. I am sending the 2 characters from the PanelView to A209:0 in the PLC(SLC-5/05. That works fine. For example, the contents of A209:0 is AB. I need to get these 2 characters into ST253:31. I have tried MOV and COP and get errors. It cannot be that difficult but I cannot get anything to work.
Anybody know how to make this work?

Thanks,

Bruce Riley
 
ST data type structure

One of your problems is that your starting address is A209:0. If your starting address was A209:1, it would be much easier.

The ST data type is a 41 word element (just a timer is a 3 word element).

The first element is the length (ST253:31.LEN) So when you do a COP #A209:0 #ST253:31 1, the value that you are interested in, goes to the LEN field instead of the data area where you want it. In fact, you're not putting anything in the data area.

If you were to have an integer value of '2' in A209:0, and your 2 character ASCII in A209:1, then the instruction COP #A209:0 #ST253:31 2 would give you perfect results.

Another way, without changing the source address, would be to manipulate the individual words withing the ST element directly.

If you were to MOV 2 ST253:31.LEN followed by MOV A209:0 ST253:31.DATA[0], that would also get you what you want.

The AIC instruction that Mark suggests will only work if the A209:0 contains a number ("6") and not the ASCII representation of a number ("53")
 
Last edited:
Since it appears you only need the two characters, it can be done with a MOV instruction. The addressing is:

MOV A209:0 ST253:31.[DATA0]

where 'DATA0' specifies the first word in the string. It's been awhile but IIRC the brackets are required.

Be aware that this copies word to word only. If the existing string has an odd number of characters you'll have to massage the data a bit to get the part number info to line up in the right place in the resulting string.

You'll also need to manually set the string length with a MOV instruction.

Rube: The AIC would work if he was converting numbers. It looks as though the need is to handle alpha characters.

Hope this helps.

I believe Allan Nelson's form (DATA[0]) is the correct one.
 
Last edited:

Similar Topics

Hi, I am using a MicroLogix 1500 to collect some data from a barcode reader, the application spec requires me to change the format of the date...
Replies
6
Views
2,240
Hi All, I am new to this site and I am looking for some help, I am trying to send ASCII characters to a unit that performs a task via a...
Replies
43
Views
16,994
Hello all, Have an interesting problem today. My PLC program is building the content of a 2d matrix barcode and sending the data to a Zebra 105SL...
Replies
10
Views
11,880
Hi I am new to the forum. I have a question regarding serial communications in the Micrologix 1400. I want to print a QR code, Barcode and...
Replies
1
Views
2,884
I am new to programming in PLC, i have Allen Bradley SLC 5/03. I tried using AWT inst. with data in ST9:0 file directly but in 3 inst. getting...
Replies
4
Views
4,053
Back
Top Bottom