Sign in to follow this  
Followers 0
Chris Elston

E-maled question: ACSII and SLC 5/03

9 posts in this topic

Mike Fraber (mike.fraber@xxxxx.com) on Wednesday, September 10, 2003 at 10:53:36 --------------------------------------------------------------------------- question: Usage comments: I want to take a ascii string from a slc503 and put it into a file location I already have the slc program working and writing to hyper terinal but how do I get it to a file location. ---------------------------------------------------------------------------

Share this post


Link to post
Share on other sites
Mike, I am not sure where your knowledge is with Ascii commands in the SLC, but I would get a null modem cable, or an Allen Bradley CP-3 cable, connect it to channel 0 on the front. Then I would do an Ascii read in my ladder to read the buffer. You might have to write additional logic to clear the buffer once you have read it, to get it ready to accept another string or whatever you want to do with the buffer once you got your information. Use the ARL instruction to read characters from the buffer, up to and including the end-of-line (termination) characters, and store them in a string.   Entering Parameters Channel is the number of the RS-232 port (must be 0, except when using the MicroLogix 1500 LRP, then channel 1 may also be used.) Destination is the string element where you want the characters stored.  This direct address must be a ST filetype. Control is the address of the control block used to store data for the ARL instruction.  This direct address must be an R filetype. String Length (.LEN) is the number of characters you want to read from the buffer.  The maximum is 82 characters.  If you specify a length larger than 82, only the first 82 characters will be read.  (A 0 defaults to 82.)  This is Word 1 in the control block. Characters Read (.POS) are the number of characters that the processor moved from the buffer to the string (0-82).  This field is updated during the execution of the instruction and is display only.  This is Word 2 in the control block. Error is the hexadecimal error code that indicates why the ER bit was set in the control data file.  Refer to ASCII Error Codes for an explanation of any displayed error code.   Operation 1 The ARL rung goes from false-to-true, setting the EN (Enable) bit. 2 The instruction is put in the ASCII queue, setting the EU (Queue) bit. 3 The instruction executes and the RN (Run) bit is set. 4 The requested number of characters (including the end-of-line characters) are moved from the buffer to the destination string. 5 The number of characters moved is placed in the position field (control element Word 2). 6 The number in the Characters Read field is continuously updated, and the DN (Done) bit is set once all of the characters have been read.  If the processor finds termination characters before reading is done, the number of characters found is stored in the POS word of the control block in addition to setting the DN (Done) bit. 7 When the program scan finds the DN bit set, the processor sets the EM (Synchronous Done) bit. Execution Errors The ER (Error) bit is set during the execution of the instruction if: the instruction is aborted - serial port not in User mode the modem is disconnected (control line selection is other than NO HANDSHAKING). the instruction is aborted due to channel mode change. the UL (Unload) bit is set.  The instruction stops executing, but received characters are sent to the destination. an ACL to clear the receive buffer is executed, removing the ARL instruction from the ASCII queue. Related Topics Rockwell Software 2000

Share this post


Link to post
Share on other sites
you want to take the data FROM the SLC ... and store the data INTO a file ... correct? if so, then maybe this will help you with the main concepts of what’s involved ... this is a chunk of QBASIC code that will “listen” to the computer’s serial port and put what it “hears” into an output file ... there is nothing glamorous here ... just the basic (no pun intended) ideas of how to proceed ... major concept: you’re going to need some type of program running on your computer, which will perform the functions listed here ... and note that you might have to adjust the baud rate (example: 9600) etc. in order to establish communications ... hope this helps ... good luck ...

Share this post


Link to post
Share on other sites
Oh...is that what he meant by "FILE"? I thought he was asking like an ST file in the SLC...silly me.

Share this post


Link to post
Share on other sites
Greetings, 93lt1, QBASIC will certainly do it ... the example I gave works fine on my computer ... but I've been told that some newer operating systems won't run QBASIC anymore ... Visual Basic is the way that most people would probably go about it ... but not all versions of VB have the ability to OPEN the COM port ... I have no personal experience with C, C+, or C++, but I'd be willing to bet $1.00 that any one of those could get the job done ... basically, any programming language that can OPEN the COM port, and OPEN a file for OUTPUT, should be able to handle this ... those are the major concepts demonstrated by the little "getting started" program in my previous post ... maybe if Mike will tell us more about what he's trying to do, we can give him some more specific help ... is this a "home brew - just trying to learn" type project? ... or something for a paying customer? ... how often does the data need to be collected? ... how much data needs to be stored? ... how will the data be accessed in the future? ... is each data string always the same length? ... what programming languages are available? ... details ... details ... details ... actually, his first post (no offense intended, Mike) is ambiguous enough that chakorules interpreted it as "data INTO the SLC" ... I'm just guessing that the actual direction Mike has in mind is "data FROM the SLC" ... of course chako could be right and I could be wrong ... only time and another post will tell ... best regards to all, Ron

Share this post


Link to post
Share on other sites
Hi, If hyperterminal is already talking to the PLC i.e. receiving data why not just use the capture text utility within hyperterminal. Select the Transfer menu and then Select capture text where you can specify the name & location of a text file to hold the incoming data. Andy

Share this post


Link to post
Share on other sites
What we are trying to do is take a ASCII string that has a machine number, date and part number from the slc and to a PC on the network. And when the slc counts to curtain amount of parts the ASCII string will be sent out to the PC. This will start a printer to print two labels for those part numbers.

Share this post


Link to post
Share on other sites
What I might try is DDE? Do you have RS LINX single node or RS LINX professional? Configure a DDE topic in RS LINX, and copy and paste the data table "ST file" into an EXCEL spreadsheet. With a little bit of macro writting, you could make it increment rows and log the information and maybe even write a VBA script in EXCEL to write out to RS 232. Or you can purchase a BASIC card for the SLC and connect direct to the printer, write some BASIC code in the basic card and have a hay day.....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0