|
DELPHI开发并口的一个说明文件
点击此处下载 ourdev_425830.doc(文件大小:56K) (原文件名:DELPHI并口控制技术.doc)
并口操作DLL的DELPHI操作接口文件todayinfolpt.pas
unit todayinfolpt;
{ Interface routine for todayinfolpt.DLL }
//2008.11.5 todayinfo 完成
interface
function GetLptData(): integer;stdcall; StdCall;
function GetLptStastus(): integer;stdcall; StdCall;
function GiveLptControl(data:integer): Boolean;stdcall; StdCall;
function GiveLptData(data:integer): Boolean;stdcall; StdCall;
function InitLpt(): Boolean;stdcall; StdCall;
function SetHighPin(data:integer): Boolean;stdcall; StdCall;
function SetLowPin(data:integer): Boolean;stdcall; StdCall;
implementation
//并口初始化,针对LPT1
Function InitLpt; external 'todayinfolpt.DLL' name 'InitLpt';
//获得LPT1数据口数据
Function GetLptData; external 'todayinfolpt.DLL' name 'GetLptData';
//获得LPT1状态口数据,注意仅S3、S4、S5、S6、S7有效
Function GetLptStastus; external 'todayinfolpt.DLL' name 'GetLptStastus';
//批量设置LPT1控制口数据,注意仅C0、C1、C2、C3有效
Function GiveLptControl; external 'todayinfolpt.DLL' name 'GiveLptControl';
//批量设置LPT1数据口数据
Function GiveLptData; external 'todayinfolpt.DLL' name 'GiveLptData';
//单独设置LPT1具有输出特性的管脚为高电平,含数据口和控制口可用管脚
Function SetHighPin; external 'todayinfolpt.DLL' name 'SetHighPin';
//单独设置LPT1具有输出特性的管脚为低电平,含数据口和控制口可用管脚
Function SetLowPin; external 'todayinfolpt.DLL' name 'SetLowPin';
end.
并口操作DLL及DELPHI操作接口文件ourdev_425823.rar(文件大小:161K) (原文件名:并口测控.rar)
DELPHI调用的例子:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls,todayinfolpt;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
I:integer;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if i>15 then i:=0;
label1.Caption:=inttostr(i);
case i of
0:givelptdata(63);
1:givelptdata(6);
2:givelptdata(91);
3:givelptdata(79);
4:givelptdata(102);
5:givelptdata(109);
6:givelptdata(125);
7:givelptdata(7);
8:givelptdata(127);
9:givelptdata(111);
10:givelptdata(119);
11:givelptdata(124);
12:givelptdata(57);
13:givelptdata(94);
14:givelptdata(121);
15:givelptdata(113);
end;
i:=i+1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
i:=0;
InitLpt;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.Enabled:=true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.Enabled:=false;
end;
end.
利用DELPHI开发的一个并口驱动数码管循环显示的例子ourdev_425824.rar(文件大小:327K) (原文件名:并口驱动数码管循环显示.rar) |
阿莫论坛20周年了!感谢大家的支持与爱护!!
月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!
|