Description:
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
To Search:
- [Dog] - This is a PC-issued instructions through
- [STC12] - serial signal interface,can send signal
File list (Check if you may need any files):
000280kc.7n
000282hs.7n
000282hs.7n1
000282mg.7n
000282mg.7n1
1137-1581.0723
1137-2404.0723
1137-485.0723
1138-2162.0723
1138-473.0723
1138-473.07231
1138-797.0723
1163-2758.0723
1163-2759.0723
1164-2760.0723
1164-2779.0723
1165-2170.0723
1165-2170.07231
1165-440.0723
1166-2276.0723
1166-2276.07231
1166-2638.0723
1485-2512.0723
1485-972.0723
1485-972.07231
1486-2474.0723
1486-2487.0723
1486-2487.07231
1551-1135.0723
1552-641.0723
1591-1734.0723
1591-2469.07232
1591-2469.07233
1591-913.0723
1592-1159.0723
1592-1248.0723
1592-1248.07231
1592-459.0723
1675-1195.0723
1675-1195.07231
1675-1474.0723
1675-2446.0723
1675-2888.0723
1675-523.0723
1676-1734.0723
1676-687.0723
1676-886.0723
1676-886.07231
1676-913.0723
1676-923.0723
1676-949.0723
1725-1370.0723