和控制口 可用管脚 Function SetHighPin; external 'chenzhenlpt.DLL' name 'SetHighPin';
// 单独设置 LPT1 具有输出特性的管脚为低电平,含数据口和控制口 可用管脚 Function SetLowPin; external 'chenzhenlpt.DLL' name 'SetLowPin'; end.
二、DELPHI 上位机代码 FormCreate 事件 begin InitLpt; end;
Timer1 事件 begin Statusbar1.Panels[0].Text:=datetimetostr(now); end;
Timer2 事件 begin
if StatusBar1.Panels[1].Text='设计者 :'+'于鹏杰'+','+'郑付根'+','+'李世 平' then StatusBar1.Panels[1].Text:='设计者 :'+'李世平' else StatusBar1.Panels[1].Text:='设计者 :'+'于鹏杰'+','+'郑付根'+','+'李 世平'; end;
向左转 begin GiveLptData(192); timer3.Enabled:=false; shape1.Brush.Color:=clwhite; shape2.Brush.Color:=clwhite; shape3.Brush.Color:=clwhite; shape4.Brush.Color:=clyellow; shape5.Brush.Color:=clwhite;
shape6.Brush.Color:=clwhite; shape7.Brush.Color:=clyellow; shape8.Brush.Color:=clwhite; label1.Caption:='向左转'
end; 向右转 begin GiveLptData(3); timer3.Enabled:=false; shape1.Brush.Color:=clwhite; shape2.Brush.Color:=clwhite; shape3.Brush.Color:=clyellow; shape4.Brush.Color:=clwhite; shape5.Brush.Color:=clwhite; shape6.Brush.Color:=clwhite; shape7.Brush.Color:=clwhite; shape8.Brush.Color:=clyellow;
label1.Caption:='向右转' end;
倒车 begin GiveLptData(12); timer3.Enabled:=false; shape1.Brush.Color:=clwhite; shape2.Brush.Color:=clwhite; shape3.Brush.Color:=clwhite; shape4.Brush.Color:=clwhite; shape5.Brush.Color:=clyellow; shape6.Brush.Color:=clyellow; shape7.Brush.Color:=clwhite; shape8.Brush.Color:=clwhite; label1.Caption:='倒车' end;
向前走 begin GiveLptData(72); timer3.Enab
led:=false; shape1.Brush.Color:=clyellow; shape2.Brush.Color:=clyellow; shape3.Brush.Color:=clwhite; shape4.Brush.Color:=clwhite; shape5.Brush.Color:=clwhite; shape6.Brush.Color:=clwhite; shape7.Brush.Color:=clwhite; shape8.Brush.Color:=clwhite; label1.Caption:='向前走' end;
紧急刹车 begin GiveLptData(255);
timer3.Enabled:=false; shape1.Brush.Color:=clred; shape2.Brush.Color:=clred; shape3.Brush.Color:=clred; shape4.Brush.Color:=clred; shape5.Brush.Color:=clred; shape6.Brush.Color:=clred; shape7.Brush.Color:=clred; shape8.Brush.Color:=clred; label1.Caption:='紧急刹车' end;
停靠 begin if GiveLptData(195) then GiveLptData(0) else GiveLptData(195);
timer3.Enabled:=true; label1.Caption:='停靠'
end;
Timer3 事件 begin if shape4.Brush.Color=clyellow
then shape4.Brush.Color:=clwhite
else shape4.Brush.Color:=clyellow; if shape7.Brush.Color=clyellow
then shape7.Brush.Color:=clwhite
else shape7.Brush.Color:=clyellow; if shape3.Brush.Color=clyellow
then shape3.Brush.Color:=clwhite
else shape3.Brush.Color:=clyellow; if shape8.Brush.Color=clyellow
then shape8.Brush.Color:=clwhite
else shape8.Brush.Color:=clyellow; shape1.Brush.Color:=clwhite;
shape2.Brush.Color:=clwhite; shape5.Brush.Color:=clwhite; shape6.Brush.Color:=clwhite; end;
end.
第四章、缺点及可能的解决方法
设计过程中遇到了不少问题,如调用窗体的方法、窗口
通信的实 现、如何实现不同方向的汽车灯显示、如何与并口显示相结合、如何 组织一些实现功能的语言、 如何更好的实现汽车灯模拟的控制等一系 列问题,通过查看参