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

📄 stm32f10x_reg.h

📁 CAN 程序使用MCP2515 由STM32做主芯片控制
💻 H
📖 第 1 页 / 共 5 页
字号:
/*
 * STM32F10X register header file
 * Modify by WFJ.  2009.3.19
 */

#ifndef __STM32F10x_REG_H
#define __STM32F10x_REG_H

#define _ADC
#define _ADC1
#define _ADC2
#define _BKP 
#define _CAN
#define _DMA
#define _DMA_CHANNEL1
#define _DMA_CHANNEL2
#define _DMA_CHANNEL3
#define _DMA_CHANNEL4
#define _DMA_CHANNEL5
#define _DMA_CHANNEL6
#define _DMA_CHANNEL7
#define _EXTI
#define _FLASH
#define _FLASH_PROG
#define _GPIO
#define _GPIOA
#define _GPIOB
#define _GPIOC
#define _GPIOD
#define _GPIOE
#define _AFIO
#define _I2C
#define _I2C1
#define _I2C2
#define _IWDG
#define _NVIC
#define _PWR
#define _RCC
#define _RTC
#define _SPI1
#define _SPI2
#define _SPI3
#define _SYSTICK
#define _TIM1
#define _TIM
#define _TIM2
#define _TIM3
#define _TIM4
#define _USART
#define _USART1
#define _USART2
#define _USART3
#define _WWDG



/* typedef ------------------------------------------------------------*/
/******************************************************************************/
/*                         Peripheral registers structures                    */
/******************************************************************************/

/*------------------------ Analog to Digital Converter -----------------------*/
typedef struct
{
	union
	{
		struct
		{
			volatile unsigned long AWD		:1;
			volatile unsigned long EOC		:1;
			volatile unsigned long JOC		:1;
			volatile unsigned long JSTRT		:1;
			volatile unsigned long STRT		:1;
			volatile unsigned long NC		:27;
		} B;
		volatile unsigned long W;
	} SR;  //ADC_SR	   地址偏移:0x00;
	union
	{
		struct
		{
			volatile unsigned long AWDCH		:5;
			volatile unsigned long EOCIE		:1;
			volatile unsigned long AWDIE		:1;
			volatile unsigned long JEOCIE		:1;
			volatile unsigned long SCAN		:1;
			volatile unsigned long AWD_SGL	:1;
			volatile unsigned long JAUTO		:1;
			volatile unsigned long DISCEN		:1;
			volatile unsigned long JDISCEN	:1;
			volatile unsigned long DISCNUM	:3;
			volatile unsigned long DUALMOD	:4;
			volatile unsigned long NC1		:2;
			volatile unsigned long JAWDEN		:1;
			volatile unsigned long AWDEN		:1;
			volatile unsigned long NC			:8;
		} B;
		volatile unsigned long W;
	} CR1;	 //ADC_CR1;	地址偏移:0x04;
	union
	{
		struct
		{
			volatile unsigned long ADON		:1;
			volatile unsigned long CONT		:1;
			volatile unsigned long CAL		:1;
			volatile unsigned long RSTCAL		:1;
			volatile unsigned long NC3		:4;
			volatile unsigned long DMA		:1;
			volatile unsigned long NC2		:2;
			volatile unsigned long ALIGN		:1;
			volatile unsigned long JEXTSEL	:3;
			volatile unsigned long JEXTTRIG	:1;
			volatile unsigned long NC1		:1;
			volatile unsigned long EXTSEL		:3;
			volatile unsigned long EXTTRIG	:1;
			volatile unsigned long JSWSTART	:1;
			volatile unsigned long SWSTART	:1;
			volatile unsigned long TSVREFE	:1;
			volatile unsigned long NC			:8;
		} B;
		volatile unsigned long W;
	} CR2;		//ADC_CR2 ;地址偏移:0x08;
	union
	{
		struct
		{
			volatile unsigned long SMP10		:3;
			volatile unsigned long SMP11		:3;
			volatile unsigned long SMP12		:3;
			volatile unsigned long SMP13		:3;
			volatile unsigned long SMP14		:3;
			volatile unsigned long SMP15		:3;
			volatile unsigned long SMP16		:3;
			volatile unsigned long SMP17		:3;
			volatile unsigned long NC		:8;
		} B;
		volatile unsigned long W;
	} SMPR1;
	union
	{
		struct
		{

			volatile unsigned long SMP0		:3;
			volatile unsigned long SMP1		:3;
			volatile unsigned long SMP2		:3;
			volatile unsigned long SMP3		:3;
			volatile unsigned long SMP4		:3;
			volatile unsigned long SMP5		:3;
			volatile unsigned long SMP6		:3;
			volatile unsigned long SMP7		:3;
			volatile unsigned long SMP8		:3;
			volatile unsigned long SMP9		:3;
			volatile unsigned long NC		:2;
		} B;
		volatile unsigned long W;
	} SMPR2;
	union
	{
		struct
		{
			volatile unsigned long JOFFSET1		:12;
			volatile unsigned long NC		:20;
		} B;
		volatile unsigned long W;
	} JOFR1;
	union
	{
		struct
		{
			volatile unsigned long JOFFSET2		:12;
			volatile unsigned long NC		:20;
		} B;
		volatile unsigned long W;
	} JOFR2;
	union
	{
		struct
		{
			volatile unsigned long JOFFSET3	:12;
			volatile unsigned long NC			:20;
		} B;
		volatile unsigned long W;
	} JOFR3;
	union
	{
		struct
		{
			volatile unsigned long JOFFSET4	:12;
			volatile unsigned long NC			:20;
		} B;
		volatile unsigned long W;
	} JOFR4;
	union
	{
		struct
		{
			volatile unsigned long HT			:12;
			volatile unsigned long NC			:20;
		} B;
		volatile unsigned long W;
	} HTR;
	union
	{
		struct
		{
			volatile unsigned long LT			:12;
			volatile unsigned long NC			:20;
		} B;
		volatile unsigned long W;
	} LTR;
	union
	{
		struct
		{
			volatile unsigned long SQ13		:5;
			volatile unsigned long SQ14		:5;
			volatile unsigned long SQ15		:5;
			volatile unsigned long SQ16		:5;
			volatile unsigned long L			:4;
			volatile unsigned long NC			:8;
		} B;
		volatile unsigned long W;
	} SQR1;
	union
	{
		struct
		{
			volatile unsigned long SQ7		:5;
			volatile unsigned long SQ8		:5;
			volatile unsigned long SQ9		:5;
			volatile unsigned long SQ10		:5;
			volatile unsigned long SQ11		:5;
			volatile unsigned long SQ12		:5;
			volatile unsigned long NC			:2;
		} B;
		volatile unsigned long W;
	} SQR2;
	union
	{
		struct
		{
			volatile unsigned long SQ1		:5;
			volatile unsigned long SQ2		:5;
			volatile unsigned long SQ3		:5;
			volatile unsigned long SQ4		:5;
			volatile unsigned long SQ5		:5;
			volatile unsigned long SQ6		:5;
			volatile unsigned long NC			:2;
		} B;
		volatile unsigned long W;
	} SQR3;
	union
	{
		struct
		{
			volatile unsigned long JSQ1		:5;
			volatile unsigned long JSQ2		:5;
			volatile unsigned long JSQ3		:5;
			volatile unsigned long JSQ4		:5;
			volatile unsigned long JL			:2;
			volatile unsigned long NC			:10;
		} B;
		volatile unsigned long W;
	} JSQR;
	union
	{
		struct
		{
			volatile unsigned long JDATA		:16;
			volatile unsigned long NC			:16;
		} B;
		volatile unsigned long W;
	} JDR1;
	union
	{
		struct
		{
			volatile unsigned long JDATA		:16;
			volatile unsigned long NC			:16;
		} B;
		volatile unsigned long W;
	} JDR2;
	union
	{
		struct
		{
			volatile unsigned long JDATA		:16;
			volatile unsigned long NC			:16;
		} B;
		volatile unsigned long W;
	} JDR3;
	union
	{
		struct
		{
			volatile unsigned long JDATA		:16;
			volatile unsigned long NC			:16;
		} B;
		volatile unsigned long W;
	} JDR4;
	union
	{
		struct
		{
			volatile unsigned long DATA		:16;
			volatile unsigned long ADC2DATA	:16;
		} B;
		volatile unsigned long W;
	} DR;
} ADC_T;

/*------------------------ Backup Registers ----------------------------------*/
typedef struct
{
	unsigned long  RESERVED0;
	volatile unsigned short DR1;
	unsigned short  RESERVED1;
	volatile unsigned short DR2;
	unsigned short  RESERVED2;
	volatile unsigned short DR3;
	unsigned short  RESERVED3;
	volatile unsigned short DR4;
	unsigned short  RESERVED4;
	volatile unsigned short DR5;
	unsigned short  RESERVED5;
	volatile unsigned short DR6;
	unsigned short  RESERVED6;
	volatile unsigned short DR7;
	unsigned short  RESERVED7;
	volatile unsigned short DR8;
	unsigned short  RESERVED8;
	volatile unsigned short DR9;
	unsigned short  RESERVED9;
	volatile unsigned short DR10;
	unsigned short  RESERVED10;
	union
	{
		struct
		{
			volatile unsigned short CAL		:7;
			volatile unsigned short CCO		:1;
			volatile unsigned short ASOE		:1;
			volatile unsigned short ASOS		:1;
			volatile unsigned short NC			:6;
		} B;
		volatile unsigned short W;
	} RTCCR;
	unsigned short  RESERVED11;
	union
	{
		struct
		{
			volatile unsigned short TPE		:1;
			volatile unsigned short TPAL		:1;
			volatile unsigned short NC			:14;
		} B;
		volatile unsigned short W;
	} CR;
	unsigned short  RESERVED12;
	union
	{
		struct
		{
			volatile unsigned short CTE		:1;
			volatile unsigned short CTI		:1;
			volatile unsigned short TPIE		:1;
			volatile unsigned short NC1		:5;
			volatile unsigned short TEF		:1;
			volatile unsigned short TIF		:1;
			volatile unsigned short NC			:6;
		} B;
		volatile unsigned short W;
	} CSR;

	unsigned short  RESERVED13[5];
	volatile unsigned short DR11;
	unsigned short  RESERVED14;
	volatile unsigned short DR12;
	unsigned short  RESERVED15;
	volatile unsigned short DR13;
	unsigned short  RESERVED16;
	volatile unsigned short DR14;
	unsigned short  RESERVED17;
	volatile unsigned short DR15;
	unsigned short  RESERVED18;
	volatile unsigned short DR16;
	unsigned short  RESERVED19;
	volatile unsigned short DR17;
	unsigned short  RESERVED20;
	volatile unsigned short DR18;
	unsigned short  RESERVED21;
	volatile unsigned short DR19;
	unsigned short  RESERVED22;
	volatile unsigned short DR20;
	unsigned short  RESERVED23;
	volatile unsigned short DR21;
	unsigned short  RESERVED24;
	volatile unsigned short DR22;
	unsigned short  RESERVED25;
	volatile unsigned short DR23;
	unsigned short  RESERVED26;
	volatile unsigned short DR24;
	unsigned short  RESERVED27;
	volatile unsigned short DR25;
	unsigned short  RESERVED28;
	volatile unsigned short DR26;
	unsigned short  RESERVED29;
	volatile unsigned short DR27;
	unsigned short  RESERVED30;
	volatile unsigned short DR28;
	unsigned short  RESERVED31;
	volatile unsigned short DR29;
	unsigned short  RESERVED32;
	volatile unsigned short DR30;
	unsigned short  RESERVED33; 
	volatile unsigned short DR31;
	unsigned short  RESERVED34;
	volatile unsigned short DR32;
	unsigned short  RESERVED35;
	volatile unsigned short DR33;
	unsigned short  RESERVED36;
	volatile unsigned short DR34;
	unsigned short  RESERVED37;
	volatile unsigned short DR35;
	unsigned short  RESERVED38;
	volatile unsigned short DR36;
	unsigned short  RESERVED39;
	volatile unsigned short DR37;
	unsigned short  RESERVED40;
	volatile unsigned short DR38;
	unsigned short  RESERVED41;
	volatile unsigned short DR39;
	unsigned short  RESERVED42;
	volatile unsigned short DR40;
	unsigned short  RESERVED43;
	volatile unsigned short DR41;
	unsigned short  RESERVED44;
	volatile unsigned short DR42;
	unsigned short  RESERVED45;    
} BKP_T;

/*------------------------ Controller Area Network ---------------------------*/
typedef struct
{
	union
	{
		struct
		{
			volatile unsigned long TXRQ		:1;
			volatile unsigned long RTR		:1;
			volatile unsigned long IDE		:1;
			volatile unsigned long EXID		:29;
		} BExt;
		struct
		{
			volatile unsigned long TXRQ		:1;
			volatile unsigned long RTR		:1;
			volatile unsigned long IDE		:1;
			volatile unsigned long NC			:18;
			volatile unsigned long STID		:11;
		} B;
		volatile unsigned long W;
	} TIR;
	union
	{
		struct
		{
			volatile unsigned long DLC		:4;
			volatile unsigned long NC1		:4;
			volatile unsigned long TGT		:1;
			volatile unsigned long NC			:7;
			volatile unsigned long TIME		:16;
		} B;
		volatile unsigned long W;
	} TDTR;
	union
	{
		struct
		{
			volatile unsigned long DATA0		:8;
			volatile unsigned long DATA1		:8;
			volatile unsigned long DATA2		:8;
			volatile unsigned long DATA3		:8;
		} B;
		volatile unsigned long W;
	} TDLR;
	union
	{
		struct
		{
			volatile unsigned long DATA4		:8;
			volatile unsigned long DATA5		:8;
			volatile unsigned long DATA6		:8;
			volatile unsigned long DATA7		:8;
		} B;
		volatile unsigned long W;

⌨️ 快捷键说明

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