Continue to Site

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.

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

PIC16F873 bits not turning on....

Status
Not open for further replies.

forever99482

New Member
Hi,

I've been playing around with the PIC16F873 and I've programmed it to turn on 1 bit at a time, i.e. RA0 then RA1 then RA2... every other bits(in PORTA to C) turned on except RA4, RB3 and RC3,4,5. I programmed it using mikroE's PICFlash with the EasyPIC3 board. Any idea what could have gone wrong?
 
RA4 = Output is open drain type. If you want to turn on LED with it, you need to connect the LED ANODE pin to 5V and CATHODE pin to RA4 and turn ON the LED by output 0.

RB3 = LVP is enabled by default which disables the IO function. If you want to use IO then you need to disable LVP.

RC3,4,5 - PORT C is used for I2C and SPI serial communication. Not sure whether SPI/I2C are enabled by default or not. If it is enabled by default then you will need to disable it in order to use it as IO.

HTH
 
I have changed the code so that all the leds on the board should turn on

the code is written in mikroC, so it is like this..

void main()
{
TRISA=0X00;
TRISB=0X00;
TRISC=0X00;
PORTA=0XFF;
PORTB=0XFF;
PORTC=0XFF;
}

On the EasyPIC3 board, similar problems occured, so I tested it with a breadboard and an oscilloscope, however, PORTA bit4 is not giving out a 5V as it should, is it due to the drain type output feature?

Thanks in advance
 
Yes.
Refer to the block diagram of RA4 on page 29 of the datasheet.
Based on the block diagram, RA4 cannot output 5v. However, it can output 0V when it is grounded through the CMOS.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top