Beginner STM8, first follow the online tutorial set up a IAR project, and then download an official firmware library, made a case template, the function is super simple, is a LED light flashing, main function on this point content:
void main (void)
{/
* Initialize I/Os in Output Mode *
/Gpio_init (Led_gpio_port, (gpio_pin_typedef) Led_gpio _pins, gpio_mode_out_pp_low_fast);
while (1)
{/
* Toggles LEDs */
Gpio_writereverse (Led_gpio_port, (gpio_pin_typedef) led_gpio_pins);
Delay (20000);
}
}
Directly connected to the STM8 core Small board on the merry run up ... Wait a minute. Was not what was missing.
Why I do not configure the clock, STM8 chip can also run.
Compared to the STC 51 microcontroller, um, may be the configuration bit problem, I will first look at the configuration bit:
These configuration bits associated with the clock configuration are not configured with the internal RC oscillator.
No way, only to see the stm8s103 chip documentation ... Or official information, the reason is here:
Even if the chip does not set the clock, will also run an internal clock 8-way 2M default clock, unlike STM32, the configuration of the Gpio port is no longer dependent on other clocks, so the program can be based on this 2M clock to the IO port flashing, The best way to solve the problem is to read the manual (if the manual is okay).