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

📄 sy1202.htm

📁 c语言经典教程
💻 HTM
字号:
<html>
<HEAD>
<TITLE>Visual C++与计算机接口</TITLE>
 <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=gb2312" > 
</HEAD>
<body>
<font color="#0000FF">PC7422与PCI7422采集卡</font>
<p>
(一)实验目的:<BR>
     练习数据采集卡的使用<BR><BR>
(二)实验内容:<BR><BR>
1、PC7422编程<BR><BR>
  main()<BR>
  {<BR>
    int k,ch,dl,dh,data,dly=3000;<BR>
    int port=0x310;<BR>
    printf("Please Input ch(0-31):");<BR>
    scanf("%d",ch);<BR>
    _outp(port,ch);<BR>
    _outp(port+1,0);<BR>
    for(k=0;k< dly;k++);<BR>
    dl=_inp(port+2);<BR>
    dh=_inp(port+3);<BR>
    data=(dh&15)*256+dl;<BR>
  }   <BR><BR>
2、PCI7422编程<BR><BR>
  #include "windows.h"<BR>
  #include "stdio.h"<BR><BR>
  typedef int(*pci7422check)(WORD dwVendor, WORD dwDeviceID, BOOL fUseInt);<BR>
  typedef WORD(*pci7422ad)(int hplx, BOOL addr, WORD port);<BR>
  typedef WORD(*pci7422di)(int hplx, BOOL addr, WORD port);<BR>
  typedef int(*pci7422do)(int hplx, BOOL addr, WORD port,WORD data);<BR>
  typedef int(*pci7422close)(int hplx);<BR><BR>
  int main()<BR>
  {<BR>
    pci7422check Pci7422Check;<BR>
    pci7422ad Pci7422AD;<BR>
    pci7422di Pci7422DI;<BR>
    pci7422do Pci7422DO;<BR>
    pci7422close Pci7422Close;<BR>
    HMODULE dll;<BR>
    int hd;<BR>
    int a,i;<BR><BR>
    dll=LoadLibrary("pci7422vc.dll");<BR>
    Pci7422Check=(pci7422check)GetProcAddress(dll,"pci7422check");<BR>
    Pci7422AD=(pci7422ad)GetProcAddress(dll,"pci7422ad");<BR>
    Pci7422DI=(pci7422di)GetProcAddress(dll,"pci7422di");<BR>
    Pci7422DO=(pci7422do)GetProcAddress(dll,"pci7422do");<BR>
    Pci7422Close=(pci7422close)GetProcAddress(dll,"pci7422close");<BR><BR>
    hd=Pci7422Check(0,0,false);<BR>
    while(1){<BR>
      for(i=0;i < 32;i++)<BR>
      {<BR>
        a=Pci7422AD(hd,false,i);<BR>
        printf("%d ",a);<BR>
      }<BR>
      printf("\n");<BR>
    }<BR>
    return 0;<BR>
}<BR><BR>
<p></p>
</body>
</html>

⌨️ 快捷键说明

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