I'm not sure whether this is a bug but I'm having a problem reading characters from the serial port under Windows. I'm using ECLiPSe 5.0 under Windows 98 and also under Linux (kernel version 2.2.5-22 - it's RedHat6.0). Basically, I want to be able to read characters from and write characters to the serial port. I have written the code below for this purpose (at present the lines for Linux have been commented out). I have two laptops connected via their serial ports and I wish to exchange characters between them. When I do this using Linux, I can read and write characters but when I try using the Windows version of ECLiPSe, I can write but not read characters (get just blocks in this case with nor characters received). Essentially, what I need to know is how one can read characters from the serial port under Windows? Any help that you can offer would be greatly appreciated. Thanks, Maurice. __ Maurice Pagnucco email: morri@cs.toronto.edu Cognitive Robotics Group Department of Computer Science Phone: +1-416-978-7453 D. L. Pratt Building 6 King's College Road Fax : +1-416-978-1455 University of Toronto Toronto, Ontario, CANADA, M5S 3G4. WWW: http://www.cs.toronto.edu/~morri/ getByte(Ascii) :- %% Windows - serial port settings 2400 baud, odd parity, 8 data bits, 1 stop system('mode com1: 2400 o 8 1 p'), %% Linux - serial port settings; probably overkill but it works! %system('stty -echo -icanon -iexten -isig -icrnl -inpck -istrip -ixon -cstopb cs8 parenb parodd -opost ispeed 2400 ospeed 2400 < /dev/ttyS0'), open('com1:', update, Stream), % Windows - Open serial port for reading and writing %open('/dev/ttyS0', update, Stream), % Linux - Open serial port for reading and writing get(Stream, Ascii), close(Stream), write('Received : '), write(Ascii), nl. putByte(Ascii) :- %% Windows - serial port settings system('mode com1: 2400 o 8 1 p'), %% Linux - serial port settings; probably overkill but it works! %system('stty -echo -icanon -iexten -isig -icrnl -inpck -istrip -ixon -cstopb cs8 parenb parodd -opost ispeed 2400 ospeed 2400 < /dev/ttyS0'), open('com1:', update, Stream), % Windows - Open serial port for reading and writing %open('/dev/ttyS0', update, Stream), % Linux - Open serial port for reading and writing put(Stream, Ascii), flush(Stream), close(Stream), write('Transmitted : '), write(Ascii), nl.Received on Tue Aug 01 19:17:24 2000
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:00 PM GMT GMT