亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? dscadsampleint.c

?? PC/104擴(kuò)展模塊DIAMOND-MM-16-AT驅(qū)動(dòng)程序
?? C
字號(hào):
//=============================================================================                                                                                          //=============================================================================
// (c) Copyright 2005 Diamond Systems Corporation. Use of this source code
// is subject to the terms of Diamond Systems' Software License Agreement.
// Diamond Systems provides no warranty of proper performance if this
// source code is modified.
//
// File: DSCADSampleInt.c   v5.9
// Desc: Sample program that demonstrates how to take an interrupt-based AD
//		 sample
// Created By KL
//=============================================================================

#include <stdio.h>

#ifdef _WIN32
#ifndef _WIN32_WCE
#include <conio.h>
#endif

#include <windows.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
// diamond driver includes
#include "dscud.h"
#endif


#ifdef _WIN32_WCE

#include <string.h>
#include <Winsock2.h>

static int kbhit()
{
	int i;
	int result=0;

	
	result |= GetAsyncKeyState(VK_RETURN);
	result |= GetAsyncKeyState(VK_SPACE);

	if (result != 0)
	{
		getchar();
		return 1;
	}

	//number keys, 0-9
	for (i=48; i<=57; i++)
		result |= GetAsyncKeyState(i);

	if (result != 0)
	{
		getchar();
		return 1;
	}

	//capital character keys, A-Z
	for (i=65; i<=90; i++)
		result |= GetAsyncKeyState(i);

	if (result != 0)
	{
		getchar();
		return 1;
	}

	//lower case keys, a-z
	for (i=97; i<=122; i++)
		result |= GetAsyncKeyState(i);

	if (result != 0)
	{
		getchar();
		return 1;
	}

	return result;
}

#endif


// DOS
#ifdef __BORLANDC__
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
#include <math.h>
#include <mem.h>
// diamond driver includes
#include "../../../../current/dev/source/dscud.h"
#endif

// Linux and QNX
#if defined(linux) || defined(__QNXNTO__) || defined(_WRS_VXWORKS_5_X)
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
// diamond driver includes
#include "dscud.h"


#ifdef _WRS_VXWORKS_5_X
#include <selectLib.h>
#define main DMM16ATDSCADSampleInt
#else
#include <sys/time.h>
#endif

static int kbhit()
{
	struct timeval timeout;
	fd_set rfds;

	timeout.tv_sec = 0;
	timeout.tv_usec = 0;

	FD_ZERO(&rfds);
	FD_SET(0, &rfds);

	if ( select(0+1, &rfds, NULL, NULL, &timeout) > 0 )
		return getchar();

	return 0;
}
#endif

// macros defined
#define SLEEP_TIME 1000

// var declarations
BYTE result; // returned error code
DSCB dscb;   // handle used to refer to the board
DSCCB dsccb; // structure containing board settings
DSCS dscs;   // used for interrupts.
DSCAIOINT dscaioint;         // structure containing auto-calibration settings
DSCADSETTINGS dscadsettings; // structure containing A/D conversion settings
ERRPARAMS errorParams;       // structure for returning error code and error string
DFLOAT voltage;
int intBuff;     // temp variables of size int
long  longBuff;  // temp variables of size long
float floatBuff; // temp variables of size float
int i;	         // miscellaneous counter

//=============================================================================
// Name: main()
// Desc: Starting function that calls the driver functions used
//
//		 NOTE: By convention, you should capture the BYTE return value for each
//		 driver API call, and check the error code.
//
//	     I. Driver Initialization
//	    II. Board Initialization
//	   III. Interrupt Settings
//	    IV. Interrupt
//		 V. Data check
//	    VI. Cleanup
//
//=============================================================================

int main( void )
{
	//=========================================================================
	// I. DRIVER INITIALIZATION
	//
	//    Initializes the DSCUD library.
	//
	//=========================================================================

	if( dscInit( DSC_VERSION ) != DE_NONE )
	{
		dscGetLastError(&errorParams);
		fprintf( stderr, "dscInit error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
		return 0;
	}

	//=========================================================================
	// II. BOARD INITIALIZATION
	//
	//	   Initialize the DMM-16-AT board. This function passes the various
	//	   hardware parameters to the driver and resets the hardware.
	//
	//=========================================================================

	printf( "\nDMM16AT BOARD INITIALIZATION:\n" );

	printf("Enter the base address (default 0x300) : ");
	scanf( "%hx", &dsccb.base_address );

	printf("Enter the interrupt level (3-15) : ");
	scanf("%d", &intBuff);
	dsccb.int_level = (BYTE) intBuff;

	if(dscInitBoard(DSC_DMM16AT, &dsccb, &dscb)!= DE_NONE)
	{
		dscGetLastError(&errorParams);
		fprintf( stderr, "dscInitBoard error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
		return 0;
	}

	//=========================================================================
	// III. AD SETTINGS INITIALIZATION
	//
	//	    Initialize the structure containing the AD conversion settings and
	//		then pass it to the driver.
	//
	//=========================================================================

	/* PRE-FILLED EXAMPLE
	dscadsettings.range = RANGE_10;
	dscadsettings.polarity = BIPOLAR;
	dscadsettings.gain = GAIN_1;
	dscadsettings.load_cal = (BYTE)TRUE;
	dscadsettings.current_channel = 0;
	*/

	printf( "\nAD SETTINGS INITIALIZATION\n" );

	memset(&dscadsettings, 0, sizeof(DSCADSETTINGS));

	printf( "Enter the range (0 for 5V range, 1 for 10V range): " );
	scanf("%d", &intBuff);
	dscadsettings.range = (BYTE) intBuff;

	printf( "Enter the polarity (0 for BIPOLAR, 1 for UNIPOLAR): " );
	scanf("%d", &intBuff);
	dscadsettings.polarity = (BYTE) intBuff;

	printf( "Enter the gain (0 for GAIN 1, 1 for GAIN 2, 2 for GAIN 4, 3 for GAIN 8): " );
	scanf("%d", &intBuff);
	dscadsettings.gain = (BYTE) intBuff;

	printf( "Enter the load calibration flag (0 for FALSE, 1 for TRUE): " );
	scanf("%d", &intBuff);
	dscadsettings.load_cal = (BYTE) intBuff;

	dscadsettings.current_channel = 0;

	if( ( result = dscADSetSettings( dscb, &dscadsettings ) ) != DE_NONE )
	{
		dscGetLastError(&errorParams);
		fprintf( stderr, "dscADSetSettings error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
		return 0;
	}

  	//=========================================================================
	// IV. I/O INTERRUPT SETTINGS INITIALIZATION
	//
	//	   Initialize the structure containing the analog I/O interrupt
	//	   settings.
	//
	//	   NOTE: You must allocate space for the buffer holding the returned
	//		     sample values. Also, be generous in allocating storage.
	//			 Allocating insufficient memory to hold sample data will result
	//			 in improper behavior of the driver, such as hanging interrupt
	//			 operations or assertion errors.
	//=========================================================================
	
	/* Prefilled example
	dscaioint.num_conversions = 1024;
	dscaioint.conversion_rate = 1000;
	dscaioint.cycle = (BYTE)FALSE;
	dscaioint.internal_clock = (BYTE)TRUE;
	dscaioint.low_channel = 0;
	dscaioint.high_channel = 3;
	dscaioint.external_gate_enable = (BYTE)FALSE;
	dscaioint.internal_clock_gate = (BYTE)FALSE;
	dscaioint.fifo_enab = (BYTE)TRUE;
	dscaioint.fifo_depth = 256;
	dscaioint.dump_threshold = 0;
	*/

	printf( "\nI/O INTERRUPT SETTINGS INITIALIZATION\n" );

	memset(&dscaioint, 0, sizeof(DSCAIOINT));

	printf( "Enter the number of conversions (must be a multiple of FIFO depth) : " );
	scanf("%ld", &longBuff);
	dscaioint.num_conversions = (DWORD) longBuff;

	printf( "Enter the conversion rate in Hz (must be less than 100000) : " );
	scanf("%f", &floatBuff);
	dscaioint.conversion_rate = (FLOAT) floatBuff;

	printf( "Enter the cycle flag (0 for FALSE, 1 for TRUE) : " );
	scanf("%d", &intBuff);
	dscaioint.cycle = (BOOL) intBuff;

	printf( "Enter the internal clock flag (0 for FALSE, 1 for TRUE) : " );
	scanf("%d", &intBuff);
	dscaioint.internal_clock  = (BOOL) intBuff;

	printf( "Enter the lowest channel in the scan range (0-15) : " );
	scanf("%d", &intBuff);
	dscaioint.low_channel = (BYTE) intBuff;

	printf( "Enter the highest channel in the scan range (0-15) : " );
	scanf("%d", &intBuff);
	dscaioint.high_channel = (BYTE) intBuff;

	dscaioint.external_gate_enable = 0; // can enable it if need be

	dscaioint.internal_clock_gate = 0;   // can enable it if need be

	printf( "Enter the FIFO enable flag (0 for FALSE, 1 for TRUE) : " );
	scanf("%d", &intBuff);
	dscaioint.fifo_enab = (BOOL) intBuff;

	dscaioint.fifo_depth = 256;

	printf("Enter the dump threshold ( must be less or equal to num conversions ) : ");
	scanf("%ld", &longBuff);
	dscaioint.dump_threshold = longBuff;

	dscaioint.sample_values = (DSCSAMPLE*)malloc( sizeof(DSCSAMPLE) * dscaioint.num_conversions );

	getchar();

	//=========================================================================
	// V. I/O INTERRUPT SETTINGS INITIALIZATION
	//
	//	   Initialize the structure containing the analog I/O interrupt
	//	   settings.
	//
	//	   NOTE: You must allocate space for the buffer holding the returned
	//		     sample values. Also, be generous in allocating storage.
	//			 Allocating insufficient memory to hold sample data will result
	//			 in improper behavior of the driver, such as hanging interrupt
	//			 operations or assertion errors.
	//
	//=========================================================================

	printf( "\nSAMPLING AND OUTPUT\n" );

	do
	{
		if( ( result = dscADSampleInt( dscb, &dscaioint ) ) != DE_NONE )
		{
			dscGetLastError(&errorParams);
			fprintf( stderr, "dscADSampleInt error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
			free( dscaioint.sample_values ); // remember to deallocate malloc() memory
			return 0;
		}

		dscs.transfers = 0;
		dscs.overflows = 0;
		dscs.op_type = OP_TYPE_INT;

		do{
			dscSleep(SLEEP_TIME);
			dscGetStatus(dscb,&dscs);
			printf("FIFO Overflows %lu, A/D Int Trans in progress: %lu Total Transf %lu\n", dscs.overflows, dscs.transfers, dscs.total_transfers);
		} while (dscs.op_type != OP_TYPE_NONE && !kbhit());

		// cancel interrupts manually for recycled mode or if interrupts are still running
		if( dscs.op_type != OP_TYPE_NONE)
		{
			if( (result = dscCancelOp(dscb)) != DE_NONE)
			{
				dscGetLastError(&errorParams);
				fprintf( stderr, "dscCancelOp error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
				free( dscaioint.sample_values ); // remember to deallocate malloc() memory
				return 0;
			}
		}

		printf( "\nSample readouts:" );

		for( i = 0; i < (dscaioint.high_channel-dscaioint.low_channel + 1); i++)
			printf( " %hd", dscaioint.sample_values[i] );

		printf( "\n\nActual voltages:" );

		for(i = 0; i < (dscaioint.high_channel-dscaioint.low_channel + 1); i++)
		{
			if( dscADCodeToVoltage(dscb, dscadsettings, dscaioint.sample_values[i], &voltage) != DE_NONE)
			{
				dscGetLastError(&errorParams);
				fprintf( stderr, "dscADCodeToVoltage error: %s %s\n", dscGetErrorString(errorParams.ErrCode), errorParams.errstring );
				free(dscaioint.sample_values);
				return 0;
			}
			printf( " %5.3lfV", voltage );
		}

		printf( "\n\n" );
		printf("Enter 'q' to exit, any key to continue\n");
	}
	while(getchar() != 'q');

	//=========================================================================
	// VI. CLEANUP
	//
	//	   Cleanup any remnants left by the program and free the resources used
	//	   by the driver.
	//
	//     STEPS TO FOLLOW:
	//
	//	   1. free the memory allocated for sample values
	//	   2. free the driver resources
	//=========================================================================

	free( dscaioint.sample_values );

	dscFree();

	printf( "\nDSCADSampleInt completed.\n" );

	return 0;
} // end main()


#ifdef _WIN32_WCE
int WINAPI WinMain(	HINSTANCE hInstance,
					HINSTANCE hPrevInstance,
					LPTSTR    lpCmdLine,
					int       nCmdShow)
{
	printf("For users running cycled mode: to EXIT, hold down the 'q' key\n");
	printf("on the keyboard then press 'Enter' when 'q' letters appear on screen\n\n");
	main();

	return 0;
}

#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91网站视频在线观看| 欧美aa在线视频| 色综合色综合色综合 | 五月婷婷色综合| 欧美亚洲综合久久| 午夜久久电影网| 日韩免费在线观看| 国产成人三级在线观看| 自拍av一区二区三区| 色婷婷激情一区二区三区| 亚洲综合色噜噜狠狠| 555www色欧美视频| 国产一区二区0| 亚洲欧美日韩国产中文在线| 欧美性videosxxxxx| 九色综合狠狠综合久久| 国产精品视频你懂的| 色综合久久久久久久久久久| 日韩专区欧美专区| 久久精品视频在线看| 99视频在线精品| 青青草国产精品亚洲专区无| 久久天堂av综合合色蜜桃网| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲永久精品国产| 久久女同性恋中文字幕| 91九色最新地址| 精品中文字幕一区二区| 亚洲精品成人在线| 欧美不卡一区二区| 欧美中文字幕不卡| 国产麻豆成人精品| 亚洲成人资源在线| 国产日韩欧美精品电影三级在线| 欧美三级日韩在线| 国产成人高清视频| 日韩电影在线观看一区| 国产精品免费看片| 欧美本精品男人aⅴ天堂| 色哦色哦哦色天天综合| 国产资源在线一区| 亚洲第一电影网| 国产精品视频看| 日韩欧美电影一区| 欧美日韩一区二区三区在线看 | 日韩欧美国产三级电影视频| av网站免费线看精品| 日本一区二区成人| 欧美高清激情brazzers| 成人一区二区三区视频在线观看| 亚洲一区二区美女| √…a在线天堂一区| 精品久久人人做人人爰| 91黄视频在线观看| caoporm超碰国产精品| 国产精品自拍毛片| 日韩影院免费视频| 一区二区三区欧美激情| 18欧美亚洲精品| 欧美经典三级视频一区二区三区| 欧美一区二区免费视频| 欧美亚洲动漫另类| 91视频免费观看| 99麻豆久久久国产精品免费| 国产美女精品一区二区三区| 免费视频最近日韩| 亚洲不卡在线观看| 樱花影视一区二区| 亚洲欧美国产三级| 国产大片一区二区| 免费视频一区二区| 日本一不卡视频| 日本成人在线看| 天堂资源在线中文精品| 亚洲一级在线观看| 亚洲黄色av一区| 一区二区三区日本| 亚洲成人自拍偷拍| 天堂va蜜桃一区二区三区漫画版| 亚洲永久免费视频| 视频一区二区中文字幕| 日韩中文字幕一区二区三区| 三级久久三级久久久| 天堂在线亚洲视频| 蜜臀久久99精品久久久久久9| 天天综合日日夜夜精品| 蜜臀av一区二区| 久久www免费人成看片高清| 久久99热狠狠色一区二区| 九色|91porny| 成人自拍视频在线| hitomi一区二区三区精品| 色综合欧美在线视频区| 欧美性一级生活| 日韩欧美国产不卡| 国产午夜精品一区二区三区四区 | av日韩在线网站| 色婷婷av一区二区三区gif | 狠狠色狠狠色综合| 国产成人无遮挡在线视频| 99久久久精品| 欧美老肥妇做.爰bbww视频| 欧美成人一级视频| 国产精品狼人久久影院观看方式| 艳妇臀荡乳欲伦亚洲一区| 日本系列欧美系列| 国产福利一区二区三区视频在线| 粉嫩嫩av羞羞动漫久久久| 欧美亚洲愉拍一区二区| 日韩免费一区二区| 亚洲视频中文字幕| 午夜激情久久久| 国产精品自拍av| 欧美日韩在线播放| 久久久www成人免费毛片麻豆| 亚洲欧美国产毛片在线| 麻豆国产一区二区| 91网站在线播放| 精品国产一区a| 成人欧美一区二区三区白人 | 亚洲国产另类av| 国产在线国偷精品免费看| 色哟哟一区二区| 欧美mv和日韩mv的网站| 亚洲欧洲日产国产综合网| 日本亚洲最大的色成网站www| 成年人网站91| 欧美一级高清片在线观看| 亚洲视频免费在线| 久久aⅴ国产欧美74aaa| 日本道在线观看一区二区| 久久综合久久99| 五月天婷婷综合| 97久久超碰国产精品电影| 26uuu亚洲综合色| 丝袜美腿亚洲一区二区图片| caoporen国产精品视频| 久久综合色之久久综合| 婷婷久久综合九色综合绿巨人| 99在线精品视频| 国产亚洲综合在线| 久久精品999| 欧美精品粉嫩高潮一区二区| 国产精品盗摄一区二区三区| 久久99精品国产| 欧美乱熟臀69xxxxxx| 亚洲精品久久7777| 成人福利在线看| 久久久99久久精品欧美| 喷白浆一区二区| 欧美老女人在线| 亚洲成av人片在线观看无码| 波多野结衣中文字幕一区二区三区 | 国产欧美一区视频| 狠狠色狠狠色合久久伊人| 欧美一二三四在线| 日韩成人精品在线观看| 欧美日韩激情一区二区三区| 亚洲卡通欧美制服中文| 99精品国产91久久久久久| 国产欧美日韩三级| 国产.欧美.日韩| 亚洲国产精品成人综合| 国产一区二区美女| 国产午夜亚洲精品羞羞网站| 国产精品中文字幕一区二区三区| 欧美成人三级在线| 国产制服丝袜一区| 久久久亚洲午夜电影| 国产精品一卡二卡| 国产拍欧美日韩视频二区| 国产+成+人+亚洲欧洲自线| 国产精品美女久久久久久久| 成人激情免费网站| 亚洲欧美日韩电影| 欧美视频一区二区三区四区| 亚洲愉拍自拍另类高清精品| 欧美视频你懂的| 日韩av一级片| ww亚洲ww在线观看国产| 成人一区二区三区中文字幕| 成人免费在线视频| 欧美调教femdomvk| 免费成人在线视频观看| 精品国产凹凸成av人导航| 国产精品18久久久久久久久久久久| 日本一区二区电影| 91久久人澡人人添人人爽欧美| 五月婷婷久久丁香| 久久蜜臀中文字幕| 99re在线精品| 日韩国产一区二| 久久影视一区二区| 99久久精品免费看| 午夜婷婷国产麻豆精品| 久久视频一区二区| 在线视频你懂得一区二区三区| 日韩精品视频网| 国产精品午夜久久| 欧美精品日日鲁夜夜添|