• 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.

Urgent help needed

Not open for further replies.


New Member
Hi there!

I've got the following circuit built onto a PCB, and I have the following problem:

Depending on the entries (pins 3, 5, 6 and 7 of the PIC) the output (pin 2) must be set (5V) or clear (0V). This pin must activate the relay in one of those cases (I don't matter which, just one of them).

The problem: I always get a high level (5V) independently of the entries. I measure this with a multimeter just in the pin 2 of the PIC.

The question: Is the arrangement wrong? Can anyone suggest an alternative for the arrangement? Is the relay correctly used?

Some comprobations I've made:
I took off the PNP 557 and I could register sometimes 0V.
Too, I've changed the program of the PIC until it was so simple that an error would be almost impossible.
I've changed the PIC by a new one (twice).
And I've changed the PNP 557 too.
I tested I wasn't making a mistake with the order of pins of the PNP.
I tested the PCB draw and it fits the schematic.
The resistor is really a 4K7 ohm resistor.
I could light a LED through pin2 taking off the PIC and conecting it into a ProtoBoard.

Please, I need urgent help. Now I'm totally confused. I don't know if it is an analog problem, or digital. I don't know if it's a hardware problem or software.




GP5 has a week pull up resistor if it is configured as an input, are you sure its been made an output in the software? It could also be used as an osc input, so setting it up is often a pain. (This is usually the source of most of my PIC problems -pin configuration).
Only putting 6V into a 7805 regulator may not be giving you 5V. The 7800 series regulators usually like the input to be a few volts higher than the output. If you are using 6V worth of batteries you could probably get away with a diode or two in series instead of the regulator.


New Member
Here's a bit of code I've put in the chip:

ESTADO equ 0x03
PUERTO equ 0x05
bsf ESTADO,5
movlw b'00010111'
movwf PUERTO
bcf ESTADO,5

This is all I've done to configure GP5 as an output. Isn't enough? Should I set or clear another bit anywhere?
Should I increase or decrease the value of the 4K7 resistor for helping the PIC to "clear" the pin (to force 0V there)?

For testing my supply is slightlty over 7,7V. I'll follow your advice when solved the GP5 problem.

Thank you very much for your support. I really need it!


Well-Known Member
I haven't used PICs, but a 741 won't work in this application. See the attached schematic.



New Member
To RonH:

I don't understand you well, sorry. In my circuit, I have no trouble (or I think so) with the 741 part. That block anyway is conected to the pin number 5 which is not GP5 (it's GP2).

I'm not sure if this is the source of trouble or I'm messing myself up...

The problem I have is on pin number 2 where the PNP and the relay is connected. If I'm not understanding you, please, explain it too me in another words.


Well-Known Member
As I said, I have no experience with PICs, so I can't solve your problem with pin 2. The relay and the 557 appear to be connected correctly.
When you solve the problem with pin 2, you will encounter the following problems with the 741:
1. With a 5 volt supply, the output may not have enough peak-to-peak output swing to give you a decent logic level.
2. You have no path for bias current on pin 2. You would need to bias pin 2 up to around VCC/2 with a large resistance (100k) to get the inputs to be within the common-mode range. The 741 will not work unless the inputs are at least 2 volts (and maybe 3 volts, worst case) above ground.

Use a comparator (LM393). The 741 is an op amp. It will work as a slow comparator under the right conditions, but you do not have those conditions in this circuit.



New Member
Ok, I think I understood and I apreciatte your advice. I'll can easily make the changes you proposed. :)

I'll post now a link in the PIC forum. Let's see if anyone of there can help me with the PIC-pin-probl.
Not open for further replies.

Latest threads

EE World Online Articles