|
Re: Interrupts, Interrupts, and more Interrupts!
Quote:
Originally Posted by dcbrown
Will too many interupts will cause the red-light-of-death?
-------------------------------------------------------
Code:
<within the system clock routine, do...>
if (statusflag.NEW_SPI_DATA != 0)
{
Getdata(&rxdata);
Putdata(&txdata);
}
Anyway, doing these operations in the background at interrupt time frees the user code from having to worry about taking too long between updates causing the red-light-of-death.
|
It might be nice to warn people trying this that all their operations on the data received from GetData() and sent to PutData() need to be atomic. I realize the data in the structs are represented as as unsigned chars, and thus accessing them is atomic, but it's pretty easy to get lazy and use them to store temporary results of calculations. The Default_Routine in the default code does this several times, and it's asking for trouble if you continue this practice with this style of communication servicing.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.
Lone Star Regional Troubleshooter
|