ECE331 Quiz 9 Name:________________________________________ CM#_________ ;This program should light LED 1 (on PT7) if analog input connected to PAD7 (AN7) ;is BELOW (1/4)*(5) volts, light LED 2 (on PT6) if analog input is ABOVE (3/4)*(5V). Otherwise ;both LEDs should remain OFF. Fill in the blanks. XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as application entry point INCLUDE 'mc9s12c128.inc' ORG $4000 Entry: LDS #$1000 ;Initialize the stack pointer BSET DDRT, #$___________ ;Make PT7 and PT6 outputs for LEDs BCLR ATDDIEN,%__________________ ;Make PAD3(AN3) analog input BSET ATDCTL2,%__________________ ;Power up A/D Subsystem LDX #$FFFF WT_ATD_PWR_UP: DEX BNE WT_ATD_PWR_UP ;Wait for A/D Subsystem Power to Stabilize MOVB #%_______________________,ATDCTL3 ;Select single conversion MOVB #%_______________________,ATDCTL4 ;Select 10-bit resolution ;2-clock sample time, and ;1/4 ATD clock prescaling NEXTCONV: MOVB #$__________,ATDCTL5 ;Start a conversion on Channel 7 with result right-justified in result reg WT_TIL_DONE: BRCLR ATDSTAT0,______________,WT_TIL_DONE ;Wait till converter is done LDD ________________________ ;Load 10-bit result into D CPD #$3FF/4 _____________________________ CPD #3*($3FF/4) ______________________________ BCLR _________________________ BRA NEXTCONV LightLED1: BSET PTT,$80 ;Light LED1 (on PT7) if analog is below 5/4 volts. BCLR PTT,_____________ BRA DONE LightLED2: BSET PTT,$40 ;Light LED2 (on PT6) if analog input is above 15/4 volts. BCLR PTT,_____________ BRA NEXTCONV ORG $FFFE DC.W __________________________ ; Reset Vector