Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i am having problem with RB6 pin in PIC16F877a

Status
Not open for further replies.

viccram

Junior Member level 1
Joined
Oct 15, 2007
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,433
pic16f877a pin 39

i am using pin no. 39 (RB6) as an input pin using and enabled interrupt on change feature. while using other three pins(RB4-RB7 exvept RB6) as input the system has no problem...but when i use this pin as input the system doesnt always work properly.....

the input is a pulled up pin with a switch connected to ground.. when i press the switch pin goes low else normally high (as it is pulled up to Vcc)...
the problem is that when i press the switch the pin goes low(around .023V) but as i leave the switch the pin still remains low (around .16V to .189V)
i hav tested the switch and the circuit noise level as well....
switch is fine and the circuit noise level is around 600mV...
how much noise prone is PIC?
and Registers should i think of while initializing pin RB6 as input
RB6 is used as PGD in programming...so is this problem related to this typical feature of the pin???
 

rb0 pin problem

Pic chips are pretty robust so noise should not be a problem. If the pin is configured as an input and is staying low after releasing the switch despite being pulled up, I would double check your input circuit just to make sure its ok.
RB6/PGC pin is also used by the ICD2 debugger.
Make sure that you are programming it for release and not debug. It might be the debugger trying to say something on RB6.
 

its just a simple ckt...

i am using this pin as a i/p from limit switch in my robot... on pressing the switch the motor is supposed to stop but the motor does not stop sometimes (eg. the case is once in every 10 times)

so i think its not a basic circuit problem....is it because of spikes in motor that is producing noise in circuit...or is there any probability that the PIC goes into to some other mode (like sleep or BOR or WDT timer problem may be...)
but i have used this configuration word in program

__CONFIG(HS & WDTDIS & PWRTEN & BORDIS & LVPDIS);

i am using a 11.0592Mhz Xtal....does PIC 16F877a support this xtal???
am i using "HS" the right term for this XTAL???
 

Have you tried it on a different pin? Because I had the same problem, but I was using 18F458. I switched the input pin and then it worked fine for some reason, so I just got a new PIC and it worked how it was supposed to. Try using a new PIC and see if that works.
 

ya Mr Carnal....
is this PIC manufacturing fault or what?
does any one hav any better solution to it....?
changing PIC did not work for me
and neither do i hav a xtra i/p pin on my system...

My system goes MAD and i am going crazy with this problem...
 

It could be noise from the motor screwing up the input.
Put a filter on the input line, a series 33K resitor close to the pin with a 0.1nF cap to ground close to the pin between the resistor and pin.
 

thats not noise problem
i hav tested it and also reduced the noise in motors but the as soon as the pin goes low the PIC doesnt work

i am using hi-tech PIC C compiler....
do u hav any idea wat happens when my program becomes bigger
my program is a little large one and i hav not considered the memory of PIC into account till yet..
is this because of that?

i read this somewhere:
If your PIC hangs, check the EXTENDED INSTRUCTION SET flag :
If set, your program (or your compiler) must take it into account to use the correct addressing methods.
If not set, your program (or your compiler) must use standard addressing modes.



wat is EXTENDED INSTRUCTION SET flag?
how do i check this?
 

Hi,
If you do not have other spare pins, at least swap the connections between pins 5 and 6 and if the problem shifts to 5, then it is your motor circuit ( once in a while sticky switch, hope the pull up resistor current is within the switch specification?), if the probelm sticks to pin 6 then it is PIC, the culprit, and if the problem vanishes, then you still have to find out the reason.

Regards,
Laktronics
 

on changing the pin the problem still persists on the same pin....
i changed the switch to another motor i/p but the robot goes wild when i i press the switch corresponding to same RB6 pin
and if i shift to RB0...this problem is in pin RB0 as well...both pins are going crazy

the problem is solved to some extent if i use another motor but i need the very same motor as it is just enough to produxe torque to lift the load. When a add a power resistor in series with motor the problem is solved but there is very less torque to lift the load....so this doesnt help me....

i am wondering why is this happening?
i feel like i have missed some initialization or something like that in programming
 

Hi,
Hope you have set the TrisB register bits to make RB pins as input. If so, it appears there is interraction between the motor circuit and the PIC circuit. Are you using mixed ground and supplies connections?. Try to isolate Rb 6 pin through a resistor and an reverse diode. Use suppressor diodes across motor coil. Can you show a section of the schematic of Rb 6 and associated motor connectin?

Regards,
Laktronics
 

is it possible to use suppressor diodes if the motor runs in both directions???

can any one give suggestion on how to remove noise on two circuits....

i hav an interfacing ciruit on a cardboard on the back side i hav motor driver circuit...is this due to interference...
The i hav designed the PCB of driver and interfacing circuits on my own
is this problem due to bad routing in PCB??
 

Hi,
Yes, you can use two zeners rated about 20% more than the motor voltage, connected back to back across the motor coil. Take care of the power rating. By the way what is the rating, current and volatge, of your motor? Also you will get transorbs with suitable ratings for high power applications.
Since most of the circuit is working, it may be due to power supply coupling. Proper isolation of power supply might be sufficient.
What abot Trisb setting?
Also shifting the power section physically from logic section is always better.

Regards,
Laktronics
 

Extended instruction set doesnt apply to the 16f micros. It is used by the 18f micros.
If you ran out of memory, the program wouldnt compile and run, so I dont think thats your problem.
Try the series resistor, see if it works.
 

Try using an external pullup resistor. Data sheet says:
"Three pins of PORTB are multiplexed with the In-Circuit
Debugger and Low-Voltage Programming function:
RB3/PGM, RB6/PGC and RB7/PGD."
and
"Each of the PORTB pins has a weak internal pull-up. A
single control bit can turn on all the pull-ups."
So I would suggest using an extrenal pullup to +5V through a 4.7 to 10 K resistros, I went nuts over the behaviour of B5 which once pulled to low via a switch always kept floating, despite the fact that internal pullups were defined in the firmare, while I was making the code in picbasic, then a friend of mine who did the coding in C, told me to use an external pullup and that resolved the issue once and for all.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top