| ??? 12/21/07 11:47 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#148577 - Sucess with interrupts Responding to: ???'s previous message |
It should be no problem to do what you want. Designing software with interrupts takes some experience, so here are my tips.
1. Design the interrupt service routines to do the minimum amount of work. The ADC ISR should just copy the ADC result sfrs to a variable and raise a flag to indicate that new data is ready. The UART RI interrupt should copy the SBUF sfr to a variable and raise a flag. 2. The main loop checks the flags raised by the ISRs to decide what to do, e.g. for(;;)
{
if(ADCDataValid)
{
scaleData();
ADCDataValid = FALSE;
}
if(UARTDataFlag)
{
processCharacter();
UARTDataFlag = FALSE;
}
}
3. Run the ADC fairly slowly. Temperatures don't usually change too quickly. |



