Topic : doubt about cycle machine STM8

Forum : ST7/STM8

Original Post
Post Information Post
May 27, 2015 - 11:07am
Guest account

I am starting to study the STM8 microcontroller and Ride7 compiler.

I made a simple program:

-----------------------------------

#include "stm8s005k6.h"

unsigned int    conta;

main()
{
   
    CLK_CKDIVR = 0b00000100;
   
    PD_DDR=0B00001000;
    PD_CR1=0B00001000;
    PD_CR2=0B00001000;
    PD_ODR=0B00001000;
   
    PD_ODR=0B00000000;
   
        PD_ODR=0B00001000;
   
        PD_ODR=0B00000000;
   
        PD_ODR=0B00001000;

        PD_ODR=0B00000000;

   

    while(1){};

}
--------------------

the clock is adjusted for 1MHz, so, 1 us per cycle.

i toggle a pin to test, Port3.

whe the pin goes to 0, i see in the scope 1us, it´s ok.

but when the pins goes to 1, i see 2us instead of 1us.... why this happens?

the assembly shows me a mov instruction, wich has a one cycle duration.