⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isr_uart2_tx.s

📁 该文件包含30F的电机控制程序
💻 S
字号:
;START_HEADER
;
; dsPIC30F6014 Demo Source File
; (c) Copyright 2005 Microchip Technology, All rights reserved
;
; --------------------------------------------------------------------------
; File Revision History:
; --------------------------------------------------------------------------
;
; $Log: isr_uart2_tx.s,v $
; Revision 1.3  2005/04/04 23:43:40  VasukiH
; Updates to comments in file header
;
; Revision 1.2  2005/04/04 23:15:02  VasukiH
; Updates for MPLAB C30 v1.30 compatiblity
;
; Revision 1.1.1.1  2003/08/23 00:38:32  VasukiH
; First import of demo source into CVS Repository
;
;
;
; --------------------------------------------------------------------------
;
; Software and Development Tools Info:
; --------------------------------------------------------------------------
; Tool                          Version
; --------------------------------------------------------------------------
; MPLAB IDE                     7.0
; MPLAB C30 Toolsuite           1.30
; dsPICDEM(TM) Processor Board  1.10
; --------------------------------------------------------------------------
;
; File Notes:
; 1. UART TX ISR transmits character at location pointed to by U2TXPTR
;    until a null charracter is encountered in the string stored in memory.
;
;END_HEADER


.include "p30fxxxx.inc"


.global U2TXPtr

.section  .data, near
U2TXPtr:  .hword 0x0000


.global         __U2TXInterrupt

.section        .text
__U2TXInterrupt:
        push.d  w0                      ;save context - w0,w1, w2
        push    w2
        bclr    IFS1, #U2TXIF           ;Clear the interrupt flag

        cp0     U2TXPtr                 ;Check if the pointer is valid (not zero)
        bra     z, exit2_U2TXInt        ;Else exit

        mov     U2TXPtr, w1
        mov     #4, w2                  ;Initialize w2=4 as a decrementing counter

load_next_char:
        mov.b   [w1++], w0              ;Load 4 characters into UART TX queue
        cp0.b   w0                      ;unless a null character is encountered
        bra     z, loaded_all_char      ;Was null char encountered?

        mov.b   WREG, U2TXREG
        dec     w2, w2
        bra     nz, load_next_char
        bra     exit1_U2TXInt           ;Exit ISR after loading 4 chars

loaded_all_char:
        clr     U2TXPtr                 ;Clear pointer if null char was encountered
        bra     exit2_U2TXInt

exit1_U2TXInt:
        mov     w1, U2TXPtr             ;Save new value of pointer
exit2_U2TXInt:
        pop     w2                      ;Restore context - w0, w1, w2
        pop.d   w0
        retfie                          ;Return from Interrupt

.end                                    ;EOF



        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -