[Menu]>[Guide to use the PIC]>[628 Hardware]

I/O ports of PIC16F628
The function of the port must be set according to the purpose.
On this page, I will explain function setting registers of each port.
Pin numberFunctionSetting registers
1RA2CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
AN2CM2-0 bits of CMCON register are set according to need. ( Default is "000" )
VREFVRON bit of VRCON register is set as "1". ( Default is "0" )
2RA3CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
AN3CM2-0 bits of CMCON register are set according to need. ( Default is "000" )
CMP1CM2-0 bits of CMCON register are set as "110". ( Default is "000" )
3RA4 CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
T0CS bit of OPTION_REG register is set as "0". ( Default is "1" )
T0CKIDefault
CMP2 CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
T0CS bit of OPTION_REG register is set as "0". ( Default is "1" )
4RA5MCLRE bit of Configuration Word is set as "0".
MCLRMCLRE bit of Configuration Word is set as "1".
Vpp MCLRE bit of Configuration Word is set as "1".
LVP bit of Configuration Word is set as "0".
6RB0 When an interruption function is used, RBIE bit of INTCON register is set as "1".
( Default is "0" )
INT INTE bit of INTCON register is set as "1". ( Default is "0" )
INTEDG bit of OPTION_REG register is set according to need. ( Default is "1" )
7RB1Default
RXSPEN bit of RCSTA register is set as "1". ( Default is "0" )
DT SPEN bit of RCSTA register is set as "1". ( Default is "0" )
SYNC bit of TXSTA register is set as "1". ( Default is "0" )
8RB2Default
TXSPEN bit of RCSTA register is set as "1". ( Default is "0" )
CK SPEN bit of RCSTA register is set as "1". ( Default is "0" )
SYNC bit of TXSTA register is set as "1". ( Default is "0" )
9RB3Default
CCP1CCP1M3-0 bits of CCP1CON register are set according to need. ( Default is "0000" )
10RB4Default
PGMLVP bit of Configuration Word is set as "1".
11RB5Single function
12RB6Default
T1OSOT1OSCEN bit of T1CON register is set as "1". ( Default is "0" )
T1CKITRM1CS bit of T1CON register is set as "1". ( Default is "0" )
PGCProgramming mode
13RB7Default
T1OSIT1OSCEN bit of T1CON register is set as "1". ( Default is "0" )
PGDProgramming mode
15RA6FOSC2-0 bits of Configuration Word are set as "011", "100" or "110".
OSC2FOSC2-0 bits of Configuration Word are set as "000", "001" or "010".
CLKOUTFOSC2-0 bits of Configuration Word are set as "101" or "111".
16RA7FOSC2-0 bits of Configuration Word are set as "100" or "101".
OSC1FOSC2-0 bits of Configuration Word are set as "000", "001" or "010".
CLKINFOSC2-0 bits of Configuration Word are set as "011", "110" or "111".
17RA0CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
AN0CM2-0 bits of CMCON register are set according to need. ( Default is "000" )
18RA1CM2-0 bits of CMCON register are set as "111". ( Default is "000" )
AN1CM2-0 bits of CMCON register are set according to need. ( Default is "000" )