Question

Please write an interrupt code for dspic33ep512mu810 microprocessor in Assembly Language. Please answer if you properly...

Please write an interrupt code for dspic33ep512mu810 microprocessor in Assembly Language.

Please answer if you properly know that. Will rate accordingly.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

;******************************************************************************
; Processor
;******************************************************************************

        .equ __33EP512MU810, 1
        .include "p33EP512MU810.inc"

;..............................................................................
;Configuration bits:
;..............................................................................

        config __FOSCSEL, FNOSC_PRI & IESO_OFF

        config __FOSC, FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMD_XT

        config __FWDT, FWDTEN_OFF & PLLKEN_OFF

        config __FPOR, BOREN_ON & FPWRT_PWR16

        config __FICD, ICS_PGD2

;Uninitialized variables in Near data memory (Lower 8Kb of RAM)
;..............................................................................

          .section .nbss, bss, near
Lf:          .space 2               ;variables
X:           .space 2

         .global __reset          ;The label for the first line of code.
         .global __T1Interrupt    ;Declare Timer 1 ISR name global

;..............................................................................
;Code Section in Program Memory
;..............................................................................
.text
__reset:


            MOV #0xFFFF, W0
            MOV W0,X
            MOV #0xFFFF, W0
            MOV W0, Lf
           BCLR TRISG, #TRISG8
           CLR T1CON
            CLR TMR1
            MOV #0x0005, W0
            MOV W0, PR1
            MOV #0x8030, W0
            MOV W0, T1CON
            BCLR IFS0, #T1IF
            BSET IEC0, #T1IE                            ; Enable Timer1 interrupt
START:
            COM Lf
            BTSC X,#0
            GOTO LOOP1
            GOTO LOOP2


LOOP1:
            BSET LATG, #LATG8
            COM X
            GOTO LOOP3


LOOP2:
            BCLR LATG, #LATG8
            COM X
            GOTO LOOP3


LOOP3:
            BTSC Lf,#0
            GOTO START
            BRA LOOP3


;..............................................................................
;Timer 1 Interrupt Service Routine
;..............................................................................

__T1Interrupt:


            BCLR IFS0, #T1IF
            COM Lf
            RETFIE

NOTE :

a) If you find the solution doubtful or doesn't match with your answer provided, or you feel that I am wrong by any means feel free to mention that in comment. Otherwise your downvote will keep me in doubt. So that i can correct myself and it will also help me in future to guide others.

b) Please re-check the calculation and inform me if there is any error. Happy to help.

c) Some feedbacks or rating will help me to improve myself. Wish you all the best. Happy Learning. Thank You

Add a comment
Know the answer?
Add Answer to:
Please write an interrupt code for dspic33ep512mu810 microprocessor in Assembly Language. Please answer if you properly...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT