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

📄 fet110_hc138.s43

📁 msp430p1110
💻 S43
字号:
#include  "msp430x11x1.h"
;*****************************************************************************
;   MSP-FET430x110 Demo  - Software Parellel Interface with HC138 
;
;   Description: Transfer 3-bit binary value to HC138 using A, B, and C. 
;   Mainloop will increment 3-bits on P2.0 - P2.2 directly interfacing to
;    A-C inputs, rotating Y0 - Y7 outputs.
;   ACLK = n/a, MCLK = SMCLK = default DCO ~ 800k 
;
;		 MSP430F1121     ^     HC138
;             -----------------  |  ----------
;            |                 | |-|G1        |  8
;            |             P2.2|-->|C       Yx|--\->
;            |             P2.1|-->|B         |
;            |             P2.0|-->|A     /G2x|--|
;            |                 |   |          |  V
;
;   M.Buccini
;   Texas Instruments, Inc
;   January 2002
;*****************************************************************************
;----------------------------------------------------------------------------- 
            ORG     0F000h                  ; Program Start
;----------------------------------------------------------------------------- 
RESET       mov.w   #0300h,SP               ; Initialize 'x112x stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop Watchdog Timer
SetupP2     bic.b   #07h,&P2OUT             ; A,B,C = 0
            bis.b   #07h,&P2DIR             ; A,B,C outputs
                                            ;
Mainloop    push.b  &P2OUT                  ; P2OUT --> TOS
            inc.b   0(SP)                   ; Increment TOS
            and.b   #07h,0(SP)              ; Expose three LSBs on TOS
            bic.b   #07h,&P2OUT             ; P2.0 - 2 cleared
TX_HC138    bis.b   @SP+,&P2OUT             ; P2.0 - 2 configured only 
            call    #Delay                  ; Wait
            jmp     Mainloop                ; Repeat
                                            ; 
;----------------------------------------------------------------------------- 
Delay;      Software delay
;----------------------------------------------------------------------------- 
            push.w  #0FFFFh                 ; Delay to TOS
L1          dec.w   0(SP)                   ; Decrement TOS
            jnz     L1                      ; Delay over?
            incd.w  SP                      ; Clean-up Stack
            ret                             ;
                                            ;
;----------------------------------------------------------------------------- 
;           Interrupt Vectors Used MSP430x11x1          
;----------------------------------------------------------------------------- 
            ORG     0FFFEh                  ; MSP430 RESET Vector
            DW      RESET                   ; 
            END

⌨️ 快捷键说明

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