pang khong lin wrote:
{Quote hidden}>First of all thanks to those who response to my help. basically, i found out
>that the problem does
>not lies in the pin RB3 that controls the relay. as i analyse it, the first
>issue that i suspect is that the
>program does not responds to the subsequent interrupt. The interrupt is
>connected to a telephone
>ringing signal detector. usually these circuits consist of some cap and
>optocoupler
> _________ supply
>Tip -------cap------------------ | /
> | ^ | /
> diode diode -----|/
> V | | |\
> | | | | \
> | | | | \----270 ohm ---|
>Ring -----3.6 k Ohm-------------- | | |
> | |
> -----10Mohm--------------|
> | |
> | |
> |---------cap1uF---------|
> |
> |
> Gnd
>
>Both the diode and transistor are the opto coupler. And i connect
>RB0/Interrupt to the collector output.
>Initially i thought that the 1uF cap is the culprit. since it has no way of
>discharge or that it is discharging
>too slowly and when the next ringing signal comes, the rising edge is not
>sharp enough. I confirm this
>by touching the base with the ground and try to make another call. it
>works, the pic recognise the next ringing
>signal. then i attempt to decrease the resistor and cap, but it doesn't
>works.
RB0 uses the H -> L transition to trigger.
>To keep things brief, i found out that the fault is with the RBPU of the
>option register. Once i disable the
>portB pull up then the PIC response to the first and all the ringing signal
>( Interrupt )
The pullup is in parallel with the transistor the way you have hooked it up.
Rearrange your circuit to pull RB0 low when the transistor conducts.
You imply that the transistors emitter goes to V+ but all the opto's
that I've seen are NPN. Connect the emitter to GND with the resistor
between collector and V+. The resistor can be 4K7. Connect RB0 to
the junction of resistor and the collector. You can maybe even delete the
4K7 if you use RBPU. The 10M and 1u can probably stay the same.
{Quote hidden}>Eventhough the problem is solve, several question still looms in my mind.
>1. Why the PIC responds to all the ringing signal when RB3 is connected to
>only a resistor?
>( which makes me think that it is the relay problem )
>2. Why the RB0 /Interrupt outputs a 2.0V even though it is configure as an
>interrupt pin?
>
>in addition, i found out that, to use the interrupt, pin RB0 must be
>configured to be an input pin and that
>the pull up is still activated even if the pin is configured as interrupt.
>
>Finally, the last problem which i still have is the power up problem.
>Everytime i power up, all the io pins go
>hay wire. I have already inplemented the 'slow Vdd rising' circuit shown in
>the reference manual for 16f84.
>but i still need to switch on and off for a number of times before i get it
>correct. i have play with all kinds
>of capacitor value 0.1uF, 0.01uF etc. i have also tried adding a switch
>between the MCLR and ground to
>allow for Reset. But it doesn't work. I am using a battery as power source (
>4 x 1.5V ).
>
>Can anyone tell me how to make sure that everytime i power up, it will power
>up properly? and the right way
>to reset ? battery power is suppose to be very reliable, stable right?
<rant>
Many (including me) have warned you that the battery supply is out of spec.
Try running the circuit from a regulated 5V supply. You must address the
very basic issue of power before you ask any more questions.
</rant>
Regards...
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads