标题:Linux下和串口通訊的問題
作者:omegas
日期:2009-09-09 14:42
内容:
各位好,
我在Linux利用Qextserialport class和串口進行通訊,Windows 下是成功的,但一轉到Linux 就出問题.....
Windows ==> COM1, COM2
Linux =====> /dev/ttyS0, /dev/ttyS1...
但我把Portname 換了 /dev/ttyS0 或 /dev/ttyS1 後,我的程序告訴我串口已打开,之後我用16位(Hex value) 發送但串口接收不到,請問
1. 是不是在Linux下需要Setup甚麼?
2. 打开串口代碼如下:
comm = new Qextserialport();
comm->setportname("/dev/ttyS0");
comm->open(Qextserialport::ReadWrite);
以上有問題嗎?
#1 [yj_yulin 09-09 16:47]
是不是使用sf.net上面的Qextserialport,在linux下它不支持事件触发,用read应该是可以的,只是有比较长时间没更新了。
有人另外做了个给自己用的,在http://makecontroller.googlecode.com/中。
svn 地址:http://makecontroller.googlecode.com/svn/shared/qextserialport
只在win上用过,还没在linux下用过,不过可以试试,反正就几个文件。
#2 [dbzhang800 09-09 18:03]
http://code.google.com/p/qextserialport/