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

msp430g2x21 usi 05 s43

1 104 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,08 KB

Nội dung

;******************************************************************************* ; MSP430G2x21/G2x31/3 Demo - USI SPI Interface to TLC549 8-bit ADC ; ; Description: This program demonstrate a USI in SPI mode interface to a ; TLC549 8-bit ADC If AIN > 0.5(REF+ - REF-), P1.0 set, else reset ; ACLK = n/a, MCLK = SMCLK = default DCO, UCICLK = SMCLK/4 ; //** VCC must be at least 3v for TLC549 **// ; ; MSP430G2x21/G2x31/3 ; ; /|\| XIN|; TLC549 | | | ; |RST XOUT|; | CS|< -|P1.1 | ; | DATAOUT| ->|P1.7/SOMI P1.0| >LED ; ~>|AIN I/O CLK|< -|P1.5/UCLK0 | ; ; D Dang ; Texas Instruments Inc ; October 2010 ; Built with IAR Embedded Workbench Version: 5.10 ;******************************************************************************* #include "msp430g2221.h" ; ORG 0F800h ; Program Reset ; RESET mov.w #0280h,SP ; Initialize stackpointer StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer SetupP1 clr.b &P1OUT ; bis.b #03h,&P1DIR ; P1.0/1 output direction SetupUSI bis.b bis.b mov.b bic.b mov.b #USIPE7+USIPE5+USIMST+USIOE,&USICTL0; Port, SPI master #USIIE,&USICTL1 ; Counter interrupt, flag remains #USIDIV_2+USISSEL_2,&USICKCTL ; /4 SMCLK #USISWRST,&USICTL0 ; Enable USI #08h,&USICNT ; init-load counter, clears flag ; Mainloop bis.w #LPM0+GIE,SR ; Enter LPM0, enable interrupts jmp Mainloop ; Again ; ; USI_ISR ; ; bis.b #02h,&P1OUT ; Disable TLC549 cmp.b #07Fh,&USISRL ; bic.b #01h,&P1OUT ; jlo USI_ISR1 ; bis.b #01h,&P1OUT ; USI_ISR1 bic.b #02h,&P1OUT ; Enable TLC549 mov.b #08h,&USICNT ; re-load counter reti ; ; ; ; Interrupt Vectors Used MSP430G2xx1 ; ORG 0FFFEh ; MSP430 RESET Vector DW RESET ; ORG 0FFE8h ; USICNT DW USI_ISR ; END

Ngày đăng: 26/12/2017, 08:42

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

TÀI LIỆU LIÊN QUAN

w