AB Ascii programming

john pettus

Guest
J
Hope someone who has done this will help! Thanks in advance.
I need to program a Micrologix 1500 LRP to talk to a Minerak servo using ascii. Example, I need to send the following code. @16 11 19 1 [cr] @16 11 25 -2000[cr] @16 11 26 -4000[cr] etc. I know that 16 is the device, 11 is "write to", 19 is the register and 1 is the information. How do I put this code in the PLC so that after the first string the plc knows to send the second string? Is all the code set up and then one awt command executed or does eack string have to be sent seperatly?
Hope I put enough info here to make sense. Again thanks to anyone who can give me push in the right direction.
John P.
 
AB ASCII programming

The AWT command sends the entire contents of a string file which you designate (e.g. ST10:1) What you may need to do is to send one string and see if you can get an acknowledge signal back to trigger the transmission of the second and subsequent strings. I have just completed an ASCII transmission project with Micro 1500's and there is no difference between them and the standard SLC's.
 
If you use the AWT, you will want to send the <CR>, which is 13 decimal, 0D hex. That can be tough to get into an ST-file, since you can't type it in. (There is a trick for typing it, but I don't remember it. It's not the ALT+number trick that I use for my signature (©¿©¬)).

One way is to enter the string into N-file registers (two characters per word), changing to ASCII radix to enter the numbers and letters, and Hex/BCD radix to enter the low-ASCII numbers (like the <CR>). Remember that space <SP> is 32 decimal, 20 hex, not 00.

Once it's in the N file correctly, You need to enter the length of the string into the word preceeding the ASCII. So if your 13 character string starts in N10:1 (="@1"), then you would MOVe 13 to N10:0. The instruction COP #N10:0 #ST11:0 with a length equal to the number of N files you are copying (8) will load the string.

Another way to send the <CR> is to use the AWA command, which uses the termination characters in the Channel 0 - User configuration.
 
Controlsguy3
Thanks!!
I will be using more than 82 charcters. Do I use another awt for the second 82 and so on. I am using r6:1 as control for the first 82 so if I use another awt it would use r6:2 for the second 82 charcters, correct? Also for each awt do I use a ard for the acknowledgement from the remote device.
Johnp
 
AB ASCII programming

Allen - there is no ASCII data type available in the Micro processor.

Yes, you need to send each string of up to 82 characters separately. What I usually do is to designate one word in the string file as the transmission string. Then use logic to COP other strings into that one. The same or similar logic can also trigger subsequent transmissions. If your equipment does send an ACK or other character you will need to use an ARD to get it into a string that you can analyze for whether or not your transmission was received. HTH
 
controlsguy3
Hope you didn't get my partial message that I just lost.
Can you send me an example of your last explanation as I don't understand the word used as transmission string. I think you are on the right track as I want to use this to write data for pattern positions for the servo. So what I will be changing is the register and data of that register for each position of each pattern and will be able to setup multiple patterns. I was hoping to store each pattern data in the 1500 and copy whatever pattern needed to the servo. Its funny how after many years of programming you come across something you have never done and get stumped.
When I first started programming 20 some years ago I worked with an older guy. I told him "You know alot of things" He replied "There are alot of other things I don't know". I know what he meant now.
Thanks for your time.
Johnp
 
You can type in a [CR] character in a STRING element by typing " ^M ". Watch the character count; you'll see that it only increments by one. Allen's right on that it's just as easy to use AWA (ASCII Write with Append) and use the pre-configured termination character.

This is kind of a nifty proposition; there's a place in this application for the ACI instruction, too, to convert integer numbers into strings, and the ACN instruction to glue strings together.

I'm in a meeting at this hour and I'm taking breaks to consider this application... it's more fun than financial result spreadsheets !

John: help us parse out that command string; which number means what ? Are there spaces (ASCII 20) between them ? Maybe a link to the Minarik command set would help if you have one.
 
(duh, John did parse the command string, I just wasn't reading closely.)

This turns out to be pretty straightforward; I was able to send all three servo configuration strings with just twelve rungs.

I set up three base Strings that include the non-changing parts of each Write command for the servo:

ST12:0 "@16 11 19 "
ST12:1 "@16 11 25 "
ST12:3 "@16 11 26 "

The logic converts an integer into a string, then joins it to the base string, then sends the sum string out the serial port.

Here's the three-rung sequence I used to send each string:

[attachment]

This resulted in "@16 11 19 1<CR>" being sent out from the Channel 1 serial port. I chained the R6:0.DN bit with a trigger for the next three ASCII instructions, and repeated the logic one more time, so the net output from the serial port is:

@16 11 19 1
@16 11 25 -2000
@16 11 26 -4000

Of course it gets a little more complex if you have to wait for an acknowledgement reply.

threadid2088.jpg
 
Last edited:
I appreciate you guys responding and the example that you sent Ken. I don't have much fun with spreadsheets either. I will give this a try, if I end up scratching my bald spot to much....well I will ask again. Best regards to all of you, hopefully I can help someone soon.
Johnp
 

Similar Topics

Hello everybody. I am currently trying to send ZPL commands to a Zebra zt410 from a compactlogix L30ER with v30 studio 5000. I am connected to the...
Replies
0
Views
1,113
I am trying to build an inventory management system that receives part numbers(Format, 123-45:67) from a bar code scanner and uses Allen...
Replies
1
Views
1,495
HI, i am having trouble trying to differentiate between 2 strings using just integers, so i need to do a string compare and use the letters to...
Replies
4
Views
3,058
Hi all- first timer here. I am a process control tech assigned a new to me task. Since i am not a true programmer am having trouble with the...
Replies
1
Views
2,127
Hi Dears, we are using Micro logix 1400 with modbus RS485. Now according to modbus we read 40001 Holding address in plc form a indicator. which is...
Replies
0
Views
2,209
Back
Top Bottom