RSLogix 500 ASCII AEX Err

vachhaninimit

Member
Join Date
Jan 2014
Location
Baroda
Posts
10
Hello Guys,

I am totally new to this forum and to PLC. I am trying to write a logic in PLC which reads ASCII line from Channel 2 and extract first 3 characters and again sends back to my program. I am attaching the pdf file which has my ladder logic.

The AEX instruction is causing the problem. I am not receiving the extracted characters back.

I am using rslogix 500 and micrologix 1400 series B with TCP/IP option.
 
Last edited:
Well sorry for that. I did uploaded but may be i did some mistake while uploading the pdf.

I have come to know that AEX will copy string to destination only if the incoming string lenght is less than index + number of characters in this instruction. I will find some time and then upload the ladder logic which is working without AEX.
 
i am closing up shop for the day, but look at your string commands in the micrologix command structure.

you will find what you need there.

i will try to get back with an answer tomorrow.
 
Sorry Fellas,

I was on holiday for such a long time. I have not used AEX command as in AEX command the string that i received was in variable length and for aex to work length of string should be less than index + count. Thanks for all your help.

I have uploaded the ladder logic of what i wanted. Please let me know if i go wrong anywhere.
 
Last edited:
I think you need to set your ARL String Length to something other than 0. It should be the number of characters that you expect to be in one line of data in the ASCII buffer. With a 0 length, you will get 0 characters from the buffer on each ARL.

One problem is that this is a chicken-and-egg situation. Which came first, the data in the ASCII buffer, or the data you wrote to the ASCII buffer in the SAME PLC SCAN?

Normally data read from the ASCII buffer has to be sent from some other device (other than the PLC). Data sent from the PLC to the ASCII buffer should be read by some other device.

For the AEX instruction, if the line in the buffer is shorter than the NUMBER length, then AEX will only read up to the first end-of-line character. This is useful where you don't know the real length (for variable-length data). Then you set Number equal to the longest expected line. Any line shorter that Number will still get extracted, including the first end-of-line character.

AEX [String Extract]
Rockwell Software
Entering Parameters

Source is the existing string. The source value is not affected by this instruction.

Index is the starting position (from 1 to 82) of the string you want to extract. (An index of 1 indicates the left-most character of the string.) This can be a word address or a decimal value.

Number is the number of characters (from 1 to 82) you want to extract, starting at the indexed position. If the index plus the number is greater than the total characters in the source string, the destination string will be the characters from the index to the end of the source string. This can be a word address or a decimal value.

Destination is the string element (ST) where you want the extracted string stored.
 
Lancie1 is correct, you are going to need to put a length of your string so that it knows what to read. Zero returns nothing and anything bigger than the string that you are receiving will make it sit until the correct number of characters shows up. I have attach a sample of a program that I have written to extract two different sets of data from a single barcode in order to set the size on a machine.

Barcode.jpg
 
Aite,

Thanks for the sample code. Got my self moving further.

Now i am stuck at the point where i receive ^M in ASCII string which is carriage return. Suppose i receive "GET^M" or "GET1^M" or "GET 1^M". In all the scenario i want to ignore ^M and get only numeric value present. Can it be done in RS Logix.
 
Suppose I receive "GET^M" or "GET1^M" or "GET 1^M". In all the scenario I want to ignore ^M and get only numeric value present. Can it be done in RS Logix?
Yes, and I can think of several ways. Here is one. If the original string length varies, but you know that it always returns with 1 end-of-line control character (say ^M), then you need to EXTRACT the part of that string with a length of (R6:0.POS - 1). Your beginning logic should look something like this: (See attached picture).

RSLogix ASXII AEX Error- vachhaninimit.jpg
 
Last edited:
Hi Lancie,

Now i am stuck with AIC instruction. What i am doing is that i am sending "GET 1" command at channle 2 in Micrologix 1400. The ladder detects the command and extracts 1 and stores to N7:4. Then i move N7:4 to MSG i.e. Modbus RTU message to read holding register from device id 1. I am getting the data value of 28 back and storing it in N7:5. Now i want to convert value in N7:5 to string and use AWA command to send me back the value.

The AIC command does the work second time when i send the command.

Note: String commands are passed on Channel 2 and MODBUS RTU commands on channel 0.
 
The AIC command does the work second time when i send the command.
If it works one time, but not the second time, then I would check the method of coordinating the various Sends and Receives. You may have it so that you are trying to use the AIC before the data is available to be converted. In your previous version, you were trying to use the R6:0/DN bit of the first ARL to control 3 following AWL instructions. I don't think that will work, because I beleve that you need to use sequenctial DN bits to prevent the logic from outrunning the physical stepping of each instruction. The RSLogix HELP instructions plainly state that ARLs and AWL may take "more than one PLC scan to complete". Therefore you must allow each Read or Write all the time it needs to complete, BEFORE you allow the next one to be activdated.

Post a copy of your current program for better help.

Note: String commands are passed on Channel 2 and MODBUS RTU commands on channel 0.
You need to read the instructions for the AWA command. It clearly states that it uses User Channel 0. If Modbus is also using User Channel 0, then you will have to use some type of "handshaking" between the two protocols to avoid overlap between your Reads and Writes. Also you must select which TWO control characters that you want appended to the end of each string to be written.

RSLogix AWA Instruction.JPG
 
Last edited:
Hi Lancie1,

I have uploaded 2 pdf for Lad 2 and Lad 3. My program starts in Lad 2 and if it gets "GET 1" or "GET 2" then its jumps to Lad 3. I know my programming is not that good as i am new to RSLogix and PLCs. I face problem at Rung 7 in LAD 3. First time i do get the data but AIC is not storing integer from N7:5 to ST9:5. Second time it stores the data but of the previous execution. So if i do "GET 1" i get device 1 data through modbus rtu cmd on channel 0 and when again i do "Get 1" its gives me back data of previous command through channel 2.

According to my knowledge AWA is not restricted to Channel 0 as i am using Micrologix 1400, but it is restricted in 1200 and 1500. It still works on Channel 2 the second time.

Appreciate for help.
 
Second time it stores the data but of the previous execution.
Yes, that is because Read and Write commands usually require MORE THAN 1 PLC SCAN to finish. If you do not use the Write Done command to wait until it is finished writing, BEFORE doing something else, then your Write command will always be 1 step "behind".
 

Similar Topics

Hi Guys! Does anyone know which version of RSLogix 500 i can insert ASCII DataFile? I'm using 10.0 version and i not found this DataFile, but...
Replies
1
Views
1,448
My Question: Is there an easier way? I need to print (as in ASCII onto a printer) a few (15) floating point numbers in context (some words go...
Replies
3
Views
3,685
Ascii Communication to a 2D Matrix reader. Is there anyway to read variable length string. The ARD and ARL instructions require u enter a...
Replies
2
Views
3,793
Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
81
I have a little bit of experience with Allen-Bradley. I have a Micrologix 1500 (RSLogix 500) and a PanelView Plus 7 (FactoryTalk View Studio ME)...
Replies
3
Views
161
Back
Top Bottom