|
|||
|
Hello Friends,
It says much the same as Mark's post but page 8 of the following paper covers reading from RS-232 ports. http://www.nesug.org/html/Proceeding.../at/at1005.pdf - Michael "Mad Doggy" Davis Ambler, PA michael@bassettconsulting.com > > From: "Terjeson, Mark (IM&R)" <Mterjeson@RUSSELL.COM> > Date: 2005/06/03 Fri PM 12:06:08 EDT > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Writing ASCII for r-232 output into induction machine?? > > Hi, > > It couldn't help but catch my eye, the word 'need' > as in: "First, you need to download and install the > Java Comm Api". I'm sure Dag doesn't necessarily > mean you *must* use the Java, but rather in the method > of using Java that first you do need to download it > before you can use it. Dag's suggestion can be a good > one. > > What caught my eye was: rs-232/need/java While > Java is one way of talking to an rs-232 serial port, > lots of folks have been talking to rs-232 ports 20-30 > years before Java was even on the market. > > If on a PC platform, the stoneage port designations > still work in SAS. e.g. > > data _null_; > file 'COM1:'; > put 'hello'; > run; > data _null_; > file 'PRN:'; > put 'hello'; > run; > data _null_; > file 'LPT1:'; > put 'hello'; > run; > data _null_; > file 'AUX:'; > put 'hello'; > run; > > Unix platforms propensely carry the inherent character > or basic constitution that "a file is a file is a file". > Unix does not use tokens, as the PC, for ports or any other > hardware but path and filenames just like any other file. > e.g. to get your port name for your terminal just enter > tty at the prompt of a terminal window or crt. It will > show you the path and filename for your teletype port, or > pseudo terminal session (e.g. Exceed, etc.) such as: > /dev/tty1 > or > /dev/pts/0 > etc. > > If you enter a test at the prompt such as: > echo hello > /dev/tty1 > the greaterthan symbol is the "redirect output to" > and the /dev/tty1 is whatever your port name is, and > you will see the resulting "hello" on your terminal window > or crt. If you use SAS batch or SAS interactively you can > do the same thing. > data _null_; > file '/dev/tty1'; > put 'goodbye'; > run; > on your terminal window or crt you will see the letters > goodbye. In essence you can output characters to any port > or file on unix or PC or most any other o/s. > > Check your SAS Companion manual for your platform and you > will usually find a section on Writing or Reading Data > from the Comuunications Port or some similar topic. For > example the SAS Companion for the Microsoft Windows > Environment also shows you that there is a device-type > keyword COMMPORT that adds a few features and capabilities. > e.g. > > filename mytest commport "com1:"; > > data acquire; > input mytest lrecl=1 recfm=f unbuffered; > input i $; > /* read until you find an end-of-file. */ > if i='1A'x then stop; * ^Z ; > run; > > The COMMPORT stuff allows you to specify some options > to control timeouts and waits, etc. > > From most any operating system and/or language, talking > to external devices or machines, the sending or receiving > characers is usually pretty easy with serial or parallel > ports, the timing and handshaking takes some trial and > error if the machine is going to spit out the characters > at its own pace. Todays CPUs and port chips are usually > fast enough that this is not much of a problem as years > ago. If your machine's ability to communicate is more > robust in that it will wait for the communications to be > ready before sending or receiving then you have virtually > no worries at all, just write simple put and input code > to write or read characters. Sounds like fun! > > If you are just writing to your machine, then just put > the characters out to it. Todays machines are usually > robust enough that no handshaking needs to be worried > about at all. (of course, check your machine's documentation) > > There are several ways to tackle most problems. > That's one thing that is cool about SAS & SAS-L! > > > > Hope this is helpful. > > > Mark Terjeson > Senior Programmer Analyst, IM&R > Russell Investment Group > > > Russell > Global Leaders in Multi-Manager Investing > > > > > > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dag > Sunde > Sent: Friday, June 03, 2005 7:39 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Writing ASCII for r-232 output into induction machine?? > > > <ratedr1@aol.com> wrote in message > news:1117727545.978923.177370@g14g2000cwa.googlegr oups.com... > > I have a machine that uses induction to bond metals together. The > > machine has a remote heat station that you set the wattage, and the > > time, etc (with up and down buttons) and it will run on its own. > > However, every time I need to bond different metals, thicknesses, > > widths, etc... I need to reset the info and go through the whole > > process again. The machine, has an rs-232 port on the back of it, > > which will accept codes written in ascii that will send that pertinent > > > information to it. I would like some help (Im an ascii newbie) with > > writing these programs, so that I can store all the metals, > > thicknesses, etc in a laptop connected to this remote heat station, > > and then I can have anyone run it so long as they can read. > > > > First, you need to download and install the Java Comm Api: > http://java.sun.com/products/javacomm/ > > Second, you need to identify/understand the protocol the machine > use/require. (ie. what sequence of ascii-characters makes up a command, > how it takes the 'data', etc...). > > For example: 'SetPwr#800;' to set the wattage to 800W... > > See the SerialDemo application in the samples directory of javacomm for > an howto on simple communication. > > -- > Dag. > |
|
|
||||
|
||||
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: writing output in excel format for a data step | Mary | Newsgroup comp.soft-sys.sas | 0 | 09-16-2008 07:37 PM |
| Re: Mysterious Datastep output | Terjeson, Mark | Newsgroup comp.soft-sys.sas | 0 | 09-26-2007 02:41 PM |
| Re: Trying to Understand how the OUTPUT statement works | SAS_learner | Newsgroup comp.soft-sys.sas | 0 | 12-06-2006 09:56 PM |
| Re: NEED SAS examples on Conjoint Analysis and MDS | Wu Consulting | Newsgroup comp.soft-sys.sas | 0 | 10-23-2006 01:29 PM |
| Regular Expressions - need a little help | Charles Patridge | Newsgroup comp.soft-sys.sas | 0 | 09-27-2006 01:24 PM |