STM32 使用TIM3的通道3、4输出PWM信号(纯寄存器操作)
STM32 使用TIM3的通道3、4输出PWM信号(纯寄存器操作)
#define GPIOB_CRL *((unsigned int *)0x40010c00) //寄存器CRL地址
#define GPIOB_CRH *((unsigned int *)0x40010c04)
#define GPIOB_ODR *((unsigned int *)0x40010c0c)
#define GPIOB_BSRR *((unsigned int *)0x40010C10)
#define GPIOB_BRR *((unsigned int *)0x40010C14)
#define RCC_APB2ENR *((unsigned int *)0x40021018)
#define RCC_APB1ENR *((unsigned int *)0x4002101C)
#define RCC_CFGR2 *((unsigned int *)0x4002102C)
#define RCC_CFGR *((unsigned int *)0x40021004)
#define RCC_CR *((unsigned int *)0x40021000)
#define SETENAB_0_31 *((unsigned int *)0xE000E100) //NVIC寄存器配置 中断号0-31使能寄存器 每一位对应一个中断
#define SETENAB_32_63 *((unsigned int *)0xE000E104)
#define TIM3 ((Universal_TIM_TypeDef *) 0x40000400) //通用定时器3地址
typedef struct
typedef struct
{
unsigned int CR1; //控制寄存器
unsigned int CR2; //控制寄存器
unsigned int SMCR;
unsigned int DIER; //DMA/中断允许
unsigned int SR;