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

msp430x20x1 ca 03

2 48 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 3,24 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Batt_Check is ; called constantly in an endless loop - in an actual application, ; Batt_Check should be called very infrequently to save power.. ; ACLK = n/a, MCLK = SMCLK = default DCO

Trang 1

; MSP430F20x1 Demo - Comp_A, Simple 2.2V Low Battery Detect

;

; Description: Two comparator_A reference generators 0.25*Vcc and ~ 0.55V

; are compared for a simple battery check of 2.2V In the subroutine

; Batt_Check a small capacitor that must be added to P2.3 is first charged

; to 0.25*Vcc and then compared to ~ 0.55V If 0.25*Vcc,

; is above ~0.55V, P1.0 is toggled, else set Batt_Check is

; called constantly in an endless loop - in an actual application,

; Batt_Check should be called very infrequently to save power

; ACLK = n/a, MCLK = SMCLK = default DCO

;

; There is a tolerence of the Comp_A reference generator and in the

; device specific datasheet In most applications, the tolerence of the

; reference generator is more than adequate to detect Low Battery

;

;

-; /|\ | XIN|-; | | |

; -|RST XOUT|-; | |

; + -|P1.1 P1.0| >LED ; | | |

; ===.1uf| |

; | | |

; + -|VSS ; ; M Buccini / L Westlund ; Texas Instruments Inc ; December 2005 ; Built with IAR Embedded Workbench Version: 3.40A ;******************************************************************************* #include "msp430x20x1.h"

ORG 0F800h ; Program Reset

; -RESET mov.w #0280h,SP ; Initialize stackpointer mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT bis.b #001h,&P1DIR ; P1.0 output mov.b #P2CA4,&CACTL2 ; P1.1 = CA1 ;

Mainloop call #Batt_Check ;

jmp Mainloop ;

;

; -Batt_Check

mov.b #CAREF0+CAON,&CACTL1 ; 0.25*Vcc on P2.3, Comp on Wait clr.w R15 ; Delay to R15 L1 dec.w R15 ;

jnz L1 ; Delay over? mov.b #CARSEL+CAREF1+CAREF0+CAON,&CACTL1 ; 0.55V on -, Comp on bit.b #CAOUT,&CACTL2 ;

clr.b &CACTL1 ; Disable Comp_A, save power jnc Batt_Low ;

xor.b #001h,&P1OUT ; P1.0 toggle ret ;

Batt_Low bis.b #001h,&P1OUT ; P1.0 set ret

Trang 2

; -; Interrupt Vectors

ORG 0FFFEh ; MSP430 RESET Vector

DW RESET ;

END

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

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

TÀI LIỆU LIÊN QUAN

w