OSTimer() and ISR's

i'm trying to get my head round this OSDelay, OSTimer() and ISR thing.
correct me if i'm wrong:
¬ as far as i understand OSDelay needs OSTimer to work otherwise it has no sense of how long the delay should last.
¬ OSTimer can be called in a number of ways but the suggested way seems to be from an overflow from a clock. that is to say when a clock has reached a certain point in its cycle an overflow occurs and an interrupt is emitted.
¬ the period of this overflow is the period that OSTimer() is called and thus defines the delay increment.
what i dont seem to understand is how to implement this ISR for simply delaying a task.
currently i have
code:void Timer_A (void) __interrupt[TIMERA0_VECTOR]
{
CCR0 += 10000;
OSTimer();
}
in my main.c file before the void main(void) bit. however i have noticed that in the forum many people put this ISR underneath the main bit.
¬ also whilst i can locate the ISR in the main.c file. i cant work out where it has been called. i tried to call it in OSSched by creating a task called TimerA which didn't work.
//--------------------------------------\
i am running salvo pro, crossstudio 1.3,
MSP430F169.
\--------------------------------------//
¬ my main.c looks like this
code:#include <msp430x16x.h>
#include <salvo.h>
#include <cross_studio_io.h>
_OSLabel(TaskTemp1)
_OSLabel(TimerA1)unsigned int ADCresult;
unsigned long int DegC;#define Task1_P OSTCBP(1)
#define Task2_P OSTCBP(2)void Timer_A (void) __interrupt[TIMERA0_VECTOR]
{
CCR0 += 10000;
/* toggle bit0 on P1OUT to show some life. */
//PORT ^= 0x01;
OSTimer();
}void TaskTemp( void )
{
/* setup ADC12 to read ch 10, etc. */
ADC12CTL0 = ADC12ON+REFON+REF2_5V+SHT0_6;
ADC12CTL1 = SHP;
ADC12MCTL0 = INCH_10+SREF_1;
OS_Delay(1, label2); //wait 10ms for reference startup
debug_printf("i am waiting 10ms");
ADC12CTL0 |= ENC; //enable conversions
for (;;)
{
ADC12CTL0 |= ADC12SC; // start conversion
OS_Delay(200, label); // wait 2s
debug_printf("i am waiting 2 seconds");
ADCresult = ADC12MEM0; // read result
DegC = ((((long)ADCresult-1615)*704)/4095); // calc. DegC
OS_Yield(TaskTemp1);
debug_printf("the temp is: %d C
", DegC);
}
}void main(void)
{
debug_printf("world says hello
");
debug_printf("hello world
");
OSInit();
OSCreateTask(TaskTemp, Task1_P, 7);
OSCreateTask(Timer_A, Task2_P, 7);
OSEi();
for (;;)
OSSched();
}
in the debug window the first two lines "hello world" statements appear and then the program stops. actually i cant tell whether it stops or its stuck in an infinite loop or whatever. but it doesnt do anything.
if i comment out the delay lines the program works fine. but without delay. not too sure whats wrong.
¬ my salvocfg.h looks like
code:#define OSBYTES_OF_TICKS 2
#define OSBYTES_OF_DELAYS 1
#define OSENABLE_MESSAGES TRUE
#define OSEVENTS 2
#define OSTASKS 3
#define OSENABLE_DELAYS TRUE
¬ ISR's are new to me so i've probably overlooked something quite basic.
¬ thanks in advance!!