ATY_LIB
V2_102_230218
ATY_LIB for general devices or ALGO
Loading...
Searching...
No Matches
uart1_timer1_tx.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
17
extern
__CODE
uint16_t
ticks_ms
;
18
extern
__CODE
uint8_t
ticks_us
;
19
20
void
main
(
void
)
21
{
22
SYS_SetClock
();
23
// UART1, baud 115200, baud source Timer1, 1T mode, no interrupt
24
UART1_Config8bitUart
(
UART1_BaudSource_Timer1
,
HAL_State_ON
, 115200);
25
while
(1)
26
{
27
UART1_TxString
(
"ms ticks:0x"
);
28
UART1_TxHex
(
ticks_ms
>> 8);
29
UART1_TxHex
(
ticks_ms
& 0xFF);
30
UART1_TxString
(
" us ticks:0x"
);
31
UART1_TxHex
(
ticks_us
);
32
UART1_TxString
(
" clock div:0x"
);
33
UART1_TxHex
(
__CONF_CLKDIV
);
34
UART1_TxString
(
" string\r\n"
);
35
SYS_Delay
(1000);
36
}
37
}
__CONF_CLKDIV
#define __CONF_CLKDIV
Definition:
fw_conf.h:78
fw_hal.h
SYS_SetClock
void SYS_SetClock(void)
Definition:
fw_sys.c:40
SYS_Delay
void SYS_Delay(uint16_t t)
Definition:
fw_sys.c:65
uint16_t
unsigned short uint16_t
Definition:
fw_types.h:19
HAL_State_ON
@ HAL_State_ON
Definition:
fw_types.h:71
uint8_t
unsigned char uint8_t
Definition:
fw_types.h:18
UART1_TxString
void UART1_TxString(uint8_t *str)
Definition:
fw_uart.c:85
UART1_BaudSource_Timer1
@ UART1_BaudSource_Timer1
Definition:
fw_uart.h:33
UART1_TxHex
void UART1_TxHex(uint8_t hex)
Definition:
fw_uart.c:79
UART1_Config8bitUart
void UART1_Config8bitUart(UART1_BaudSource_t baudSource, HAL_State_t _1TMode, uint32_t baudrate)
Definition:
fw_uart.c:56
ticks_us
__CODE uint8_t ticks_us
Definition:
fw_sys.c:31
main
void main(void)
Definition:
uart1_timer1_tx.c:20
ticks_ms
__CODE uint16_t ticks_ms
Definition:
fw_sys.c:30
ATY_LIB
FwLib_STC8
demo
uart
uart1_timer1_tx.c
Generated by
1.9.6