$24
1. Temperature detection and alarm system (80% in total)
In this assignment, you are supposed to complete a temperature detection and alarm system which could show temperature periodly and trigger alarm devices as long as the temperature exceeds the specified threshold.
Use a timer interrupt as the triggered source, it will trigger an update interrupt every 5 seconds, and then ADC1 will convert analog value to digital value in timer’s interrupt callback function, and finally a string indicating the temperature value will be shown on LCD screen(20%). If you use delay function rather than timer interrupt to achieve 5-second timing, you will lose 10% score of this project.
Enable ADC analog watchdog and set a high threshold, if the analog value is above the threshold, an ADC interrupt will be triggered to alarm the user. You can print an alarm information string on LCD screen(30%) and show a specified picture on LCD screen(30%) to attract attention.
2. Tips
(1) To get the value of temperature sensor, we should take use of Temperature Sensor Channel of ADC1.
(2) The AWD analog watchdog status bit is set if the analog value converted by the ADC is below a low threshold or above a high threshold. That is to say, if we enable ADC interrupt, it will occur when analog value is higher than high threshold or lower than low threshold.
Fig.2 Analog watchdog guarded area
Enable watchdog and set an appropriate thresholds for ADC, choose temperature sensor channel as analog watchdog channel, and do not forget to enable interrupt mode to handle with the alarm information when the analog value is above the threshold.
(3) Function HAL_ADC_LevelOutOfWindowCallback( ) will be called when ADC watchdog enables an interrupt.
(4) The relationship between the voltage and temperature is:
(5) As we have no idea about how to show a picture file, we can store the picture in ASCII Character set as two-dimensional array in font.h file. And you can use PCtoLCD2002 or other tools to generate the two-dimensional array, and PCtoLCD2002 is already in Sakai site.
(6) If you can not enter interrupt callback functions, check NVIC to confirm that you have enabled the interrupts.
3. Report (20% in total)
Complete the document “CS301-2021FALL-lab-ass2-report-SID-NAME”.
4. Submission demands
(1) Finish the assignment before DDL.
(2) Package the whole project into a compressed package and submit on Sakai site.
(3) Rename your report as “CS301-2021FALL-lab-ass2-report-SID-NAME.pdf” and submit on Sakai site.