On 13-Sep-05 vittorio wrote:
>> Hoping this helps,
> 
> Thanks, it helps! But Ted,
> how do you let R know the parameters of the serial connection
> (e.g. "4800 7S1") ?
> Ciao
> Vittorio

Following up, I've now had info from people pointing out the
following.

For Windows, there's a simple DOS utility which, for a serial port,
is one the lines of

  MODE COM1:<speed>,<parity>,<databits>,<stopbuts>[,P]

where the optional "P" is to allow infinite retries to send data
to a non-responding device. This shouldn't be necessary when
passively reading data being output from external equipment.

Any of the above can be omitted (in which case the corresponding
setting is not changed) provided the requisite commas are present.
Example:

  MODE COM1:4800,E,7,1

will set 4800 baud, Even parity, 7 databits and 1 stop bit.

Thanks to Tom Mulholland for reminding me of this!

For Linux, there is the 'stty' command (which can set far more
things as well, since it is designed for terminal consoles
connected via serial lines). Something like

  stty -F /dev/ttyS0 4800 parenb -parodd cs7 -cstopb

would have the same effect as the above. See "man stty" for more
details.

So, since there is a simple command foreither Windows or Linux,
this can be sent from within an R session using the 'system'
command, which will set up the serial port. After this, 'scan'
should simply read the incoming data (as discussed earlier).

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 14-Sep-05                                       Time: 13:09:55
------------------------------ XFMail ------------------------------

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to