ASCII Characters

02js4130

Member
Join Date
Jun 2014
Location
Wales
Posts
38
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 which is received from the reader.

So I am using the AEX to extract the year month and day separately and then the ACN command to re arrange them. the format i require is

YYYY-MM-DD

so i have stored the - dashes in a string ready to concatenate to my string when required but for some reason when i run the program both of the -dashes have appended to the send of the string so it reads
YYYYMMDD--

not where i require them, does anyone know how to resolve this?

Thanks
Jen
 
I assume you are using the AEX 3 times one for the year, one for the month & one for the day, it looks like you are appending the two "--" to the whole date string, so for example you need to AEX "YYYY" i.e. position of the first char of year, 4 chars then do an ACN with "-" his gives you "YYYY-" do the same for "MM" & "DD" then concatenate the three strings.
 
Hi ,

Yes that is what i have done
First ACN
YYYY-
SECOND ACN
YYYY-MM
3rd
YYYY-MM-
4th
YYYY-MM-DD

But its appended the -- to the end still, i cant understand why.
 
What does the date look like when it comes from the bar code reader e.g is it "YYYYMMDD" or similar?

Can you post your code (PDF is best)? We can't see where it's going wrong if we cannot see your code.

This
is a recent similar thread.
 
hi,

thanks for your reply, the code is attached. Originally the date format from the label is yymmdd

the numbers are in the correct format yyyymmdd its just the dashes.


st16:29=year
st16:30=month
st16:31=day
st16:32=20
st16:33= -


thanks

CODE1.PNG CODE2.PNG CODE 3.PNG
 
Visually, the ACN (concatenation) steps looks correct, and should yield 20aa-bb-cc, if the correct strings aa, bb, and cc are in ST16:29, ST16:30, and ST16:31, respectively.

I did notice that the Index parameters passed to the first two AEX (extract) instructions do not look correct: it should be 1 (not 3) for extracting yy into ST16:29; it should be 3 (not 2) for extracting mm into ST16:30. Also the Number parameter passed to the AEX extracting mm into ST15:30 should be 2 (not 5).

Can you post a picture of the state of the strings ST16:29 through ST16:38?


Finally, the barcode reader could be writing to ST16:28 during an interrupt of the program scan; are you doing anything to deal with that?
 

Similar Topics

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
17,121
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,916
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,899
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,069
Is there a way to convert these integers (17476,16688,13110,12598) to Ascii character (DDA03616)? 17476 = 4444hex = DD on ascii chart 16688 =...
Replies
7
Views
6,756
Back
Top Bottom