ATY_LIB V2_102_230218
ATY_LIB for general devices or ALGO
 
Loading...
Searching...
No Matches
timer0_timer_1t.c
Go to the documentation of this file.
1// Copyright 2021 IOsetting <iosetting(at)outlook.com>
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include "fw_hal.h"
16
17static uint16_t counter = 0;
18
19INTERRUPT(Timer0_Routine, EXTI_VectTimer0)
20{
21 counter++;
22 if (counter == 1000)
23 {
24 counter = 0;
25 UART1_TxString("hello\r\n");
26 }
27}
28
29void main(void)
30{
31 // Set system clock. Remove this line if system clock is already set by STC-ISP
33 // UART1 configuration: baud 115200 with Timer1, 1T mode, no interrupt
40 while(1);
41}
#define EXTI_Timer0_SetIntPriority(__PRIORITY__)
Definition: fw_exti.h:214
@ EXTI_IntPriority_High
Definition: fw_exti.h:25
#define EXTI_Timer0_SetIntState(__STATE__)
Definition: fw_exti.h:116
#define EXTI_Global_SetIntState(__STATE__)
Definition: fw_exti.h:115
#define EXTI_VectTimer0
Definition: fw_exti.h:38
void SYS_SetClock(void)
Definition: fw_sys.c:40
@ TIM_TimerMode_16BitAuto
Definition: fw_tim.h:24
void TIM_Timer0_Config(HAL_State_t freq1t, TIM_TimerMode_t mode, uint16_t frequency)
Definition: fw_tim.c:38
#define TIM_Timer0_SetRunState(__STATE__)
Definition: fw_tim.h:35
unsigned short uint16_t
Definition: fw_types.h:19
@ HAL_State_ON
Definition: fw_types.h:71
void UART1_TxString(uint8_t *str)
Definition: fw_uart.c:85
@ UART1_BaudSource_Timer1
Definition: fw_uart.h:33
void UART1_Config8bitUart(UART1_BaudSource_t baudSource, HAL_State_t _1TMode, uint32_t baudrate)
Definition: fw_uart.c:56
INTERRUPT(Timer0_Routine, EXTI_VectTimer0)
void main(void)
static uint16_t counter