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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? test9911.cpp

?? usb開發包
?? CPP
字號:
///////////////////////////////////////////////////////////////
// HW9911 evaluation board software Rev. 1.0
// program by Liu Ding, Bei Jing HEAD Elec.
// this is the main program for the HW9911 USB device evaluation board
// it illustrate the basical read/write process of HW9911
// by three examples:
// 1. write datas to ram on the evaluation board
// 2. read the datas from the ram on the board
// 3. send datas through RS-232 serial prot on the board
// 
// the whole project are build with MSVC 6.0
// and tested on windows 98 platform.
//
// notes: you can use hyper terminal to reaceive datas form RS232 port
//
// this software are designed by Liu Ding
// if you meet any problems, pls contact by email:
// hugehard@263.net
// or contact HEAD Co. by Tel 86-10-87312497
// or by fax: 86-10-87312495
///////////////////////////////////////////////////////////////

#include "hwdll.h"
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <memory.h>
#include <DEVIOCTL.H>
#include <stdlib.h>
#include <conio.h>
#include "hw9911.h"
#include "test9911.h"


int main()
{
	int hOpen=FALSE;
	int hCommandLength=32;
	int hDataLength=64;
	int i,VertAddr=0,HorAddr=0;
	int addr,TotalLen;
	USC StAddrH=0,StAddrL=0;
	USC DataLenH,DataLenL;
	USC *hDataBuffer,*hCommandBuffer;
	USC ch1=0x61;
	HANDLE hDeviceHandle;
	
	printf("************************************************\n");
	printf("*******HW9911 USB DEVELOPMENT BOARD*************\n");
	printf("************************************************\n\n");
	printf("now press any key to open board\n");
	getch();

/********* call hDeviceOpen in hwdll.dll to open the board***/
//hOpenDevice 說明:
// BOOL hOpenDevice(HANDLE *DeviceHandle)
// 作用:打開設備
// 參數說明:
// DeviceHandle:設備句柄
// 返回值:
// 設備打開成功返回 TRUE,失敗則返回FALSE
	if( (hOpen = hOpenDevice( &hDeviceHandle ))==FALSE)
	{
		printf("can't open device\n");
		printf("press any key to exit\n");
		getch();
		return 0;
	}
	else 
		printf("\nCongratulations! device opened!\n\n");

/******  build and send command **********/
	printf("how many bytes do you want to access?");
	scanf("%x",&TotalLen);
	while(TotalLen > 0x7fff)
	{
		printf("pls input a hex data less than 08000\n");
		scanf("%x",&TotalLen);
	}
	DataLenH=(USC)(TotalLen/0x100);		//data length high bytes
	DataLenL=(USC)(TotalLen%0x100);		//data length low bytes

	printf("************************************************\n");
	printf("now program will write datas to ram on board\n");
	printf("total bytes of datas is %x\n",TotalLen);
	printf("press any key to continue\n\n");
	getch();
/*****************************************************************
      now will build a write command packet    
        with the first byte is 'w'.
		and the following bytes are:
		start ram address byte high, start ram address byte low,
		datalength byte high, data length byte low.
		this packet will send to device through WritePipe1,
		which is endpoint 2 of HW9911.
		when the device receive this command packet,
		it will write TotalLen bytes data to Ram on the board
******************************************************************/


	hCommandBuffer=(USC *)malloc(hCommandLength);
	hDataBuffer=(USC *)malloc(hDataLength);
	hCommandBuffer[0] = 'w';	//read command
	hCommandBuffer[1] = StAddrH;	
	hCommandBuffer[2] = StAddrL;	
	hCommandBuffer[3] = DataLenH;
	hCommandBuffer[4] = DataLenL;	

/* call hUSBIO() in hwdll.dll to send command packet to device*/
// hUSBIO 說明:
// BOOL hOpenDevice(HANDLE *DeviceHandle,
//					unsigned char *IOBuffer,
//					int BufferLength,
//					int PipeNumber,
//					int Action)
// 作用:設備讀寫
// 參數說明:
// DeviceHandle:設備句柄
// IOBuffer: 指向要傳送的數據指針
// BufferLength: 數據包長度
// 對于發送緩存1、2和接收緩存1、2,BufferLength必須小于或等于32
// 對于發送緩存3和接收緩存3,BufferLength必須小于或等于64
// PipeNumber: 通道號
//		發送緩存1:PipeNumber=0;
//		接收緩存1:PipeNumber=1;
//		發送緩存3:PipeNumber=2;
//		接收緩存3:PipeNumber=3;
// Action: 讀寫標志。TRUE代表從設備讀數據到主機
//					 FALSE代表從主機發送數據到設備		
//		操作接收緩存,Action必須為FALSE
//		操作發送緩存,Action必須為TRUE
// 返回值:
// 操作成功返回TRUE,失敗返回FALSE

	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			hCommandLength,
			hWritePipe1,
			FALSE) == TRUE)
	{
		printf("command 'w' writed to board\n");
		printf("now press any key to write datas to ram\n");
		getch();
	}
	else
		printf("data can't write to device\n");

/******** write ram data to board **********/

	printf("      ");
	for(VertAddr=0;VertAddr<=0xf;VertAddr++)
		printf("%02x ",VertAddr);
		printf("\n");
	addr=0;
	while (addr<TotalLen)
	{
		if (addr+hDataLength > TotalLen)
			hDataLength = TotalLen-addr;
		for(i=0;i<hDataLength;i++)
		{
			hDataBuffer[i]=ch1++;
			if (ch1 > 0x80) 
				ch1 = 0x61;
		}
/* call hUSBIO to write datas to write pipe3, which
   is endoint 6 of HW9911*/

		if (	hUSBIO(	&hDeviceHandle,
				hDataBuffer,
				hDataLength,
				hWritePipe3,	
				FALSE) == TRUE)		//FALSE means Write operate
		{
			for(i=0;i<hDataLength;i++)
			{
/* print format control   */		
				if(i % 16 == 0) 
				{
					printf("\n%04x ",HorAddr);
					HorAddr=HorAddr+16;
				}
				printf("%02x ",(USC)hDataBuffer[i]);
			}
			addr=addr+hDataLength;
		}
		else
		{
			printf("can't write to board\n");
			exit(0);
		}
	}
	printf("\n\nTotal%x bytes write to ram OK\n\n",TotalLen);


/*****************************************************************
      now will build a read command packet    
        with the first byte is 'R'.
		and the following bytes are:
		start ram address byte high, start ram address byte low,
		datalength byte high, data length byte low.
		this packet will send to device through WritePipe1,
		which is endpoint 2 of HW9911.
		when the device receive this command packet,
		it will read TotalLen bytes data from Ram on the board
******************************************************************/

	printf("************************************************\n");
	printf("now program will read datas from ram on board\n");
	printf("total bytes of datas is %x\n",TotalLen);
	printf("press any key to continue\n\n");
	getch();
	hDataLength=64;
	hCommandBuffer[0] = 'r';	//read command
	hCommandBuffer[1] = StAddrH;	
	hCommandBuffer[2] = StAddrL;	
	hCommandBuffer[3] = DataLenH;
	hCommandBuffer[4] = DataLenL;	
/*  call hUSBIO to send packet   */
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			hCommandLength,
			hWritePipe1,
			FALSE) == TRUE)
	{
		printf("command 'r' writed to board\n");
		printf("now press any key to read datas from ram\n\n");
		getch();
	}
	else
		printf("data can't write to device\n");

/******** read ram data form board **********/
	printf("      ");
	for(VertAddr=0;VertAddr<=0xf;VertAddr++)
		printf("%02x ",VertAddr);
		printf("\n");
	addr=0;
	HorAddr=0;
	while (addr<TotalLen)
	{
		if (addr+hDataLength > TotalLen)
			hDataLength = TotalLen-addr;
/* call hUSBIO to read datas from board  */
		if (	hUSBIO(	&hDeviceHandle,
				hDataBuffer,
				hDataLength,
				hReadPipe3,
				TRUE) == TRUE)			//TRUE means Read Operate
		{
			for(i=0;i<hDataLength;i++)
			{
/*   print format control   */
				if(i % 16 == 0) 
				{
					printf("\n%04x ",HorAddr);
					HorAddr=HorAddr+16;
				}
				printf("%02x ",(USC)hDataBuffer[i]);
			}
			addr=addr+hDataLength;
		}
		else
		{
			printf("can't read from board\n");
			exit(0);
		}
	}
	printf("\n\n");
	printf("%x bytes read from ram OK\n\n",TotalLen);

/*****************************************************/
/*      process rs232 test                           */
/*     the first byte in this packet is command 's'  */
/*     and the following 2 bytes are used to set     */
/*     the baud rate of 8051						 */
/*     they will be write to TH1 and TL1 respectively*/
/*     the following bytes are datas will be         */
/*     send through RS232 serial poart				 */
/*****************************************************/
	printf("\npress any key to process RS232 Test\n");
	getch();
	
	USC TH1,TL1;
	char hStr[30];
	TH1=(USC)(BD9600/0x100);
	TL1=(USC)(BD9600%0x100);
	hCommandBuffer[0] = 's';	//read command
	hCommandBuffer[1] = TH1;	
	hCommandBuffer[2] = TL1;	//start address is 0x0000

	strcpy(hStr, "Hi, dear HW9911 consumers! ");
	printf("Hi, dear HW9911 consumers! ");
	memcpy(&(hCommandBuffer[3]),hStr,27);

	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			30,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}

	strcpy(hStr, "I'm HW9911 Evaluation Board, ");
	printf("I'm HW9911 Evaluation Board, ");
	memcpy(&(hCommandBuffer[3]),hStr,29);
	
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			32,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}

	strcpy(hStr, "thanks for purchasing me, ");
	printf("thanks for purchasing me, ");
	memcpy(&(hCommandBuffer[3]),hStr,26);
	
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			29,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}
	
	strcpy(hStr, "If you meet some problems, ");
	printf(hStr, "If you meet some problems, ");
	memcpy(&(hCommandBuffer[3]),hStr,27);
	
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			30,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}

	strcpy(hStr, "pls contact my designer ");
	printf("pls contact my designer ");
	memcpy(&(hCommandBuffer[3]),hStr,24);
	
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			27,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}

	strcpy(hStr, "by email: hugehard@263.net.");
	printf("by email: hugehard@263.net.\n");
	memcpy(&(hCommandBuffer[3]),hStr,27);
	
	if (	hUSBIO(	&hDeviceHandle,
			hCommandBuffer,
			30,
			hWritePipe1,
			FALSE) == FALSE)
	{
			printf("can't write datas to RS232\n");
			exit(0);
	}
/********* call hDeviceOpen in hwdll.dll to open the board***/
// hCloseDevice 說明:
// BOOL hCloseDevice(HANDLE *DeviceHandle)
// 作用:關閉設備
// 參數說明:
// DeviceHandle:設備句柄
// 返回值:
// 設備關閉成功返回 TRUE,失敗則返回FALSE
	if( (hOpen = hCloseDevice( &hDeviceHandle ))==FALSE)
	{
		printf("can't open device\n");
		printf("press any key to exit\n");
		getch();
		return 0;
	}
	else 
		printf("device closed\n");

	printf("press any key to exit the program\n");
	free(hDataBuffer);
	free(hCommandBuffer);
	getch();
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩成人dvd| 亚洲国产精品精华液ab| 91亚洲大成网污www| 国产成人精品免费| 国产高清精品网站| 懂色av一区二区三区蜜臀| 狠狠色丁香九九婷婷综合五月| 日韩综合小视频| 日韩电影免费在线观看网站| 美女一区二区久久| 国产精品99久久久久久似苏梦涵| 狠狠色丁香久久婷婷综| 成人毛片老司机大片| 91麻豆产精品久久久久久| 欧美系列日韩一区| 日韩欧美色电影| 国产欧美日韩另类一区| 亚洲视频综合在线| 丝袜脚交一区二区| 国产一区二区三区不卡在线观看 | 91视频国产资源| 日本电影欧美片| 日本道色综合久久| 日韩精品一区二区三区中文精品| 国产偷国产偷亚洲高清人白洁| 亚洲欧美日韩电影| 青青草国产精品97视觉盛宴| 国产成人午夜视频| 在线观看视频一区二区欧美日韩| 欧美一卡二卡三卡四卡| 亚洲综合无码一区二区| 无吗不卡中文字幕| 国产99精品国产| 欧美伦理电影网| 国产精品女人毛片| 亚洲老司机在线| 全国精品久久少妇| 国产69精品久久久久777| 视频一区免费在线观看| 国产亚洲精品精华液| 国产欧美一区视频| 亚洲午夜精品网| 国产精品综合视频| 欧美疯狂做受xxxx富婆| 国产欧美精品区一区二区三区| 亚洲国产欧美在线人成| 丁香五精品蜜臀久久久久99网站| 欧美日韩国产成人在线免费| 国产精品久久午夜夜伦鲁鲁| 天天射综合影视| 色综合夜色一区| 国产精品天美传媒| 黄网站免费久久| 久久影院视频免费| 日韩成人精品视频| 日韩国产精品久久久久久亚洲| 不卡一二三区首页| 欧美精品一区二区三区四区 | 18成人在线观看| 韩国毛片一区二区三区| 91精品国产综合久久蜜臀| 一区二区三区精品视频| 91丨porny丨最新| 国产精品久久久久精k8| 国产一区二区在线观看免费| 欧美成人福利视频| 免费成人美女在线观看| 51精品国自产在线| 午夜精品久久久久影视| 欧美日韩成人综合| 亚洲午夜在线观看视频在线| 色诱亚洲精品久久久久久| 中文字幕第一区第二区| www.亚洲在线| 亚洲欧洲av在线| 99视频热这里只有精品免费| ●精品国产综合乱码久久久久| 成人成人成人在线视频| 国产精品亲子伦对白| www.性欧美| 亚洲精品高清在线观看| 在线观看一区二区视频| 天堂精品中文字幕在线| 欧美不卡视频一区| 国产精品一区二区你懂的| 国产精品毛片无遮挡高清| 91在线国产观看| 亚洲电影激情视频网站| 69p69国产精品| 国产精品综合在线视频| 亚洲天堂2016| 6080国产精品一区二区| 国产麻豆午夜三级精品| 一区视频在线播放| 欧美色综合天天久久综合精品| 肉肉av福利一精品导航| 国产午夜精品一区二区| 97精品电影院| 日韩av网站免费在线| 国产欧美日韩卡一| 欧美在线视频你懂得| 蜜臀av性久久久久蜜臀aⅴ四虎 | 国产亚洲欧洲997久久综合| 91视频91自| 免费在线看一区| 中文久久乱码一区二区| 欧美在线影院一区二区| 久久精品国产一区二区三区免费看 | 亚洲大片精品永久免费| 欧美va在线播放| 91麻豆免费观看| 经典三级视频一区| 亚洲黄色片在线观看| www精品美女久久久tv| 在线观看视频一区| 国产91综合一区在线观看| 亚洲第一电影网| 国产精品女人毛片| 日韩精品一区二区三区视频播放 | 成人av综合在线| 天天射综合影视| 中文字幕佐山爱一区二区免费| 日韩一区二区精品在线观看| 成人av免费在线播放| 精品一区二区三区在线视频| 亚洲在线观看免费视频| 中国av一区二区三区| 日韩午夜在线播放| 在线欧美日韩精品| aaa亚洲精品| 国产成人福利片| 国产永久精品大片wwwapp| 日韩成人免费电影| 亚洲一区二区三区四区不卡| 国产精品久久久久久久久免费桃花 | 在线观看91精品国产入口| 国产aⅴ精品一区二区三区色成熟| 调教+趴+乳夹+国产+精品| 亚洲日本韩国一区| 国产精品视频观看| 国产亚洲人成网站| 亚洲精品在线观看网站| 欧美一级欧美一级在线播放| 欧美日韩高清一区二区| 色偷偷久久一区二区三区| 成人精品免费看| 大桥未久av一区二区三区中文| 国产毛片精品国产一区二区三区| 美女视频黄 久久| 蜜桃视频在线观看一区二区| 日本不卡视频在线| 免费不卡在线观看| 精品一区二区在线看| 国产乱理伦片在线观看夜一区| 国产在线视频一区二区三区| 国产在线看一区| 国产乱子伦一区二区三区国色天香| 激情小说欧美图片| 国产成人免费视频网站| 成人精品一区二区三区中文字幕| 波多野结衣精品在线| 91一区二区在线| 在线观看一区日韩| 91精品国产综合久久久久| 日韩一区二区三区高清免费看看| 欧美一区二区视频在线观看2022| 欧美一级免费大片| 国产欧美日韩在线观看| 亚洲天堂成人在线观看| 视频在线观看国产精品| 久久成人18免费观看| 岛国精品一区二区| 欧洲国产伦久久久久久久| 91精品国产免费| 国产欧美日韩卡一| 亚洲一区二区三区免费视频| 亚洲二区视频在线| 国产在线视频不卡二| 99精品偷自拍| 欧美日韩亚洲综合一区二区三区| 欧美videos大乳护士334| 中文字幕亚洲区| 天天操天天色综合| 成人自拍视频在线观看| 日韩av一区二区在线影视| 色哦色哦哦色天天综合| 精品捆绑美女sm三区| 一区二区免费在线| 亚洲精品一区二区三区蜜桃下载| 欧美经典一区二区三区| 亚洲第一激情av| 国产一区二区免费视频| 色乱码一区二区三区88| 日韩欧美一级片| 亚洲精品国产视频| 韩国av一区二区三区| 91精品91久久久中77777| 欧美成人性福生活免费看| 亚洲精品国久久99热| 国产成人免费在线观看不卡|