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_write_message_to_serial.c
1
#include "
asc_helpers.h
"
2
#include "
avr/avr_uart.h
"
3
#include <avr/io.h>
4
5
#define FOSC 16000000L
6
#define BAUD 9600
7
#define MYUBRR (FOSC / 16 / BAUD - 1)
8
#define UART_NO 0
9
10
#define bufCap 64
11
12
static
const
char
message[] =
">00s0 0 0 0.DE10\n"
;
13
static
const
uint8_t message_len = 17;
14
uint8_t iChar = 0;
15
16
int
main(
void
) {
17
18
UART_Init
(UART_NO, MYUBRR, 0);
19
20
while
(1) {
21
uart_tx_blocking
(UART_NO, message[iChar]);
22
iChar++;
23
if
(iChar == message_len) {
24
iChar = 0;
25
}
26
}
27
return
0;
28
}
asc_helpers.h
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