虫虫首页|资源下载|资源专辑|精品软件
登录|注册

commflg

  • procedure senddata var i:integer commflg : Boolean begin commflg:=true for i:=1

    procedure senddata var i:integer commflg : Boolean begin commflg:=true for i:=1 to 8 do begin if not fcomm comml writecommdata(sendbutter,i) then begin commflg=false break end end end (4) 接收数据 在编写基于串口的计算机工业测控时,通常需要由下位机向PC机发送数据以使PC机了解系统的测试数据或下位机的运行状态,并进而控制下位机的行为。利用Spcomm串口控件接收下位机发送的数据信息的示例代码如下: //事件驱动方式接收数据程序 procedure TForm1.CommlReceiveData(Sender:Tobject Buffer:Pointer bufferLength:Word) var receivedata:array of byte begin sleep(100) //等待100ms,保证接收到所有数据 move(buffef ,receivedata,bufferlength) //将接收缓存区中的数据转移到数组中 …… end (5) 关闭串口 在系统开发中,应注意在不使用串口时应及时关闭串口,释放系统资源,否则可能会影响系统的其它应用。关闭串口的代码如下: procedure TForm1.FormClose ( Sender TObj ect:var Action:TCIoseAction ) begin comml.StopComm end

    标签: commflg procedure senddata integer

    上传时间: 2014-01-26

    上传用户:懒龙1988