//TIM CONFIG
//TIM1_CH4(PD7) PPM Capature
//TIM1_CCMR4_bit.CC4S = 1; //TI4FP4
//TIM1_CCMR4_bit.IC4F = 3; //N = 8
//TIM1_CCMR4_bit.IC1PSC = 0; //No prescaler
TIM1_CCMR4 = 0x31;
TIM1_CCER2 = 0x10; //Rising edge
TIM1_SMCR_bit.SMS = 0;
TIM1_PSCRL = 15;
TIM1_PSCRH = 0;
TIM1_CR1_bit.DIR = 0;
TIM1_ARRH = 0xFF;
TIM1_ARRL = 0xFF;
TIM1_CR1_bit.UDIS = 1;
TIM1_CR1_bit.CEN = 1;
TIM1_IER_bit.CC4IE = 0; //Enable Capature 4 Interrupt
while(!TIM1_SR1_bit.CC4IF);
TIM1_SR1_bit.CC4IF = 1;
cur_icr = TIM1_CCR4H<<8;
cur_icr |= TIM1_CCR4L;
死活得不到我想要的结果,哎,
//OSC CONFIG
CLK_SWCR_bit.SWEN = 1;
CLK_SWR = 0xB4;
while(!CLK_SWCR_bit.SWIF);
CLK_SWCR_bit.SWIF = 0;
CLK_SWCR_bit.SWEN = 0;
受STM8价格的诱惑,选择了它,真的好无语,手册看得非常不习惯! 香版主有什么建议? |