Question
Part I: Assembly Programming Requirement : You must demo your program on a Dragon12-Light board. Goal : To become familiar with using XIRQ hardware interrupt,
Part I: Assembly Programming
Requirement: You must demo your program on a Dragon12-Light board.
Goal: To become familiar with using XIRQ hardware interrupt, writing your own interrupt service routines, setting up interrupt service routines and using Dragon12-Light boards and improving your programming skills.
Project:
Please read section 11.3 of your textbook, or Lecture 8 on IRQ and XIRQ interrupts. Then, study this example program, LEDsByIRQ.txt. Assemble, download, and test the program. Please understand the entire program completely.
-To enable XIRQ interrupt, modify the main program: replace the codes for enabling IRQ interrupt by code to enable XIRQ interrupt.
-Change the service routine name from IRQ_ISR to XIRQ_ISR.
-Set up your XIRQ interrupt vector accordingly. For setting up interrupt service routine in C, please study Example 11-15 of your textbook.
-Modify the XIRQ_ISR service routine to do the following: When a momentary active-low signal is sent to XIRQ pin, it generates XIRQ interrupt. Your XIRQ interrupt service routine will be called, which turns on all the even LEDs. Let them stay on for one second by calling a one second delay subroutine. After finishing handling the interrupts, the main program should just turn off all LEDs. When another momentary active-low signal is sent to XIRQ pin, it generates XIRQ interrupt again. Your XIRQ interrupt service routine will be called, which should turn on all the odd LEDs. Let them stay on for one second by calling the same delay subroutine. After finishing handling the interrupts, the main program should just turn off all LEDs. If active-low signal is provided continuously at XIRQ pin, then your XIRQ service routine should continuously toggle even/odd LEDs in one Hz frequency.
-After finishing handling the interrupts, the main program should just turn off all LEDs.
Part II: C Programming: Second part is same instructions except written in C language
XIRQ program
;***************************************************************** ; export symbols ;***************************************************************** ;For absolute assembly: this is the application entry point ABSENTRY Main
;***************************************************************** ; Include derivative-specific definitions ;***************************************************************** ;The microcontroller chip used by Dragon12-Light boards INCLUDE 'mc9s12dg256.inc'
;***************************************************************** ; Symbolic constant(EQU) section ;***************************************************************** DATA EQU RAMStart ;use $1000 - $1FFF for data STACK EQU RAMEnd+1 ;use $2000 - $3FFF for stack CODE EQU $4000 ;use flash ROM $4000 - $7FFF for code
;***************************************************************** ; Data section ;***************************************************************** ORG DATA
;***************************************************************** ; Main program section ;***************************************************************** ORG CODE Main: LDS #STACK ;initialize Stack Pointer SP LDAA #%00000000 STAA DDRE ;make PE1 an input pin JSR InitLEDs LDAA #%01000000 STAA INTCR ;enable low-level triggering ;enable IRQ pin interrupt CLI ;clear the mask Loop LDAA #$81 STAA PORTB ;turn on LED0 and LED7 continously. BRA Loop
;***************************************************************** ; Subroutine section ;***************************************************************** InitLEDs ;LEDs are connected to PORTB on Dragon12-Light LDAA #$FF STAA DDRB ;make PORTB as Output port
;PTP0, PTP1, PTP2 and PTP3 of port P control the 4 units of the seven seg. display ;GRB LED is controlled by PTP4-PTP6: PTP4=1, red; PTP5=1, green; PTP6=1, blue LDAA #$FF STAA DDRP ;make PTP output port LDAA #$2F ;make PTP0-PTP3 high to disable the seven seg. dispaly, STAA PTP ;and make PTP5 high to turn on green RGB LED RTS
;***************************************************************** ; Interrupt service routine ;***************************************************************** IRQ_ISR LDAA #$FF STAA PORTB RTI ;***************************************************************** ; Interrupt Vectors ;***************************************************************** ORG $FFF2 DC.W IRQ_ISR ;set up IRQ interrupt vector ORG $FFFE DC.W Main ;set up Reset Vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started