$24
Objective:
This lab will start with the Arduino sketch code contained in Echo2C.txt. You will write three new functions and using the lecture notes make sure you understand the fourth U0init(ubaud). At this point in the course you will be using the serial port in "polled" mode and not using interrupts.
U0init(int ubaud) – will initialize the serial port. (You are expected to fully understand what this function does and be able to initialize the USART in different modes.)
U0kbhit(void) – will examine the RDA status bit and return a true (non-zero value) if RDA is true otherwise it will return a false (0 value) in ACC
U0getchar(void) – will read one character from the serial port and return it.
U0putchar(unsigned char U0pdata) – will wait until the serial port TBE status bit is high and then will take the character U0pdata and send the character out to the serial port.
Procedure:
Write, compile, download to the Arduino SBC and test the keyboard program starting with the Echo2C.txt file with the added code you write for the three functions described above.
Copy your tested and working Echo2.ino text to a new sketch Echo3C.ino with the following changes. For each key pressed the program will send back two ASCII characters (instead of the input character itself as in Exho2C.ino) which will print on the terminal the hexadecimal value of the ASCII code for the key pressed. For example, if you press the "1" key the program will send back ASCII 33H followed by ASCII 31H and what will be displayed will be 31 which is the hexadecimal value for the ASCII value for a "1". If you press the "A" key then the program will send back 34H & 31H because the hexadecimal value for ASCII "A" is 41H.
After the number for the ASCII value of the key pressed is sent, send a space for which the ASCII code is 20H.
NOTE: ALL programs written for this course need to be documented in a complete manner which will make sense to you if you need to go back and review the program a year or two from now. You need to include your NAME and a revision number on ALL programs as well.