However, it’s possible to configure the 8-pin of any port all at once instead of bit-by-bit changes as follows Which means that writing the following values to these bits will cause the following effects Value Bit Effect 1 TRISB0 RB0 pin becomes an input pin 0 TRISB1 RB1 pin becomes an output pin 1 TRISC4 RC4 pin becomes an input pin 0 TRISD3 RD3 pin becomes an output pin And so on… Writing 0 (Low) to a single bit of the TRISx register configures the pin corresponding to this bit to be an output pin.Writing 1 (High) to a single bit of the TRISx register configures the pin corresponding to this bit to be an input pin.Here the function of TRISx register comes in, as the value we write to that register specifies the direction of the corresponding pins (input/output).
Whenever you wish to use an I/O pin, you must first configure it to be an output or input pin. If the pin is configured to be an output pin, then you’ll be driving its state (High / Low) within your program. If the pin is configured to be an input pin, then you’ll be reading (polling) its state several times within your program.
Those couple of pins are used to provide the MCU with the oscillator clock input it needs. The special (non-GPIO) pins are usually the following ones: In fact, most of the pins in a typical microcontroller are GPIO pins except for some special pins. GPIO stands for “ General Purpose Input/Output pins“. Component Name Buy On 1 PIC16F877A Add 1 BreadBoard Add 3 LEDs Add Add 2 Push Buttons Add 1 Resistors Kit Add Add 1 Capacitors Kit Add Add 1 Jumper Wires Pack Add Add 1 LM7805 Voltage Regulator (5v) Add 1 Crystal Oscillator Add 1 PICkit2 or 3 Programmer Add 1 9v Battery or DC Power Supply Add Add Add 7 Checkout My PIC MCU Programming Video Tutorial.
3 How does a digital input/output port work?.