STC15W408AS library 0.9.0
uart.h
Go to the documentation of this file.
1#pragma once
2
9#include <sys.h>
10#include <stdint.h>
11#include <timer2_mode0.h>
12#include <timer2_to_ms.h>
13
24#define uart1_init(uart_baudrate) \
25{ \
26 SCON = 0x50; /* Set Mode1: 8-Bit UART with Variable Baud Rate */ \
27 timer2_mode0_reload(timer2_mode0_baudrate_to_ticks(uart_baudrate)); \
28 AUXR &= 0xE2; \
29 AUXR |= 0x15; \
30}
31
39void uart1_send_byte(uint8_t data);
40
51uint8_t uart1_receive_byte();
52
63int putchar(int ch);
64
73int getchar(void);
int putchar(int ch)
Send character to UART1.
Definition: uart.c:17
int getchar(void)
Receive character from UART1.
Definition: uart.c:23
uint8_t uart1_receive_byte()
Receive byte from UART1.
Definition: uart.c:10
void uart1_send_byte(uint8_t data)
Definition: uart.c:3