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

Pic 16F84A doesnt give any output

Status
Not open for further replies.

Myeou

New Member
hi , i am trying to learn pic programming and basic circuit. So i am unexperienced. I am using pic16f84a with 4 mhz crystal osillator with 22 pf capacitors. Circuit runs on 5 V with 7805 regulator. and this is the code:

#include <16F84A.h>

#define pir input(PIN_A2) // Switch on RA0

void main (void)
{
set_tris_a(0x11);
set_tris_b(0x00);
output_b(0x00);

while(1) { //Forever Loop
output_high(pin_B1);
output_high(pin_B2);
}
}

I import this file with pickit2.
There voltage supply on pic , i can read it with voltameter but somehow there is no output. It isnt work.
Anyone , any idea how to solve the problem ?
 

dr pepper

Well-Known Member
Most Helpful Member
The biggest thing I see is that you set your portb pins high, then nothing else, posrtb,1 and ,2 will be high all the time.
If you want to 'see' something happening try:

while(1) { //Forever Loop
output_high(pin_B1);
output_high(pin_B2);
delay (200);
output_low(pin_B1);
output_low(pin_B2);
}

That will toggle the pins slow enough to see them on a led or logic probe.

Also check the fuses are set correctly in pickit 2.

And yes, welcome.
 

Myeou

New Member
The biggest thing I see is that you set your portb pins high, then nothing else, posrtb,1 and ,2 will be high all the time.
If you want to 'see' something happening try:

while(1) { //Forever Loop
output_high(pin_B1);
output_high(pin_B2);
delay (200);
output_low(pin_B1);
output_low(pin_B2);
}

That will toggle the pins slow enough to see them on a led or logic probe.

Also check the fuses are set correctly in pickit 2.

And yes, welcome.

Thanks for answer. But i am unexperienced in electornics. So how should i check the fuses in pickit 2. i only know how read write or delete a hex file. Its like there is notthing other to do in pickit2
 

Myeou

New Member
As the good doctor prescribed.... You need to set your configuration bits ( also know as fuses )

In particular... Set the OSC to XT and the WDT to OFF
OK i did it. And now it is worked but partially. The new problem is leds are light up. But the light is too weak.
I checked on voltage with multimeter on pins and the output voltage is very unstable.
It goes like 4.00 , 0.10 , 2.12, 3.45 in a second .

Why is this happening ? How can i make it stable ?
 

dr pepper

Well-Known Member
Most Helpful Member
I suspect they are switching rapidly, did you put in the delay?
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top