AnsweredAssumed Answered

Clock x ports doubts

Question asked by marcelo on Nov 19, 2014
Latest reply on Mar 10, 2015 by Ian Legg
Hello

i´m new in STM8s105 microcontroller and cosmic c compiler.

i wrote a small program:

i set the clock with internall clock with prescaler 8:

CLK_CKDIVR= 0b00011000;

it means that my uc will operate at 2 MHz, right?

i set the port D3 as output pin, push pull fast:

     PD_DDR=0B00001000;
     PD_CR1=0B00001000;
     PD_CR2=0B00001000;
     PD_ODR=0B00000000;

in the main, i wrote this code:

main()
{
     




               
               PD_ODR=0B00000000;
               PD_ODR=0B00001000;
               PD_ODR=0B00000000;
               PD_ODR=0B00001000;
               PD_ODR=0B00000000;
               PD_ODR=0B00001000;
               PD_ODR=0B00000000;
               PD_ODR=0B00001000;
               
          for (;;) {}
}

in my mind, if i set the port, it will in high level for 500ns, turn off for 500ms and so on... but in the scope i see times of 1us.

what i do wrong?

thanks a o lot!

Outcomes