This article totally depends on my experiences when I doing some microcontroller projects based on PIC16f877A. Further more following article describe the answers which I found for following questions.
Make RA4(4th bit of PORTA) as a digital output.
Make RA4(4th bit of PORTA) as a digital output.
All the bits on all the ports in PIC16f877A microcontroller can be configure as digital input or output except RA4. All other bits on ports can be configure as a digital I/O by changing its TRIS register's values and configuring ADCON1 register(for analog input pins). But if we consider about RA4 pin, its behavior different than other I/O pins.
RA4 is an open collector I/O pin. Therefore when we want to use RA4 as a digital output, we have to pull up RA4 by a resistor. This approach can be understand by following example.
This is an example program to use RA4 as a digital output using Hi-Tech C.
Finally what we have to do is, supply a current to LED attached to RA4 and change the logic to on and off the LED.
Status on RA4 | LED status |
1 (High) | Off |
0 (Low) | On |
References and further readings-
The best source for understand the behavior of the PIC is "Data sheet".
This is a cropped part from PIC16f877A data sheet.
All the bits on PROTB can be used as digital input except RB3. Because by default the Low-Voltage ICSP Programming (LVP) is enabled in PIC16f877A which lead to disable RB3 I/O function. If you do not use LVP, you can disable LVP by following these steps in MPLAB IDE.
- Configure
- Configuration bit.
- Uncheck Configuration Bits set in code.
- Select disable on LVP field.
- Close and recompile the code.
References and
further readings-
The best source for understand the behavior
of the PIC is "Data sheet".
This is a cropped part from PIC16f877A data sheet.
This comment has been removed by a blog administrator.
ReplyDeleteThank you for info, But please don't use my blog for any business purposes, If you need to send any information for me, Please send me an email to my personal mail which you can find on
Deletehttp://milindapro.blogspot.com/p/about-me.html
But please can u post the datasheet page number wehere u cropped…
ReplyDelete