Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- const byte rxPin = 9;
- const byte txPin = 8;
- //Please describe how you test the implementation of the software emulated UART protocol in the comments of the your code.
- void uart_software_init(){
- //Configure the USART peripheral to operate at 9600 bit/s baud, with 8 bit characters, one start bit and one stop bit, and no parity bits.
- SoftwareSerial mySerial (rxPin, txPin); // set up a new serial object
- mySerial.begin(9600); //9600 bit/s baud
- }
- void uart_software_tx_byte(uint8_t data){
- mySerial.write(data); // send byte of data
- }
- uint8_t uart_software_rx_byte(){
- //Receive the specified byte called data over the UART bus. This function will complete when one byte has been fully received.
- return = mySerial.read();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement