This homework assignment is to demonstrate your understading of USART, Blocking vs Non-Blocking and Interrupt Handling
Reference: Nucleo Reference Manual (Pages 1339-1344)
a. Download demo-non-blocking.c
b. Rename it to demo.c
c. Copy new demo.c to FirstTimer Project (replacing existing demo.c file)
Recommendation: Make a copy of your previous assignment as your starting point for this assignment.
Steps for Non-Blocking:
Step 1: Modify UART.c by making a copy of the USART_Read function to USART_Read_Nonblocking.
Hint: In the nonblocking version change the while to an if statement. If no character is available immediately return 0.
Step 2: Modify UART.h to add the new nonblocking function prototype.
Steps for Interrupt Handling:
Step 1: Add a void SysTick_Handler() function to demo.c code from the previous assignment.
Step 2: Add a static volatile global uint8_t variable called one_second_elapsed
Step 3: Inside the handler function:
(a) have a static uint32_t counter that counts up to 1000
(b) then sets the one_second_elapsed variable to true when it gets to 1000
(c) then reset this counter to 0 (or use equivalent code)
Step 4: Change your systick initialization code to enable the interrupt bit. Ensure that reload value is set for 1ms timer!
Step 5: Change your main while loop inside the demo function by first removing the call to the delay_systick function. Replace that by checking for one_second_elapsed is true. If true toggle the LED and set one_second elapsed to false.
Submit your updated UART.c, UART.h, and demo.c to the Non-blocking and Interrupt assignment folder. Do not put in a zip file.
To receive full credit, Code must compile and run as expected without any warnings!
User must be able to type any key in Putty window while LED is blinking at 1 sec interval
Warnings - 0.5 point will be deducted for each warningCompile Error - You may not get any points in case your code doesn't compile and run
Late Submission - 5% penalty per day will be applied