2023-01-14 06:51:49 +00:00
|
|
|
# AVR_ATMEGA_USART
|
2023-01-14 19:19:21 +00:00
|
|
|
---
|
2023-01-14 06:59:09 +00:00
|
|
|
## Description:
|
|
|
|
|
2023-01-14 19:19:21 +00:00
|
|
|
This is a asynchronous serial program for the ATMEGA seiries of mcu. The sotfware
|
2023-01-14 06:59:09 +00:00
|
|
|
is tested and working.
|
|
|
|
|
2023-01-14 19:19:21 +00:00
|
|
|
Over time, I'm planning to add support for multiple AVR MCUs, however that
|
|
|
|
may end up requiring more memory, so extensive of use of define macros will
|
|
|
|
likely end up being the end result.
|
|
|
|
|
|
|
|
## Features:
|
|
|
|
|
|
|
|
- Multiple Baud Rates: 300, 600, 1200, 2400, 9600 ...
|
|
|
|
- Asynchronous Receive and Transmit.
|
|
|
|
- Optional Parity checking.
|
|
|
|
- 7-8 data bits.
|
|
|
|
- Hardware abstraction API
|
|
|
|
- No Interrupt service routines required.
|
|
|
|
- BSD-3 Licensing, aka you can use this for whatevery you want pretty much.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
|
|
|
|
|
|
|
### Example 1
|
|
|
|
|
|
|
|
```C
|
|
|
|
#include "avr_usart.h"
|
|
|
|
|
|
|
|
void send_bt_cmd(char* cmd) {
|
|
|
|
init_usart();
|
|
|
|
unsigned char data[] = "AT+WAKE\0";
|
|
|
|
uint8_t result = usart_send_str(data);
|
|
|
|
|
|
|
|
if(result) {
|
|
|
|
raise_error();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2023-01-14 06:59:09 +00:00
|
|
|
|
|
|
|
## ISSUES:
|
|
|
|
|
|
|
|
It's required to set the fuses in the chip for 8Mhz, otherwise a baud rate
|
|
|
|
of 9600 will result in errors at a 7% rate.
|
|
|
|
|
2023-01-14 19:19:21 +00:00
|
|
|
Another is that I need to design a standard naming scheme.
|
2023-01-14 06:51:49 +00:00
|
|
|
|