On Thursday 27 January 2005 14:37, Jose Thadeu Cavalcante wrote:
Hi,
How can I access serial port by programming?
Thanks Thadeu
IF in C use the fopen statement on the device ttyS0 viz: FILE *fd = fopen("/dev/ttyS0","rw"); to open for both reading and writing. ttyS0 corresponds to the first serial port, ttyS1 to the second etcetera . If you are using a third party serial hardware then the device name may change to something else e.g. a cyclades board will have device names ttyC01 and up. Lastly you must check the permissions on the device by typing : ls -l /dev/ttyS0 There are lots of other issues - see the setserial command for example and ignore any references to the deprecated devices /dev/cua? See also 'man termios' for some system calls that control serial port attributes. Oh and also look at the stty command. Look at the file /proc/tty/driver/serial to see what the kernel thinks about the serial port in question. Regards Paul -- Paul Hewlett (Linux #359543) Email:`echo az.oc.evitcaten@ttelweh | rev` Tel: +27 21 852 8812 Cel: +27 72 719 2725 Fax: +27 86 672 0563 --