Reference no: EM131090151
The objective is to build the serial port transmit function using output compare (i.e., the signal is attached to PT0, not Port S). Assume the baud rate is 9600 bits/sec, resulting in a bit time of 104 μs. Similar to SCI, the protocol is one start, eight data, no parity, and one stop bit. Make the TTL level serial output on PT0. You may use the FIFO functions in Program 4.14 without showing their implementations. There will be no error flags. Your solution will include an output function Serial_OutChar, which operates similar to SCI_OutChar in Program 7.1. It is a requirement that your output compare interrupt handler transmits the one start, eight data, one stop bit frame without executing any blind waits or backward jumps.
a) Carefully draw the output signal when the ASCII character ‘5'is transmitted. Draw the signal to scale. Assume the TCNT value is 1000 (decimal) when the first 1 to 0 transition occurs. Give the TCNT value for each transition of the output signal. Place arrows (↑) on the drawing exactly when each OC0 interrupt will occur, giving the TCNT value at each interrupt.
b) Define any private global variables you need.
c) Show the ritual that initializes variables and output compare.
d) Show the OC0 interrupt handler.
e) Show the Serial_OutChar function with which the user can transmit data.
Program 4.14
![2431_abaa40ce-d345-4bda-8411-7a875931e04a.png](https://secure.expertsmind.com/CMSImages/2431_abaa40ce-d345-4bda-8411-7a875931e04a.png)
![2375_dee73804-4fd5-4970-8d78-fb02ce221acb.png](https://secure.expertsmind.com/CMSImages/2375_dee73804-4fd5-4970-8d78-fb02ce221acb.png)