AnsweredAssumed Answered

Standard bliniking program not working? STM8S103F3P6

Question asked by gustamko.master on Mar 30, 2016
Hello forum,

i am trying to get a standard linking led program running on my STM8S103F3P6 development board but i am not sure what i am doing wrong. I connected a LED to PIN D3, this is my code:

#include <stm8s.h>
 
void delay_ms(uint16_t ms);
void delay_ms(uint16_t ms){
    while(ms--){
        uint16_t i;
        for(i = 0; i < ms; i++){
            nop();
        }
    }
}
  
main()
{
    GPIOD->DDR|=0x03; //PD3 as Output
    GPIOD->CR1|=0x03; //PD3 as Push Pull
    while(1){
        GPIOD->ODR|=(1<<3);//turn PD3 on
        delay_ms(1000);
        GPIOD->ODR&=~(1<<3);//turn PD3 off
        delay_ms(1000);
    }
}

Outcomes