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
you have problems with harmonics generated from power line and motor ,second problem is back EMF
1- try to isolate the microcontroller with optocopler (between the microcontroller and the relay. i think it will work
2- try to put your controller away from power lines to reduce harmonics
3- use independent power supply (battery,switchmode,..)
4- put tentalium capcitor near to microcontroller (vcc,gnd)
The micro controller should be separated from optoIsolator's to reduce damage of hight current and voltage which may damage the micro controller . SO try to separate the microcontroller from power side and try to reduce the harmonics
Remove the Surge in the power supply section by using the X-Cap and Y-Cap Capacitance to remove the surge. The Ripples in POwer supply which leads the Voltage fulctuations. The required voltage needed for microcontroller is 5V. Due to surge the output voltgae may vary. Check the required voltage is coming to Controller side in all time.
I think writing to eeprom is taking more time.Try to move the routine to main program. it is not a good practise of writing huge code in interrupt subroutines.
try to set some bit in the routine and execute the task in the main loop with respect to that bit.
and also check with other interrupts like timer.
because if the timer subroutine is taking much time it will continuously be in that loop only.will not come back to the main loop.
---Keshav
Added after 3 minutes:
Hey forgot to tell
make the bit INTF = 0; after executing the total interrupt routine.I thnk this may be the problem.
--Keshav
Added after 42 seconds:
Hey forgot to tell
make the bit INTF = 0; after executing the total interrupt routine.I thnk this may be the problem.
--Keshav
Added after 1 minutes:
Hey forgot to tell
make the bit INTF = 0; after executing the total interrupt routine.I thnk this may be the problem.