Application of TIME4 Register in STM8

Source: Internet
Author: User
After the STM8 system is reset, all peripheral clocks are in the open state. The user can clear the CLK_PCKENR1 or
The Pcken bit in the CLK_PCKENR2 to turn off the corresponding peripheral is the clock.


Clock Divider Register (CLK_CKDIVR)


If a PIN has only the output capacity of the level, it is said that the PIN is an output pin or drive pin;
If a PIN has the input capability of the level, the pin is said to be an input pin.
Pins with both input and output capabilities are known as general-purpose pins.


The current that is formed when the pin output is high is called the pull current;
The current that is formed when the pin output is low is called the sink current;


Basic type Timer (TIM4/TIM6)

TIME4 can be used as a time-base generator
@inline static void Tick_init (void)
{
TIM4->PSCR = tim4_prescaler_128;//07 Prescaler Register
Tim4->arr = (U8) ((sys_clk/128)/HZ-1);//Auto Reload Register
Tim4->ier |= tim4_it_update;//01 Enable register update interrupt Enable
TIM4->CR1 |= Tim4_cr1_cen; 01 Control Register 1
}
The 3-bit programmable pre-splitter provides 8 crossover ratios of 1, 2, 4, 16, 32, 64, 128, and 8.
The timer consists of a programmable prescaler and a 8-bit upward counter that can be automatically overloaded with overflow interrupt function.


The clock of the timer is the internal clock.


Prescaler is a 7-bit counter that is controlled by a 3-bit register (in the TIMX_PSCR register).

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.