help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sending/receiving through serial port


From: xetum
Subject: sending/receiving through serial port
Date: Mon, 30 Jan 2012 12:25:28 -0800 (PST)

I've an unidirectional null-model DB-9 serial cable (no flow-control):

TxD pin 3 ----------------->-------------
                                                \
                                                 \
                                                 
----------------------->----------------- pin 2 RxD
GND pin 5
---------------------------------------------------------------------------
pin 5 GND

and I'm testing it with the following scripts:

1.- shell scripts:

emitter: echo "hello world" >/dev/ttyS0                         receiver:
read l </dev/ttyS0; echo &quot;$l&quot;

works well: got &quot;hello world at the receiving computer terminal

2.- replace sending bash script only by following octave script:

emitter: octave -q --eval 's=fopen(&quot;/dev/ttyS0&quot;, &quot;w&quot;);
fprintf(s,&quot;hello world\n&quot;);'

works well also

3.- now replace receiving bash script by following octave script:

receiver: octave -q --eval 's=fopen(&quot;/dev/ttyS0&quot;);
fprintf(&quot;%s&quot;,fgets(s));'

nothing received at all. Why?

stty -F /dev/ttyS0 -a settings (receiver):

speed 9600 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef>;
eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt =
^R;
werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon
-ixoff
-iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

stty -F /dev/ttyS0 -a settings (emitter): same but icrnl instead of -icrnl

Any ideas? Thanks


--
View this message in context: 
http://octave.1599824.n4.nabble.com/sending-receiving-through-serial-port-tp4342441p4342441.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]