An HCS12 microcontroller is being used to control a coffee maker. One of the tas
ID: 3349658 • Letter: A
Question
An HCS12 microcontroller is being used to control a coffee maker. One of the tasks it must perform is periodically monitor and record the maximum temperature of the hotplate in a memory location labeled HOTT. A digital temperature sensor is connected to Port A. The temperature sensor outputs an unsigned 8-bit word which is the temperature of the hotplate in degrees Celsius.
(a) Write an interrupt service routine for the real-time interrupt (RTI) that checks the temperature of the hotplate and updates HOTT if necessary.
(b) Write a main program to initialize HOTT to zero, set up Port A for input and then set up the RTI to perform its check every 100ms (approx.). Once the interrupts have been set up, the main program should branch to a coffee making control program (that somebody else wrote) located at location CMC. Assume the crystal oscillator clock is running at 4MHz.
You can assume the following labels have already been set in your program:
PORTA: EQU $00 ; Port A Data
DDRA: EQU $02 ; Port A Direction Register
CRGFLG: EQU $37 ; CRG Flag Register
CRGINT: EQU $38 ; CRG Interrupt Register
RTICTL: EQU $3B ; RTI Control Register
UserRTI: EQU $3FF0 ; RTI entry in Interrupt Vector Table
HOTT: EQU $6000 ; Maximum temperature variable
CMC: EQU $7000 ; Address of coffee making program
******ASSEMBLY LANGUAGE*****
Explanation / Answer
Coffeemakers are cooking appliances used to brew coffee. While there are many different types of coffeemakers using a number of different brewing principles, in the most common devices, coffee grounds are placed in a paper or metal filter inside a funnel, which is set over a glass or ceramic coffee pot, a cooking pot in the kettle family. Cold water is poured into a separate chamber, which is then heated up to the boiling point, and directed into the funnel. This is also called automatic drip-brew.
a.ISR is also called device driver in case of the devices and called exception or signal or trap handler in case of software interrupts.
Processor executes the program, called interrupt service routine or signal handler or trap handler or exception handler or device driver, related to input or output from the port or device or related to a device function on an interrupt and does not wait and look for the input ready or output completion or device-status ready or set
When software run-time exception condition (for examples, division by 0 or overflow or illegal opcode detected) the processor-hardware generates an interrupt, called trap, which calls an ISR When software run-time exception condition defined in a program occurs, then a software instruction (SWI) is executed? called software interrupt or exception or signal, which calls an ISR
. The system awakens and activates on an interrupt through a hardware or software signal. The system on port interrupt collects the coin by running a service routine. This routine is called interrupt handler routine for the coin-port read .
b.