不管有用没用.先多谢了.

On 1月7日, 下午1时54分, 钟声 <[email protected]> wrote:
> 以前的简单测试。。不知道对你有用没?
> win32没试过
>
> #!/usr/bin/perl5.10.0
> use strict;
> use IO::Handle;
> use DBI();
>
> #初始化串口
> system("stty -echo raw 19200 </dev/ttyS0");
>
> # Connect to the database.
> my $dbh = DBI->connect();
> #打开串口
> open my $ser,'+>','/dev/ttyS0' or die '';
>
> #------------------------------------------------------------
> print $ser chr(3);
> $ser->autoflush(1);
>
> while(1){
>    #得到串口数据
>    my $info = getinfo($ser);
>
>    #数据库操作
>    print %$info;
>    my $is = find_user($dbh,$info);
>    print $is."\n";
>    #向串口发送数据
>    print $ser chr($is);
>
> }
>
> #------------------------------------------------------------
>
> sub getinfo{
>
>  。。。。
> #读取串口数据
>      if(read($com,$c,1)){
>      。。。。
>           $c = ord($c);
>
>          。。。。
>      }
>    。。。。
>
> }
>
> #      $sth->finish();
> # Disconnect from the database.
>   $dbh->disconnect();
-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。


回复