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

msp430x20x3 sd16a 03

2 108 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 2
Dung lượng 4,73 KB

Nội dung

;****************************************************************************** ; MSP430F20x3 Demo - SD16A Sequence of conversions ; ; The SD16A takes a sample of a single sequence of channels: A0, A1, then A2 ; Sampling begins with ch A0 The 4th conversion result of each channel is ; stored in memory ; ; ; MSP430F20x3 ; -; /|\| XIN|; | | | ; |RST XOUT|; | | ; Vin+ >|A0+ P1.0 | ; |A01- = VSS | ; | | ; Vin+ >|A1+ P1.2 | ; |A1- = VSS | ; | | ; Vin+ >|A2+ P1.4 | ; |A2- = VSS | ; | | ; | VREF | -+ ; | | | ; | | -+- 100nF ; | | -+; | | | ; | AVss | -+ ; | | ; ; ; R B Elliott / H Grewal ; Texas Instruments ; April 2007 ; Built with IAR Embedded Workbench Version: 3.42A ;****************************************************************************** #include "msp430x20x3.h" ; ORG 0F800h ; Program Reset ; RESET mov.w #0280h,SP ; Initialize stackpointer StopWDT mov.w mov.b #WDTPW+WDTHOLD,&WDTCTL #DIVS_3, &BCSCTL2 SetupSD16 mov.w mov.b mov.w #SD16REFON+SD16SSEL_1,&SD16CTL ; 1.2V ref, SMCLK #SD16INCH_0+SD16INTDLY_0,&SD16INCTL0 ; Set channel A0+/#SD16UNI+SD16IE+SD16SNGL,&SD16CCTL0 ; 256OSR, unipolar, ; enable interrupt, ; single conversion mov.b #SD16AE0,&SD16AE Delay Mainloop ; Stop WDT ; SMCLK/8 ; P1.0 A0+, A0- = VSS mov.w dec.w jne #03600h, R4 R4; Delay; ; Delay for 1.2V ref startup mov.w #0h, R5 ; R5 = ch_count bis.w bis.w #SD16SC,&SD16CCTL0 #CPUOFF+GIE,SR ; ; Start conversion ; CPU off, enable interrupts nop jmp Mainloop ; Required only for debugger ; jump back to mainloop ; SD16_ISR; ; cmp.w jlo jeq jmp Case0 #01h, R5; Case0 Case1 Case2 ; current channel is A0 ; current channel is A1 ; current channel is A2 mov.w &SD16MEM0, R7 inc.w R5 ; R7 = A0 conversion results ; ch_counter++ mov.b #SD16INCH_1,&SD16INCTL0 mov.b #SD16AE2, &SD16AE jmp Done ; Enable channel A1+/; Enable external input on A1+ ; break mov.w &SD16MEM0, R8 inc.w R5 ; R8 = A1 conversion results ; ch_counter++ mov.b #SD16INCH_2,&SD16INCTL0 mov.b #SD16AE4, &SD16AE jmp Done ; Enable channel A2+/; Enable external input on A2+ ; break Case2 mov.w mov.w mov.b mov.b ; ; ; ; Done bic.w #LPM0,0(SP) reti Case1 &SD16MEM0, R9 #0h, R5 #SD16AE0, &SD16AE #SD16INCH_0,&SD16INCTL0 R9 = A2 conversion results Reset channel count (end of seq) Reset external input to A0+/Reset channel observed ; Exit LPM0 ; ; ; ; Interrupt Vectors ; ORG 0FFFEh ; MSP430 RESET Vector DW RESET ; ORG 0FFEAh ; SD16 Vector DW SD16_ISR ; END

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

TỪ KHÓA LIÊN QUAN

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

TÀI LIỆU LIÊN QUAN

w