TIMER A Cont..

Photo of author

By Jackson Taylor

1 second timer in up mode

using internal DCO (0.999908182 seconds)

Here calculations are done assuming DCO = 1.1MHz

Time  = ((1100+1)/1.1MHz)*999 = 0.999908182  seconds…!

.include "msp430g2x31.inc"
org 0xf800
    mov #(WDTPW|WDTHOLD), &WDTCTL
    mov #0x280, SP
    mov.b #0x41,&P1DIR
    clr.b P1OUT
    clr R5
    mov #(TASSEL_2|MC_1|ID_0|TAIE), &TACTL
    mov #1100, &TACCR0
    eint
jimmy:  jmp jimmy
TAISR:
    inc R5
    cmp #999, R5
    jne exit
    xor.b #0x41,&P1OUT
    clr R5
exit:
    bic #1, &TACTL
    reti
org     0FFF0h
dw      TAISR
org     0FFFEh
dw 0xf800

Timer A — high speed blinking using up/down mode

Time  = (65000*2)+1/1.1MHz = 0.118182727

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video
.include "msp430g2x31.inc"
org 0xf800
    mov #(WDTPW|WDTHOLD), &WDTCTL
    mov #0x280, SP
    mov.b #0x41,&P1DIR
    mov.b #0x41,P1OUT
    mov #(TASSEL_2|MC_3|TAIE), &TACTL
    mov #65000, &TACCR0
    eint
jimmyloop:
    jmp jimmyloop
jimmyisr:
    bic #1,&TACTL
    xor.b #41h, &P1OUT
    reti
ORG     0FFF0h
DW      jimmyisr
ORG     0FFFEh
DW      0xf800

Timer A — high speed blinking using up mode & CCIFG

.include "msp430g2x31.inc"
org f800h
    mov #(WDTPW|WDTHOLD), &WDTCTL
    mov #0x280, SP
    mov.b #0x41,&P1DIR
    mov.b #0x41,P1OUT
    mov #(TASSEL_2|MC_1), &TACTL
    mov #CCIE, &TACCTL0
    mov #65000, &TACCR0
    eint
jimmyloop:
    jmp jimmyloop
jimmyisr:
    xor.b #41h, &P1OUT
    reti
ORG     0FFF2h
DW      jimmyisr
ORG     0FFFEh
DW      0xf800

Timer A — high speed blinking using up/down mode & CCIFG

.include "msp430g2x31.inc"
org 0xf800
    mov #(WDTPW|WDTHOLD), &WDTCTL
    mov #0x280, SP
    mov.b #0x41,&P1DIR
    mov.b #0x41,P1OUT
    mov #(TASSEL_2|MC_3), &TACTL
    mov #CCIE, &TACCTL0
    mov #65000, &TACCR0
    eint
jimmyloop:
    jmp jimmyloop
jimmyisr:
    xor.b #41h, &P1OUT
    reti
ORG     0FFF2h
DW      jimmyisr
ORG     0FFFEh
DW      0xf800
See also
CAPACITIVE TOUCH SENSOR USING MSP430G2452 IN ENERGIA

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works