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.

How to use pin RA4 as digital I/O port? plz help

Status
Not open for further replies.

goug

New Member
I am using PIC 16F877A for a big project, I already used all available ports, but having some problems with PORTA.

I want to use PORTA as a digital I/O port. I just found in 16F877A datasheet how to configure pins 0,1,2,3 and 5 as digital I/O (ADCON1 = %00000111); but can't find how to configure pin 4.

I just can't set or clear pin 4 of PORTA :confused:

could anyone help please?
 
>> Using RA4 as an output (TRISA = 0) <<

I tried with the pull-up resistor on pin RA4 (1k + 5V):

Result: RA4 remains high whether it's set or cleared by the PIC!
I don't want that :confused:

What could be the problem? (maybe RA4 can not be configured as output? set and cleared when needed)
 
Last edited:
RA4 should work fine as an open collector output with a pull-up resistor to +5v.

One thing that could cause you a problem is that RA4 is also used as an output for the comparator module.
The comparator module is turned off by default at power-on, so should not cause any problem unless you have enabled it.
See section 12 of the data sheet.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top