Write a program in assembly language to control a sump pump. A sump well collect
ID: 1812912 • Letter: W
Question
Write a program in assembly language to control a sump pump. A sump well collects water runoff. The sump pump pumps out the well whenever it fills up. When the level rises to a high limit, the pump turns on. It stays on until the level drops to a low limit. Then the pump shuts off. It does not turn on again until the well fills up to the high limit. Data is stored in the following three addresses:
The program needs to run on a M68HC11E Microcontroller Trainer Board. Here is a link to the programming guide for this trainer board.
http://www.freescale.com/files/microcontrollers/doc/ref_manual/M68HC11ERG.pdf
AddressData
$00
High Limit
$1403
Level Reading (SW_PORT)
$1404
Pump Control (LED_PORT)
$10
Low Limit
Explanation / Answer
BEGIN
LDAA $1403 ; Loads current water level
LDAB $0000 ; Loads low limit of water level
CBA ; Compares current level to low limit
BEQ OFF ; Jumps to instruction to turn pump off
LDAB $00FF ; Loads high limit of water level
CBA ; Compares current level to high limit
BEQ ON ; Jumps to instruction to turn pump on
BRA BEGIN ; Repeats the program
OFF
LDAA #$10 ; Loads ACCA with $10 (signal for off)
STAA $1404 ; Sends signal to pump control or LED in testing
BRA BEGIN ; Repeats program
ON
LDAA #$00 ; Loads ACCA with $00 (signal for on)
STAA $1404 ; Sends signal to pump control or LED in Testing
BRA BEGIN ; Repeats program
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.