1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

msp430g2xx2 usi 04 asm examples

1 111 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 1
Dung lượng 3,47 KB

Nội dung

;******************************************************************************* ; MSP430G2xx2 Demo - USI SPI Interface to HC165/164 Shift Registers ; ; Description: Demonstrate USI in two-way SPI mode Data are read from ; an HC165, and same data written back to the HC164 ; ACLK = n/a MCLK = SMCLK = Default DCO, USI = SMCLK/2 ; ; MSP430G2xx2 ; ; /|\| XIN|; | | | ^ HC164 ; HC165 |RST XOUT|| ; -| | |-|/CLR,B | ; | /LD|< -|P1.1 SIMO0/P1.6| >|A Qx| \-> ; -\->|A-H CLK|< -|P1.5/SCLK - P1.5| >|CLK | ; |-|INH QH| ->|P1.7/SOMI | | | ; |-|SER | | | | | ; - | | | | | | ; ; D Dang ; Texas Instruments Inc ; December 2010 ; Built with Code Composer Essentials Version: 4.2.0 ;******************************************************************************* cdecls C,LIST, "msp430g2452.h" ; -.text ; Program Start ; -RESET mov.w #0280h,SP ; Initialize stackpointer StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer SetupP1 bis.b #02h,&P1OUT ; bis.b #02h,&P1DIR ; SetupUSI bis.b #USIPE7+USIPE6+USIPE5+USIMST+USIOE,&USICTL0; Port, SPI master bis.b #USICKPH+USIIE,&USICTL1 ; Counter interrupt, flag remains mov.b #USIDIV_1+USISSEL_2,&USICKCTL ; /2 SMCLK bic.b #USISWRST,&USICTL0 ; Enable USI mov.b #08h,&USICNT ; init-load counter, clears flag ; Mainloop call #RXTX_HC16x ; Exchange data Delay push.w #0 ; Software delay D1 dec.w 0(SP) ; jnz D1 ; incd.w SP ; jmp Mainloop ; Repeat ; ; RXTX_HC16x; HC165 > URXBUF0 UTXBUF0 > HC164 ; TX0 bit.b #USIIFG,&USICTL1 ; USART0 TX buffer ready? jz TX0 ; Jump > TX buffer not ready bic.b #02h,&P1OUT ; Latch data into 'HC165 bis.b #02h,&P1OUT ; ; ******************** ; Read data are ready to be written mov.b #08h,&USICNT ; Load counter, clears flag ret ; Return from subroutine ; ; -; Interrupt Vectors ; -.sect ".reset" ; MSP430 RESET Vector short RESET ; end

Ngày đăng: 26/12/2017, 13:03

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w