SerialClose(1);
fdserial = OpenSerial(1, 9600, 1 ,8, eParityNone);
SerialClose(0);
ffserial = OpenSerial(0, 115200, 1 ,8, eParityNone);
ReplaceStdio( 0, ffserial ); // stdin
ReplaceStdio( 1, fdserial ); // stdout
ReplaceStdio( 2, ffserial ); // stderr
I have the above. Is it possible to read from a port when it is not the stdio?
Thanks!
Serial Port Question
Serial Port Question
MOD54415 at http://www.phaseanglemeter.com
Re: Serial Port Question
Absolutely. I think the normal mode for any type of data port is to read/write directly. I only use stdio for debugging in release mode or status messages on a debug serial port.
Re: Serial Port Question
Yes you can read/write to any serial port that you have opened an fd to regardless of the stdio settings. I use multiple serial ports all the time.
Scott
Scott
Re: Serial Port Question
functions are read
and write
read the header file
nburn\include\iosys.h
int read(int fd ,char * buf, int maxlen);
Where fd is the fd gotten from the serial open...
reads what is availible and returns.
If no data is availible it blocks until it gets at least one charactor...
If you need timeouts..
int ReadWithTimeout( int fd, char *buf, int nbytes, unsigned long timeout );
int write(int fd, const char * buf, int len);
and write
read the header file
nburn\include\iosys.h
int read(int fd ,char * buf, int maxlen);
Where fd is the fd gotten from the serial open...
reads what is availible and returns.
If no data is availible it blocks until it gets at least one charactor...
If you need timeouts..
int ReadWithTimeout( int fd, char *buf, int nbytes, unsigned long timeout );
int write(int fd, const char * buf, int len);