Doubt Regarding Interrupts In PIC Microcontroller

Status
Not open for further replies.

Naren Rover

New Member
Hi Guys,
I have a doubt regarding PIC Interrupts, I am using PIC16F887
I am Using Timer in Interrupt which Blink an LED for Approx 180 ms, and Sends Data through SPI when Certain condition occur,
Lets say when i am sending data in SPI and Interrupt occurs what will happen to data that is being transmitted,
will the controller finish transmission and goto ISR sub routine , or it Branches in the middle leading to data loss
Thank You.,
 
The SPI is hardware so it will carry on regardless of interrupts. Even if it was software it would make no difference as SPI is clocked and can run at any speed.

Mike.
 
Are you saying that you are in a interrupt service routine sending SPI data and some other interrupt occures ? If tis is the case then my understanding is that the second interrupt will not be handled until the return from the existing interrupt.

Les.
 
You are correct Les but SPI is in hardware so will complete as normal. If it is setup to generate an interrupt when it's finished then that will wait until other interrupts have been serviced.

Mike.
 
No SPI does not run in interrupt Timer only runs in Interrupt,
you are saying since SPI is in Hardware so even when Timer Interrupt Occurs and Controller goes to ISR Subroutine , SPI Data Transmission does not get affected, because it runs in separate hardware and Timer Interrupt Gets serviced?
 
yes. data already loaded into the buffer and being transmitted will be unaffected because no cpu intervention is involved. Same is true for uart, timers, etc. As long as it's a hardware peripheral and not bit banging.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…