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

Help!! problems in using PIC16f876A

Status
Not open for further replies.

SHyong

New Member
First of all, i m still a beginner in PIC application. My problem now is i can't program my PIC16f876A for pin_c7 and pin_c6. By the way my pin_c7 always LOW and pin_c6 always HIGH once i plugged in my PIC and also the time i run my program.

Can anyone guide me about this? I really appreciate any comment and guide! thanks :)
 

kpatz

New Member
Make sure SPEN (bit 7 of the RCSTA register) is set to 0. When it's set to 1, the PORTC(6:7) pins are used for the USART instead of regular I/O pins.
 

SHyong

New Member
here is my schematic n code that just use to test the pins.I also tried to pull LOW.


#include <16f876a.H>
#fuses HS, NOWDT, NOPROTECT, nolvp
#USE DELAY (CLOCK=20000000)

void main()
{


loop1: output_high(pin_A0);
output_high(pin_A1);
output_high(pin_A2);
output_high(pin_A3);
output_high(pin_A4);
output_high(pin_A5);
output_high(pin_B0);
output_high(pin_B1);
output_high(pin_B2);
output_high(pin_B3);
output_high(pin_B4);
output_high(pin_B5);
output_high(pin_B6);
output_high(pin_B7);
output_high(pin_C0);
output_high(pin_C1);
output_high(pin_C2);
output_high(pin_C3);
output_high(pin_C4);
output_high(pin_C5);
output_high(pin_C6);
output_high(pin_C7);



goto loop1;

}
 

SHyong

New Member
Make sure SPEN (bit 7 of the RCSTA register) is set to 0. When it's set to 1, the PORTC(6:7) pins are used for the USART instead of regular I/O pins.
I'm sorry, I am still beginner. Can you guide me how to set SPEN to 0 by using CCS-C. Btw thanks for the guide:)
 

blueroomelectronics

Well-Known Member
Nice robot line follower schematic. Make sure you've got a 0.1uF near the PICs power pins.

Hint:
PortB has weak pullups, these are great for putting pushbuttons on as they don't need an external pullup resistor. SW1 thru 4 (just move the LED to another pin) and you can rid yourself of 4 resistors.
Also the NEW 16F886 has a built in 8MHz oscillator plus a handy LVD pin so you can sense your battery level.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top