|
|
using rs232
Hi,
I currently trying to play around with rs232 in GUI. the idea on what i'm trying to do is to produce a bit (like a trigger signal) every 100ms when the button was pressed. my understanding is up to receive the signal from outside. can anyone help me with any reference that i can follow? thanks
|
|
0
|
|
|
|
Reply
|
Zulkifli
|
9/20/2010 3:28:03 AM |
|
On 19/09/10 10:28 PM, Zulkifli wrote:
> I currently trying to play around with rs232 in GUI. the idea on what
> i'm trying to do is to produce a bit (like a trigger signal) every 100ms
> when the button was pressed. my understanding is up to receive the
> signal from outside. can anyone help me with any reference that i can
> follow? thanks
Although RS232 itself would be able to handle conveying a single bit,
the protocols that are layered on top of RS232 to send data are not able
to send less than (7 data bits plus one start bit plus one stop bit) = 9
bits per invocation, with 10 bits more common. In order for the
transmission time for those bits to be 100 ms = 0.1 s, your data rate
would have to be 10 baud, but the lowest data rate that can be requested
(at least on unix systems) is 50 baud.
If you are trying to send pulses, either use a parallel port or use the
RTS / DCD pin of a serial port -- though it might be a bit difficult to
control the duration of the RTS being set. If you are using a USB serial
port, accurate timing becomes more difficult still -- you basically
cannot time anything to less than 40 ms if you use a USB serial port and
the standard serial drivers.
But you really haven't been clear as to what you need to know about
receiving RS232 data, especially as you do not indicate whether it is to
be received by some kind of device or circuit, or by another Matlab
session.
|
|
0
|
|
|
|
Reply
|
Walter
|
9/20/2010 4:30:35 AM
|
|
"Walter Roberson" <roberson@hushmail.com> wrote in message
news:LrBlo.16471$Bg.14192@newsfe22.iad...
> Although RS232 itself would be able to handle conveying a single bit, the
> protocols that are layered on top of RS232 to send data are not able to
> send less than (7 data bits plus one start bit plus one stop bit) = 9 bits
> per invocation, with 10 bits more common. In order for the transmission
> time for those bits to be 100 ms = 0.1 s, your data rate would have to be
> 10 baud, but the lowest data rate that can be requested (at least on unix
> systems) is 50 baud.
>
The lower limit baudrate of 50 is a historical glitch more than a hard
limit. The original termios.h files did indeed have hard coded baudrates of
0-38.4k. http://opengroup.org/onlinepubs/007908775/xsh/termios.h.html
Serial communication passed 38.4k a long time ago.
For modern operating systems, current MATLAB Serial will try to set the
baudbase and divisor to get a baudrate of 10 (or anything else) if
requested.
|
|
0
|
|
|
|
Reply
|
Trent
|
9/20/2010 12:23:44 PM
|
|
On 10-09-20 07:23 AM, Trent Jarvi wrote:
> The lower limit baudrate of 50 is a historical glitch more than a hard
> limit. The original termios.h files did indeed have hard coded baudrates of
> 0-38.4k. http://opengroup.org/onlinepubs/007908775/xsh/termios.h.html
> Serial communication passed 38.4k a long time ago.
>
> For modern operating systems, current MATLAB Serial will try to set the
> baudbase and divisor to get a baudrate of 10 (or anything else) if
> requested.
Hmmm, I still wouldn't recommend using individual TxD bits as a trigger
signal. The "stop bit" at the end of each word may be of opposite polarity of
the "start bit", but different references describe the stop bit in different
ways. I gather (trying to sort out the inconsistencies) that the stop bit
should drive the voltage to 0, which is not in the normal range for RS232
signalling (a mark bit = logical 1 has to be in a particular negative range, a
space bit = logical 0 has to be in a particular positive range... unless you
are reading one of the documents that reverses those voltages). It's confusing
to read about.
|
|
0
|
|
|
|
Reply
|
Walter
|
9/20/2010 7:30:44 PM
|
|
|
3 Replies
358 Views
(page loaded in 0.09 seconds)
|
|
|
|
|
|
|
|
|