Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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?
 
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.

New Articles From Microcontroller Tips

Back
Top