Hi,
I am working with CC2530 ZNP mini Kit which has MSP430 MCU. I have initiated Timer A to enable the interrupt for condition 'x'.
Condition 'x' is like it monitors the flow of liquid. If there is no obstruction in the flow of liquid, then it will generate an interrupt.
Below is the part of the code which I used to enable interrupt on Timer A. In this case, port 2 of MSP430 is used.
clearLeds();
TACCTL0 = 0x5110;
TACTL = 0x01A2;
TAR = 0x0000;
//wakeupFlags |= WAKEUP_AFTER_TIMER;
while (1)
{
toggleLed(1);
printf("timer = %d, TACCR0 = %d \r\n ",TAR, TACCR0);
if(ovf_flag==1)
{
setLed(2);
printf("Sending Message %u\r\n", counter++);
afSendData(DEFAULT_ENDPOINT,DEFAULT_ENDPOINT,0, TEST_CLUSTER, testMessage, 5);
handleReturnValue();
clearLeds();
ovf_flag = 0;
TACTL = 0x01A2;
TAR = 0x0000;
//TACTL |=(1<<TAIFG);
}
HAL_SLEEP();
//delayMs(1000);
}
}
void handleTimer_cap() //Will automatically wakeup timer
{
setLed(1);
TACCTL0 &=!(1<<CCIFG);
printf("$");
TAR = 0x0000;
TACTL = 0x01A2;
TACCTL0 = 0x5110;
}
void handleTimer_ovf()
{
TACTL &=!(1<<TAIFG);
printf("@");
TAR=0x0000;
ovf_flag = 1;
//setLed(2);
}
It is working fine.
Now, I want to enable the Timer B to enable interrupt for condition 'y' similar to 'x'. I have tried to use Port 4 of MSP430. But I couldn't succeed. Can you pls let me know how to proceed? Which pin of Port 4 should be selected for output?
Is it possible to initiate timers A and B at the same instant? If so, how should I do it? I checked the output on connector P2.2 for Timer A. Which pin should I use to monitor the interrupt generation for Timer A as well as Timer B simultaneously? I meant that Timer A and Timer B are working in parallel for different operations.