English 中文(简体)
写给从欧伦特指挥线的序列港口
原标题:Writing to the serial port from the Linux command line

视窗 我可以使用以下指挥器与一个序列港口装置通信:

mode com1: baud=9600 data=8 parity=n stop=1
copy con com1
alt+18alt+2ctrl+z

装置开始要求操作。

当我试图从一个独立网站Debian 对同一Windows机器的引述时,我迄今没有过任何uck。

这里是等效的六氯环己烷指挥(至少我认为是这样):

stty -F /dev/ttyS0 speed 9600 cs8 -cstopb -parenb
echo  x12x02  > /dev/ttyS0

没有发生。

我如何能够这样做?

最佳回答
echo  x12x02 

将不作解释,并将字面上写到指定序列港的<编码>x12x02(并附上一条新线)。 相反使用

echo -n ^R^B

which you can construct on the command line by typing CtrlVCtrlR and CtrlVCtrlB. Or it is easier to use an editor to type into a script file.

除非另有一项方案受到干扰,否则<代码>stty的指挥应当有效。 一种通用的芯片是gpsd,该编码将全球定位系统装置放在纸上。

问题回答

如果您希望使用六dec代码,请添加-e的备选办法,以便通过对应方式解释后lash越(但结果与echo >+,, + B。 http://stackoverflow.com/questions/8877269/even-to-the-serial-port-from-the-linux-command-line/8877302#8877302”

echo -en  x12x02  > /dev/ttyS0

Also make sure that /dev/ttyS0 is the port you want.

Using Screen:

<注><>>:如我所知,筛查实际上无法发送六dec。 为此,使用<代码>echo或f

我利用该员额的建议写给一个序列港口,然后利用another post读到港口,结果好坏参半。 我发现,使用筛选是一种“更快”的解决办法,因为它与该港口直接开关。 (我更容易引用,因为筛查具有真正的杂交,海事组织,并且进行一些进一步阅读,以显示其真实性。)

您可以发布这一指令,以开放一个屏幕会议,然后将任何你类型的物品送至港口,加上返回数值如下:

screen /dev/ttyS0 19200,cs8

(维持上述要求,以适应您对速度、平等、停留轨道等的需求) 我认识到“Cent”指挥线是该哨所具体要求的,但我认为它本着同样的精神。 此外,你不必每次重复和引述。

echo

http://stackoverflow.com/questions/8877269/even-to-the-serial-port- from-the-linux-command-line/8878504#8878504” droid s accreditation/a>. However, this don t work for me until I also used the cat>>tor (cat < /dev/ttyS0 我寄来了echo的指挥。

printf

我发现,还可以使用打印机的百分数:

c="x"$(printf  %x  0x12)
printf $c >> $SERIAL_COMM_PORT

再者,就印刷而言,在发出指挥之前,开始<代码>cat < dev/ttyS0。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签