Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does anyone have experience with an A/B 1746-BAS (BASIC) module ? 1

Status
Not open for further replies.

beetlebaily

Mechanical
Aug 27, 2005
2
I am trying to make a Allen/Bradley 1746-BAS (BASIC) module pull data from a SLC-5/05 and send it out the serial port to a Zebra Stripe 600 printer. I have it working fine right now but all I can get to print out is my first line of 8 characters. I need three lines of 8 characters. This means 3 variables need to be copied from ST23:17, ST23:23 and ST23:32 (string) files into M0:2.0, M0:2.10 and M0:2.20 memory files.
(Question #1)Do I do these copies all at once or one at a time ?
(Question #2) How do I pull the data into the BASIC module and assign it to a variable for printing ?
(Question #3) Do I do all these assignments at once or one at a time also ?
Any help or refrences would be greatly appreciated. Thanks.
 
Replies continue below

Recommended for you

I have programmed that module and used it to send data to part marker. I was fortunate in that I didn't need to use M Files.

In my application I set up a word to call the correct subroutines based on the PLC program.

Where are the data strings being created, the PLC or BASIC module?

Values are assigned to strings $(1), $(2) etc. In my application I assigned data to different variables, the part number was one, julian date another etc.

The manual shows what calls you will need to use to exchange data (page 4-15) in my copy. Call 23 transfers data to the PRT1 port. There may be prepartory steps you have to take pior to executing a call.

If you want to manipulate the strings it might be better to perform all string functions in BASIC, then its just a matter of PRINT to get the data out.

I am working from my hotel room right now and don't have access to my network drives, otherwise I could be more specific, but you will find all the information you need in the programming manual.

I hope this helps.


 
What I am trying to do is print out a label that contains three lines of data. Each row has a fixed length number of characters: Line 1 = 4 characters, Line 2 = 8 characters, Line 3 = 8 characters. The SLC-5/05 is generating the combination of fixed length but changing characters. They are stored in ST23:17, ST23:23 and ST23:24. I am currently trying to use the ladder logic to copy the data to the M0 files and a call 23 to assign the variable, call 53 to copy the data and a call 14 as the trigger to extract the information from the M0 files into 3 variables within the basic module. This proves to be near impossible. I would like to hear more about not using the M0 files at all but don't understand as much about this as I would like to. How does the data get from the ST files into the basic module ? This sounds promising. Thank you.
 
OK here goes.

I use the following code to get a word from the PLC that directs the BASIC module what to do. The downside to using the I/O imagae is you are limited to 8 words, that was another reason to use the BASIC module for most string set up, especially static strings.

{$L GetCommand}
CALL 53
POP STAT
PUSH 207
CALL 14
POP FLAGS
IF FLAGS.AND.1 THEN GOSUB DoDataMatrix
IF FLAGS.AND.2 THEN GOSUB SetPort
IF FLAGS.AND.4 THEN GOSUB ResetPort
IF FLAGS.AND.64 THEN GOSUB ResetModel
IF FLAGS.AND.8192 THEN GOSUB ReadModel
IF FLAGS.AND.16384 THEN END
GOTO GetCommand

The call 53 is required to get PLC stat, I don't do anything with it my program so I don't know what values would be returned.

POP STAT is just to store the value I received from the CALL 53.

PUSH 207
CALL 14
POP FLAGS

Push 207 is the word of data I want, the values are from 200 to 207.
CALL 14 transfers the data into the BASIC module stack
POP FLAGS stores them in my variable.

In my case the module is installed in slot 6 so when I want the PLC to set a flag the address is O:6.7/bit. When I want to write the data matrix to the scribe I turn on o:6.7/0.

IF FLAGS.AND.1 THEN GOSUB DoDataMatrix

Masks FLAGS and calls the DoDataMatrix subroutine if bit 00.

To set bits in the input image the following code is used.

{$L SetHandShake}
PLCIN = 1
PUSH PLCIN
PUSH 207
CALL 25
CALL 54
POP STAT
RETURN

PLCIN is set to one to set I:6.7/00.
PUSH PLCIN pushes the value to the stack
CALL 25 converts the value to binary
CALL 54 transfers it to the PLC input image
POP STAT is required to get the status of the transfer, again I don't use it but we also have to keep the stack clear.

IF FLAGS.AND.16384 THEN END allows me to stop the BASIC program if I need to.

Two things I neglected to mention is that I am using the PBASE translator, its cool because it makes the code more readable and eliminates the need for line numbers. The othe is that Hyperterminal is MUCH, MUCH, MUCH more stable to do downloads.

Let me know if I can be of further help.



 
You have more data to transfer than the I/O image can handle at once, you may need to transfer the data from ST to M files using ladder logic.

This will enable you to minimize the BASIC program, you may only need to set the port parameters uning the MODE command.

I will help as much as I can, I travel a lot but can usually get to the Internet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor