Re: Help speed up RS-232 communications!
- From: "Trent Jarvi" <tjarvi@xxxxxxxxxxxxx>
- Date: Mon, 2 Feb 2009 12:10:13 -0500
"John McMurdy" <john.mcmurdy@xxxxxxxxx> wrote in message
news:gm777t$ij3$1@xxxxxxxxxxxxxxxxxxxxx
I am struggling to get my data transfer rate where i need it for a RS-232
communication to a custom PCB. When i communicate with the device using
hyperterminal, it is almost instantaneously, indicating it is not the
RS-232 speed or processor speed. Simply, i send an RS-232 command, and then
tell the system to read what comes back with the fread command. It is just
a stream of characters that correspond to hex values on an image sensor.
fwrite(serobjw, uint8([ 'S', 13]),'uint8');
S = char(fread(serobjw))';
I set the connection settings such that the input buffer is not
significantly more than the amount of data i expect to receive, so i
wouldn't think that would be the cause of the delay
serobjw.Baudrate = 115200; % Set the baud rate at the specific value
set(serobjw, 'Parity', 'none') ; % Set parity as none
set(serobjw, 'Databits', 8) ; % set the number of data bits
set(serobjw, 'StopBits', 1) ; % set number of stop bits as 1
set(serobjw, 'Terminator', 'CR/LF') ; % set the terminator value to
newline
set(serobjw, 'InputBufferSize', 3500) ; % Buffer for read operation,
set(serobjw, 'OutputBufferSize', 512) ;% Buffer for write operation,
get(serobjw) ;
fopen(serobjw) ;
get(serobjw, 'Status') % Gets the status of connection if 'open'
connection was established
get(serobjw, 'InputBufferSize')
Any suggestions on how to speed this guy up and how troubleshoot where the
delay is coming from would be extremely helpful.
Hi John,
If you know the size of the response, specifying the size of the read may
speed up your serial/FREAD call.
S = char(fread(serobjw, serobjw.BytesAvailable))'; % This presumes all
bytes have been sent by the external device.
.
- References:
- Help speed up RS-232 communications!
- From: John McMurdy
- Help speed up RS-232 communications!
- Prev by Date: transparent bars in bar chart
- Next by Date: Matrix multiplication and inverse in a mex-file
- Previous by thread: Help speed up RS-232 communications!
- Next by thread: Normalizing vectors
- Index(es):
Relevant Pages
|
Loading