Why can IAR for STM8 not configure the clock?

Source: Internet
Author: User

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).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.