1.PORTA has 6 bits (RA0~RA5), and the PORTA port module has three special registers: PORTA, TRISA, ADC in 1. PORTA port has the same pin combination function, and the internal structure of each pin is also inconsistent. The setting of three registers can control the application of PORTA port as a digital I/O port. After the system is reset, PORTA will automatically become an analog input state and can read analog input signals. PORTB is an 8-bit wide digital I/O port (RB0~RB7). Generally, only two pins, RB6 and RB7, have multiplexing function. When the chip is programmed and debugged online, RB6 is used to program the serial clock pin PGC and RB7 is used to program the serial data pin PGM. This is a special function reuse mode, which is impossible when the chip works normally. There are four special registers associated with the PORTB module. As a digital I/O port, PORTB port can program the input/output direction and state. PORTC has 8 bits (RC0~RC7) and 2 related special registers. After the microcontroller is powered on, the values of the output data register PORTC are random, and the values of the direction register TRISC are all 1. Therefore, in the initial state, each pin is in the input mode, showing high impedance state. By defining the value of the TRISC register, you can specify whether the pin is set to input mode or output mode. Besides being used as digital I/O, it also shares pins with some peripheral circuits with special functions. PORTC is an 8-bit wide bidirectional digital I/O port (RC0~RC7) with three related special registers, which adds the function of parallel slave port on the basis of basic input/output function. In addition, when each pin is used as an I/O pin, the input signal must be input into the buffer through its internal Schmitt trigger, which can shape the input signal waveform, and when working in parallel slave port mode, it is input through TTL buffer. PORTC can be used as a general digital I/O or shared with PSP (parallel slave port) as a transmission interface. When the whole system needs multiple single-chip computers, it can transmit data quickly through parallel transmission interface;
PORTE has only three pin bidirectional I/O ports (RE0~RE2) and three related special registers. On the basis of basic input and output functions, parallel slave port and analog input function are added. After the microcontroller is powered on, the values of the output data register PORTE are random, and the values of the direction register TRISC are all 1. Therefore, in the initial state, each pin is in the input mode, presenting a high impedance state to the outside. By defining the value of the TRISE register, you can specify whether the pin is set to input mode or output mode. 2. From the internal structure of RA4, it is very different from other ports of PORTA port, and it is not multiplexed into analog signal input. Generally speaking, it has two functions: a public digital I/O port and an external digital pulse input port (TOCKI) for timing TMR0. The characteristics of RA4 are as follows: (1) Like other ports, the input is high impedance state. (2) When the output level is low, like other ports, the current of the circuit outside the suction port and the voltage on the pin are close to 0V. (3) When the output level is high, it is quite different from other ports. The RA4 port has only one N-channel field effect driver, but no P-channel field effect driver, so the RA4 pin is in an open drain state and hangs when the output level is high. Improvement method: try to design it as low as possible. If a high level is needed to drive the peripheral circuit, a pull-up resistor must be added to the RA4 pin. The range of pull-up resistance is about 1kω~ 10kω. 3. Yes, the option register section is also a read/write register, which contains control bits related to TMR0, frequency divider and port RB. Port Rbo has the same pin as external interrupt INT***, and the two control bits related to this pin have the following meanings: 1=RB port weak pull-up circuit is disabled 0=RB port weak pull-up circuit is enabled, so the weak pull-up circuit of each pin of this port cannot be programmed separately.