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
.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