Click here to Skip to main content
15,938,022 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem and i dont understand about interrupt for pic32mx360f512l. can anyone explain to me about this function regarding this code..thanks..

void __ISR(_CORE_TIMER_VECTOR, ipl2) CoreTimerHandler(void)
{
// clear the interrupt flag
mCTClearIntFlag();

// .. things to do

// update the period
UpdateCoreTimer(CORE_TICK_RATE);


// .. Toggle the LED
mPORTDToggleBits(BIT_1);
}

What is this use for in the interrupt?
Posted

While I'm not familiar with the PIC32 myself and am not entirely sure what UpdateCoreTimer() does, the code you posted seems pretty clear to me.

Unfortunately, I don't understand what your question is. :confused: I'll make a few comments anyway. Maybe I'll accidentally answer your question. :)

The code is an Interrupt Service Routine. It is activated by a hardware timer which via hardware transfers control from whatever code was executing to the ISR. When the ISR returns, control is returned to the interrupted code. There are serious issues to be concerned about in code used in an ISR. Concurrency is one of them.

Its use is to do things that need doing at the times that the hardware timer goes off.

The mCTClearIntFlag() is evidently managing the proper state of the interrupt control/masking hardware. I'd have to read the PIC32 documentation to be more detailed about that.

I don't thing there is really anything to add to the comment "things to do".

I'm guessing, but the UpdateCoreTimer() could be maintaining the current day and time. Then again, neither the comment or the function name really sound quite right for that. I'd really have to see more details before being confident of what it was really doing.

Toggling the LED provides a visual "operating health" indicator to someone looking at the hardware. If the led stops blinking, then something has gone seriously wrong with the hardware or software and the device is no longer working.

Does this explain anything to you?
 
Share this answer
 
yeah..thanks so much for the answer.you have clear most of my doubts..thanks so much for your answer. :) :) :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900