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.

interrupt routine hanging the system

Status
Not open for further replies.

neelam29

New Member
Hi all
m designing a project using pic16f877 (4Mhz)and ds1302.the controller unit drives the relay which furthur drives a star delta strater of three phase motor.
i have to save the runtime of the motor on power failure.so as soon as the power fails my system generates an interrupt and the runtime of motor is saved.
now the problem is as soon as my pic gives start command to relay and relay to starter due to back emf of starter my microcontroller section hangs up ...i have tried following hardware solutions:
1 . adding decoupling capacitors
2. flywheel diode on the relay
3. better ground lines

if i remove the interrupt from the code my controller section works fine..what might me the problem? m sending the part of code for interrupt

.
.
.
.
.
.




void interrupt isr ()
{
if(INTF)
{
INTF=0;
WriteByteToEE(TotalRunTime,0x0B);



}
}


.
.
.
.
.
.
.







void main(void){
.
.
.
.
PEIE=1;
T1CON=0X30;
INTE=1;
GIE=1;
.
.
.
.
.
.
.
}

waiting for reply
 
Your problem appears to be that you have nonsense code or you only posted part of it. You obviously think the error is in the code you posted. The reality is that it's probably not.

Mike.
 
thanks for replying. it's part of my code. and if i remove interrupt routine from my code it works properly & dosetnt hangs if a noise ripple comes.
 
It's important that ISR's are as short and fast as possible, writing to EEPROM from within one isn't really a good idea (it's a very slow procedure). I don't 'do' C, but I imagine you're reseting the interrupt BEFORE writing to the EEPROM - so it may be getting called multiple times before it returns, and this is a SERIOUSLY BAD IDEA!.
 
What does your WriteByteToEE function look like? Does it determine the end of EE writing via interrupt flag or the PIC auto clearing of the write bit. Are you clearing the EE interrupt flag before in the function?

Have you tried simulating a power failure just by toggling the INT pin outside a noisy environment: No relays, no starter, just PIC, regulator, INT pin and a status Led?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top