C
cjf1009
Unregistered / Unconfirmed
GUEST, unregistred user!
一个串口操作程序,控件用TVacomm,我把一个程序拷过来的(我记得),原来的程序能用,我的为什么不能用?
原程序:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, VaClasses, VaComm, StdCtrls, WinSkinData,mmSystem;
type
TForm1 = class(TForm)
VaComm1: TVaComm;
Edit1: TEdit;
Edit4: TEdit;
SkinData1: TSkinData;
Label1: TLabel;
Label2: TLabel;
procedure VaComm1RxChar(Sender: TObject; Count: Integer);
procedure Edit1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
Procedure Decoder(carInfo: String);
end;
var
Form1: TForm1;
CARInfo : string ;
implementation
uses unit2;
{$R *.dfm}//程序头
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);//读串口过程
var
I: Integer;
Tmp : String;
begin
Tmp := VaComm1.ReadText;
for I := 1 to Length(Tmp) do
case Tmp of
#10:;
#13:
begin
edit1.Text := CARInfo;
CARInfo := '';
end;
else
CARInfo := CARInfo + Tmp;
end;
end;
我的新程序:
unit findcar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB, VaClasses, VaComm, Mask,WinSkinData,
DBCtrls, ComCtrls,mmSystem;
type
Tfrmfindcar = class(TForm)
……
VaComm1: TVaComm;
procedure VaComm1RxChar(Sender: TObject; Count: Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Procedure Decoder(carInfo: String);
end;
var
frmfindcar: Tfrmfindcar;
CARDInfo : string ;
implementation
uses unit2;
{$R *.dfm}//程序头
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);//读串口操作
var
I: Integer;
Tmp : String;
begin
Tmp := VaComm1.ReadText;//设断点在这里
for I := 1 to Length(Tmp) do
case Tmp of
#10:;
#13:
begin
edit1.Text := CARInfo;
CARInfo := '';
end;
else
CARInfo := CARInfo + Tmp;
end;
end;
断点处都运行不到!!!;(
看看谁的眼睛好使。
原程序:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, VaClasses, VaComm, StdCtrls, WinSkinData,mmSystem;
type
TForm1 = class(TForm)
VaComm1: TVaComm;
Edit1: TEdit;
Edit4: TEdit;
SkinData1: TSkinData;
Label1: TLabel;
Label2: TLabel;
procedure VaComm1RxChar(Sender: TObject; Count: Integer);
procedure Edit1Change(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
Procedure Decoder(carInfo: String);
end;
var
Form1: TForm1;
CARInfo : string ;
implementation
uses unit2;
{$R *.dfm}//程序头
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);//读串口过程
var
I: Integer;
Tmp : String;
begin
Tmp := VaComm1.ReadText;
for I := 1 to Length(Tmp) do
case Tmp of
#10:;
#13:
begin
edit1.Text := CARInfo;
CARInfo := '';
end;
else
CARInfo := CARInfo + Tmp;
end;
end;
我的新程序:
unit findcar;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB, VaClasses, VaComm, Mask,WinSkinData,
DBCtrls, ComCtrls,mmSystem;
type
Tfrmfindcar = class(TForm)
……
VaComm1: TVaComm;
procedure VaComm1RxChar(Sender: TObject; Count: Integer);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Procedure Decoder(carInfo: String);
end;
var
frmfindcar: Tfrmfindcar;
CARDInfo : string ;
implementation
uses unit2;
{$R *.dfm}//程序头
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);//读串口操作
var
I: Integer;
Tmp : String;
begin
Tmp := VaComm1.ReadText;//设断点在这里
for I := 1 to Length(Tmp) do
case Tmp of
#10:;
#13:
begin
edit1.Text := CARInfo;
CARInfo := '';
end;
else
CARInfo := CARInfo + Tmp;
end;
end;
断点处都运行不到!!!;(
看看谁的眼睛好使。