2011-05-17 01:56 AM
I would like to check pwm signal but it don't find any signal help me please
#include ''stm8s.h'' void main(void) { CLK->SWR = 0xB4 ; while((CLK->SWCR&0x08) == 0){}; CLK->SWCR&=0xF7; CLK->SWCR |= 0x02 ; CLK->CMSR = 0xB4 ; //CLK->ECKR |= CLK_ECKR_HSEEN ; //CLK->ICKR = 0x03 ; CLK->CKDIVR = 0x00 ; CLK->PCKENR1 = 0x80 ; CLK->PCKENR2 = 0x08 ; CLK->CCOR = 0x33 ; TIM1->CR1 = 0x80 ; TIM1->CR2 = 0x10 ; TIM1->ARRH = 0x0a ; //(Fclk/Fs)(16M/10K=1.6K) TIM1->ARRL = 0x40 ; TIM1->PSCRH = 0x00 ; // clk = 16M/(0+1) TIM1->PSCRL = 0x00 ; TIM1->IER = 0x00 ; TIM1->BKR = 0x00 ; TIM1->SR1 = 0x1b ; TIM1->CCER1 = 0x05 ; TIM1->CCER2 = 0x3f ; TIM1->CCMR1 = 0x38 ; TIM1->CCMR2 = 0xfa ; TIM1->CCR1H = 0x05; // compare 800 TIM1->CCR1L= 0x20 ; // compare 800 GPIOC->DDR = 0x0f; GPIOC->CR1 = 0x0f; GPIOC->CR2 = 0x00; while (1){ GPIOC->ODR = 0x0f; // 0000 1111 } }2011-05-17 04:11 AM