ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
Loading...
Searching...
No Matches
avr
arduino_uno_char_loopback.c
1
#include "
asc_helpers.h
"
2
#include "
avr/avr_uart.h
"
3
#include <avr/io.h>
4
5
#define F_CPU 16000000L
6
#include <util/delay.h>
7
#define FOSC 16000000L
8
//#define BAUD 9600
9
#define BAUD 19200
10
#define MYUBRR (FOSC / 16 / BAUD - 1)
11
#define UART_NO 0
12
13
uint8_t byteBuffer;
14
15
int
main(
void
) {
16
17
UART_Init
(UART_NO, MYUBRR, 0);
18
19
while
(1) {
20
uart_rx_blocking
(UART_NO, byteBuffer);
21
//_delay_ms(100);
22
uart_tx_blocking
(UART_NO, byteBuffer);
23
}
24
return
0;
25
}
asc_helpers.h
uart_rx_blocking
#define uart_rx_blocking(uart_no, _tmp_byte)
Definition
asc_helpers.h:107
uart_tx_blocking
#define uart_tx_blocking(uart_no, _tmp_byte)
Definition
asc_helpers.h:148
avr_uart.h
UART_Init
#define UART_Init(uart_no, ubrr, rxIntEnable)
Initialize USART.
Definition
avr_uart.h:20
Generated by
1.10.0