Q
QiangXue
Unregistered / Unconfirmed
GUEST, unregistred user!
ÎÒÔÚdelphi5ÀïÃæÓÃ
component , import activex control
Ñ&iexcl
mscomm control ver6.0
È»ºóinstall
ÔÚ³ÌÐòÖÐÊÔÓÃMsComm¿Ø¼&thorn
name MscommTemp
procedure TFormTemperature.BtnOpenClick(Sender: TObject);
begin
If MsCommTemp.PortOpen = True Then Exit;
// Use COM1
MsCommTemp.CommPort := 1;
// 9600 baud, no parity, 8 data, and 2 stop bit.
MsCommTemp.Settings := '9600,N,8,2'
// read entire buffer when Input is used.
MsCommTemp.InputLen := 0;
MsCommTemp.PortOpen := True;
//Send command 'R0' , Õâ¸öÃüÁîÊÇÎÒµÄζȱíµÄÃüÁî
´®ÐпÚËͳöÕâ¸öÃüÁî¶Áȡζȣ¬
MscommTemutPut:='R0';
ÔÚÕâÀïÉè¶Ïµãµ÷ÊÔ£&not
Ö´ÐÐÕâÒ»¾äÒԺ󣬿´outputµÄÁ¿
²»ÊÇR0£&not
³ö´íÁË£&not
ûÓÐoutput
ÇëÎÊÎÊÌâÔÚÄÄÀ
end
component , import activex control
Ñ&iexcl
mscomm control ver6.0
È»ºóinstall
ÔÚ³ÌÐòÖÐÊÔÓÃMsComm¿Ø¼&thorn
name MscommTemp
procedure TFormTemperature.BtnOpenClick(Sender: TObject);
begin
If MsCommTemp.PortOpen = True Then Exit;
// Use COM1
MsCommTemp.CommPort := 1;
// 9600 baud, no parity, 8 data, and 2 stop bit.
MsCommTemp.Settings := '9600,N,8,2'
// read entire buffer when Input is used.
MsCommTemp.InputLen := 0;
MsCommTemp.PortOpen := True;
//Send command 'R0' , Õâ¸öÃüÁîÊÇÎÒµÄζȱíµÄÃüÁî
´®ÐпÚËͳöÕâ¸öÃüÁî¶Áȡζȣ¬
MscommTemutPut:='R0';
ÔÚÕâÀïÉè¶Ïµãµ÷ÊÔ£&not
Ö´ÐÐÕâÒ»¾äÒԺ󣬿´outputµÄÁ¿
²»ÊÇR0£&not
³ö´íÁË£&not
ûÓÐoutput
ÇëÎÊÎÊÌâÔÚÄÄÀ
end