📄 sys.cpp
字号:
// Sys.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "windows.h"
#include "stdio.h"
#include "conio.h"
#include "pci2000.h"
int main(int argc, char* argv[])
{
HANDLE hDevice;
int DeviceID;
PCI2000_PARA_AD Para;
WORD InUserRegion[ 8192 ];
int ReadSizeWords;
int nChannelNumber;
int nRemainder;
DeviceID = 0;
Para.FirstChannel = 0;
Para.LastChannel = 4;
Para.TriggerMode = PCI2000_IN_TRIGGER;
Para.Gains = 1;
Para.Frequence = 100;
nChannelNumber = Para.LastChannel - Para.FirstChannel + 1;
ReadSizeWords = 100;
nRemainder = ReadSizeWords % nChannelNumber;
ReadSizeWords = ReadSizeWords - nRemainder;
hDevice = PCI2000_CreateDevice( DeviceID );
PCI2000_InitDeviceProAD( hDevice, &Para); // 硬件参数, 它仅在此函数中决定硬件状态
while ( ! kbhit() )
{
PCI2000_ReadDeviceProAD_NotEmpty( hDevice, InUserRegion, ReadSizeWords); // 读入的数据长度
for( int i = 0; i < 30; i ++ )
{
// 按照-5V --- +5V 量程转换为电压值
printf("%f \t" , ( InUserRegion[i]&0xfff ) / 4096.0 * 10.0 - 5.0 );
if ( ( i + 1 ) % 5 == 0 )
printf( "\n" );
}
}
PCI2000_ReleaseDeviceProAD( hDevice );
PCI2000_ReleaseDevice( hDevice );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -