I want to store the data when POWER loss or Down.
So I connected to the interrupt Pin with help of diode
I used 1000uf/25V capacitor to store the power to write EEPROM DATA.
But interrupt working only when Gnd to VCC trigger but in my case trigger will be VCC to GNd.
I attached My circuit and code also.Please Find it,
It works. See attached video if you don't have Proteus 8.5 SP1. I also tested the project with PIC18F46K22 on hardware and it works fine. Test the attached .hex file on hardware. The power supply of PIC circuit if not battery operated should have atleast 1000 uF at input and output of LM7805.
It's better to connect the high value capacitor at the voltage regulator input.
Then use a comparator to detect when this input voltage goes below 9V (or any other useful level).
This ensures a valid VCC level during Eeprom write operation.
Yes, it is better to do a KlausST mentions. Use a 10000uF 50V capacitor at the input of 7805. 10000uF 50V is easily available. Then use a voltage divider and scale the 7805 input voltage to adc input pin. If power goes then capacitor voltage slowly decays and when ADC input goes below 4V then start writing to eeprom. During this time there will be still 5V power for PIC.
I checked this program in PIC18F452 , the program working perfectly ,I don't known why this program concept not working in PIC18F2520.
Please give any suggestion to me. I think any problem in IC is there I want to buy new IC and want to check it..........
Maybe you need to buy a new PIC18F2520 and try the code with proper pulse detection circuit. Don't connect to high current circuit. Maybe it has damaged the INT module inside the PIC.
The above routine is just part of the whole code, and it hasn't any directive to handle the fuse of the brown-out-detector, which sugests that you likely programmed it differently on each device.
Same Problem in New IC PIC18F2520. It is working well in 40 Pin PIC18F452 but is not working PIC18F2520 .
My problem is when Interrupt Program want to run when RB0 is 5 volt to GND connected.
But my concept is working well in PIC18F452.
Help me to solve the Problem.
Problem Solved by using Optocoupler.
Led side is given to 5V power using 1K resistor.
Transistor side I connected one for GND and other to RB0.
If 5v is off means RB0 goes to null state and Interrupt is working.