krys WROTE:The MCLR is blue so I supposed it's high. Sorry I can't be sure. I learned PIC on my own since my major course doesn't include PIC as a subject.
I try modify my schematic according to your design. The green LED doesn't turn on at all. The red LED turned on and does blink but the other two remain off. And the MCLR turned red. Why's the change?
I noticed you changed the resistor value from 4.7k to 10k (the one connecting to diode and MCLR). When I used the original value, the voltage becomes an exponential value and keeps on varying. But when I changed it to 10k, the voltage stabilized to 4.77V. Is that the purpose of your decision to change the value?
Why do you only connects the PIR2 to reset switch? What's the function of it? Why not connects the PIR1 to reset switch as well? When I run the simulation, there's an error stating that input B is connected to an analogue net - which is referring to the PIR2 reset switch. How to fix that?
The buzzer did not beep even after I modify the design. So, I try to add digital speaker to it. It does produce a beep. So if I convert it to PCB and make a hardware out of it, can I take it as my buzzer works properly? (since the speaker is just a test I carried out to know whether the buzzer works or not)
Blue=logic L, Red=logic H and grey=NC or open. Since your MCLR is L when running, that means your PIC is not getting a power up reset so it wont run properly.
[edit] I notice now that your reset button is in the ON state, so that's why your PIC is in the reset state. And that's the reason your circuit won't run at all.
The resistor connected to MCLR can be any value from 1K to 20K. You can try 10K on your circuit and see if it works????
I dont know what happens to the way you layout your schematics. But it seems your circuit on page 2 doesnt connect to your circuit in page 1 and that's why your simulations failed.
You have to study the sample program in C and unserstand what is going on. In the program only the button connected to RA0, the LED connected to RC0 and the sensor connected to RB2 plus the buzzer are used. The rest are just there for you to use them in your own program. They are not involved in the sample program. The PB-PIR is not a reset button. It is pressed to simulate a PIR alarm.
Allen