Hi All, I am new to STM8S and not yet that good at microcontroller programming in general. I am trying to learn about timers/counters in microcontrollers. I wrote following code to toggle an LED connected at PD1 pin in each second.
#include <stdint.h>#include<iostm8s.h>void main(void){ TIM2_PSCR = 0b00000111; TIM2_EGR= 0x01; TIM1_CR1 = 0x01; PD_DDR = 0x01; PD_CR1 = 0x01; while(1) { if ( ( ((uint16_t)TIM2_CNTRH << 8) + (uint16_t)TIM2_CNTRL ) >= 15625 ) { TIM2_...