Question: In this question data received by UART 0 will be processed by an Interrupt Service Routine. a ) Write the serial _ init ( )
In this question data received by UART will be processed by an Interrupt Service Routine.
a Write the serialinit function to initialize UART as follows:
Receive Only
baud rate
data bits
Even parity
stop bit
Disable FIFOs
Enable UART Receive interrupts only
You may initialize unrelated control bits as you wish.
Initialize UART
void serialinit
Binds UART interrupt requests to MyUARTRXHandler
IntRegisterINTUART MyUARTHandler;
IntMasterEnable;Globally allows CPU to service interrupts
b Write code for MyUARTHandler to implement the Interrupt Service Routine ISR that processes the occurrence of a UART received data interrupt. In addition, within this ISR turn on an LED connected to GPIO Port B pin when an Lfor Light is received by UART by writing a to the LED, and turn off this LED when an Ofor Off is received by writing a to the LED.
UART ISR
void MyUARTHandler
c Complete main to print LED turned ON and LED turned OFF once each time the LED is turned on or off respectively.
void MyUARTHandler;
void serialinitvoid;
volatile int flag ; Helper variable
int main
initportB; Assume implemented correctly in Question
serialinit;
while
Print each time the LED is turned ON or OFF
Hint: make use the helper variable flag declared above.
YOUR CODE HERE
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
