Advertisement
Guest User

uart_software_arduino_libraries

a guest
Oct 27th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <SoftwareSerial.h>
  2.  
  3. const byte rxPin = 9;
  4. const byte txPin = 8;
  5.  
  6. //Please describe how you test the implementation of the software emulated UART protocol in the comments of the your code.
  7.  
  8. void uart_software_init(){
  9. //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.
  10. SoftwareSerial mySerial (rxPin, txPin); // set up a new serial object
  11. mySerial.begin(9600); //9600 bit/s baud
  12. }
  13.  
  14. void uart_software_tx_byte(uint8_t data){
  15. mySerial.write(data); // send byte of data
  16. }
  17.  
  18. uint8_t uart_software_rx_byte(){
  19. //Receive the specified byte called data over the UART bus. This function will complete when one byte has been fully received.
  20. return = mySerial.read();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement