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

📄 pdiusbd12.h

📁 一个使用USB下载51单片机程序的源程序
💻 H
字号:
#include "usb100.h"
#include "mainloop.h"
#include "d12ci.h"

#define	D12_Data		((BYTE volatile xdata*)0)
#define	D12_Comm		((BYTE volatile xdata*)1)

static BYTE code String_0[]={
	4, 3, 9, 4			// Declare the UNICODE strings, Only English language strings supported
};
static BYTE code String_1[]={
	16, 3,				// Length,Type (Manufacturer)
	'F',0,'S',0,'W',0,'E',0,'W',0,'I',0,'N',0,
};
static BYTE code String_2[]={
	16, 3,				// Length,Type (Product Name)
	'U',0,'S',0,'B',0,'-',0,'I',0,'S',0,'P',0,
};
static BYTE code String_3[]={
	10, 3,				// Length,Type (Version)
	'V',0,'1',0,'.',0,'0',0
};

static BYTE code DeviceDescr[] =
{
	18, 1,			// Length, Type
	0x10, 0x01,		// USB Version(1.10)
	0,					// Device class
	0,					// Device subclass
	0,					// DEvice protocol
	EP0_PACKET_SIZE,
	1, 0,				// Vendor ID
	//	0, 1,				// Product ID
	0, 1,				// Product ID
	1, 1,				// Version ID
   1, 2, 3,			// Index of Vendor,Product,Version strings
	1					// Number of configs
};

static BYTE code ReportDescriptor[]={
	0x06, 0xA0, 0xFF,							// USAGE_PAGE (User defined)
	0x09, 0xA5,									// Usage (Vendor defined)
	0xA1, 0x01,									// COLLECTION (Application)
	0x09, 0xA6,									// Usage (Vendor defined)
// Input report(Device->PC)
	0x09, 0xA7,									// Usage (Vendor defined)
	0x15, 0x0,									//   Logical Minimum (0)
	0x26, 0xFF, 0x00,							//   Logical Maximum (255)
	0x75, 0x08,									//   Report Size (8 bits)
	0x95, BUF_LEN,								//   Report Count (64 bytes)
	0x81, 0x02,									//   Input (Data,Variable,Absolute)
// Output report(PC->Device)
	0x09, 0xA9,									// Usage (Vendor defined)
	0x15, 0x0,									//   Logical Minimum (0)
	0x26, 0xFF,	0x00,							//   Logical Maximum (255)
	0x75, 0x08,									//   Report Size (8 bits)
	0x95, BUF_LEN,								//   Report Count (23 bytes)
	0x91, 0x02,									//   Output (Data,Variable,Absolute)
	0xC0											// END_COLLECTION
};

code unsigned char ConfigDescr[] =
{
	9,												// Config Length
	2,												// Configration Descriptor
	41,0,											// wTotalLength (9+9+9+7+7)
	0x01,											// bNumInterfaces
	0x01,											// bConfigurationValue
	0,												// index of config. string
	0x40,											// self powered
	50,											// max power (100 mA)

	9,												// Interface Length
	4,												// Interface Descriptor
	0x00,											// interface number
	0x00,											// alternate setting
	0x02,											// # of (non 0) endpoints
	3,												// HID interface class
	0,												// No subclass
	0x00,											// interface protocol
	0,												// index of interface string

	9,												// HID Descriptor Length
	0x21,											// HID Descriptor
	0x00,0x01,									// HID spec rev level (BCD)
	0x00,											// target country
	1,												// # HID class desc follow.
	0x22,											// HID Report Descriptor
	sizeof(ReportDescriptor),0x00,		// report descr. length

	7,												// Endpoint Descriptor Length
	5,												// Endpoint Descriptor
	0x02,											// address (OUT)(termial 6)(PC->Device)
	0x03,											// attributes  (INTERRUPT)
	64,0,											// max packet size (64)
	10,											// interval (10 ms)

	7,												// Endpoint Descriptor Length
	5,												// Endpoint Descriptor
	0x82,											// address (IN)(termial 5)(Device->PC)
	0x03,											// attributes  (INTERRUPT)
	64,0,											// max packet size (64)
	10												// interval (10 ms)(100 ms)
};

⌨️ 快捷键说明

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