⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys.dpr

📁 Delphi编的板卡内部程序。分享给大家
💻 DPR
字号:
program Sys;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  PCI8613 in 'PCI8613.pas';

Function getch() : Integer; Stdcall; External'MSVCRT.DLL' name'_getch';
  Function kbhit() : Integer; Stdcall; External'MSVCRT.DLL' name'_kbhit';
  Function WaitForSingleObject(hHandle: LongInt; dwMilliseconds: LongWord) : LongWord; Stdcall; External'kernel32.dll' name'WaitForSingleObject';



Var
  hDevice       : LongInt;                    // 设备对象句柄
  DeviceLgcID   : Integer = 0;                // 物理设备ID号(由板上JP1决定)
  nADChannel    : Integer = 0;
  CNTPara       : PCI8613_PARA_CNT;           // 硬件参数
	CNTVal        : LongWord = 0;
  WidthVal      : LongWord = 0;

  iChannel      : Integer = 0;




  Label ExitRead0;


begin
  { TODO -oUser -cConsole Main : Insert code here }



	hDevice := PCI8613_CreateDevice(DeviceLgcID);
	if hDevice =-1 then
  begin
    Writeln('PCI8613_CreateDevice Error...');
		getch();
		Exit;                                               // 如果创建设备对象失败,则返回
  end;


	// 预置硬件参数



  	CNTPara.ControlMode := 0;
	CNTPara.AddDecMode := 0;
	CNTPara.CNTVal := 100;




  // PCI8613_SetLCLKFreqCNT(hDevice, dFre, iChannel); // 设置本时钟LOCAL_CLK的频率

  PCI8613_SetDeviceCNT(hDevice, @CNTPara, iChannel);


	while (kbhit() = 0) do
  begin
		if ( PCI8613_GetDeviceCNT(hDevice, @CNTPara, iChannel) = False ) then
    begin
			writeln('GetDeviceCNT Error...');
			goto ExitRead0;
		end;
		Writeln(Format('CNTVal=%d', [CNTPara.CNTVal]));
	end;



ExitRead0:
	PCI8613_ReleaseDevice(hDevice);                         // 释放设备对象

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -