И еще: в user manual написано, что таймер в непрерывном режиме может считать от нуля до 0xFFFF, сбрасывается в нуль и опять по новой. Так вот такого я не заметил, по не добавил в прерывание таймера инициализацию таймера. Это так и надо?
И еще: когда прогоняю этот код в IAR С-Spy, то при выходе из прерывания програмный счетчик переходит неизвестно куда и приходится каждый раз перегружать проц.
IAR C/C++ Compiler for MSP430 V3.21A/W32 [Kickstart] (3.21.1.3)
IAR C-SPY Emulator Driver for MSP430
V3.21A/W32 [Kickstart] (3.21.1.3)
Помогите пожалуйста, а то забодался уже совсем. Неделю сидел разбирался и ничего

Вот код на icc430 6.07A
Цитата
//ICC-MSP application builder [F149] : 14.10.2005 0:40:13
//Target 14x device
#include <msp430x14x.h>
#include <msp430def.h>
void clock_init()
{
//DCO=0x00
DCOCTL=0x00;
BCSCTL2=0x08;//SELS
BCSCTL1=0x00;//XTS
}
void timera_init()
//Clock source=SMCLK
//Divider=8
//TIMACLK=460,800KHz
//Frequency=7,0Hz (142,22mS)
{
TACTL=0x00; //stop timer
//channel0
TACCTL0=0x00;
TACCR0=0xFFFF;
//channel1
TACCTL1=0x00;
TACCR1=0x00;
//channel2
TACCTL2=0x00;
TACCR2=0x00;
TAR=0x0000;//clear timer counter
TACTL=0x2E6;//TASSEL.1,TAID.1,TAID.0,TAMC.1,1,TAIE
}
//call this routine to initialise all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
DINT(); //disable all interrupts
ME1=0X00; //disable sfr peripherals
ME2=0X00;
IE1=0x00; //disable sfr interrupts
IE2=0x00;
//watchdog initialisation including nmi function
//WDTCTL=0x5A00 | 0x00;
WDTCTL = WDTPW + WDTHOLD;
//initialise other peripherals
clock_init();
//port_init();
timera_init();
ME1=0x00;
ME2=0x00;
IE1=0x00;
IE2=0x00;
P4DIR = 0xFF;
P4SEL = 0x00;
P4OUT = 0x00;
P4OUT = 0x02;
EINT(); //re-enable interrupts
}
#pragma interrupt_handler timera_1_isr:TIMERA1_VECTOR
void timera_1_isr(void)
{
TACTL=0x00; //stop timer
//channel0
TACCTL0=0x00;
TACCR0=0xFFFF;
TAR=0x0000;//clear timer counter
TACTL=0x126;//TASSEL.0,TAMC.1,1,TAIE
P4OUT ^= 0x02;
}
void main(void)
{
init_devices();
while(1);
}
//Target 14x device
#include <msp430x14x.h>
#include <msp430def.h>
void clock_init()
{
//DCO=0x00
DCOCTL=0x00;
BCSCTL2=0x08;//SELS
BCSCTL1=0x00;//XTS
}
void timera_init()
//Clock source=SMCLK
//Divider=8
//TIMACLK=460,800KHz
//Frequency=7,0Hz (142,22mS)
{
TACTL=0x00; //stop timer
//channel0
TACCTL0=0x00;
TACCR0=0xFFFF;
//channel1
TACCTL1=0x00;
TACCR1=0x00;
//channel2
TACCTL2=0x00;
TACCR2=0x00;
TAR=0x0000;//clear timer counter
TACTL=0x2E6;//TASSEL.1,TAID.1,TAID.0,TAMC.1,1,TAIE
}
//call this routine to initialise all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
DINT(); //disable all interrupts
ME1=0X00; //disable sfr peripherals
ME2=0X00;
IE1=0x00; //disable sfr interrupts
IE2=0x00;
//watchdog initialisation including nmi function
//WDTCTL=0x5A00 | 0x00;
WDTCTL = WDTPW + WDTHOLD;
//initialise other peripherals
clock_init();
//port_init();
timera_init();
ME1=0x00;
ME2=0x00;
IE1=0x00;
IE2=0x00;
P4DIR = 0xFF;
P4SEL = 0x00;
P4OUT = 0x00;
P4OUT = 0x02;
EINT(); //re-enable interrupts
}
#pragma interrupt_handler timera_1_isr:TIMERA1_VECTOR
void timera_1_isr(void)
{
TACTL=0x00; //stop timer
//channel0
TACCTL0=0x00;
TACCR0=0xFFFF;
TAR=0x0000;//clear timer counter
TACTL=0x126;//TASSEL.0,TAMC.1,1,TAIE
P4OUT ^= 0x02;
}
void main(void)
{
init_devices();
while(1);
}