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

📄 asmlib.s

📁 This a simple hardware UART test program. It receives text lines over the serial port and writes ba
💻 S
字号:
/**Assembler functions.http://mspgcc.sf.netchris <cliechti@gmx.net>*/#include "hardware.h"#include "tasklist.h".extern procchar.extern taskreg/**demux timer A interrupts*/interrupt(TIMERA1_VECTOR)tax_int:        add     &TAIV, r0               ; Add TA interrupt offset to PC        reti                            ; CCR0 - no source        jmp     ccr1                    ; CCR1        jmp     ccr2                    ; CCR2        reti                            ; CCR3 - no source        reti                            ; CCR4 - no sourcetaover:                                 ; TAOVER (follows directly)        reticcr1:   reti    ;br      #INT_TimerA_CCR1 ;redirect to an interrupt functionccr2:   reti    ;br      #INT_TimerA_CCR2 ;redirect to an interrupt function/**UART receive interrupts on character*/interrupt(UART0RX_VECTOR)uart0RX:        push    r12                     ; registers have to be saved, as a C func is called        push    r13        push    r14        push    r15        call    #procchar        tst     r15                     ;test return value        bis     r15, taskreg            ;activate task(s) if nonzero        bic     #CPUOFF+OSCOFF+SCG0+SCG1, 8(r1) ;set CPU to active mode (4*push->8)        pop     r15        pop     r14        pop     r13        pop     r12        reti/**send a single character over the UART, first wait until transmit buffer is empty*/.global putchar        .type putchar, @functionputchar:                                ;send a byte.L1:    bit.b   #TXEPT, &UTCTL0         ;tx buffer empty?        jnc     .L1                     ;no -> loop until it is        mov.b   r15, &TXBUF0        mov     #1, r15        ret

⌨️ 快捷键说明

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