The PIC16F72-I/SP operates as an 8-bit Harvard-architecture RISC microcontroller with separate program and data memory buses.
Harvard Architecture: The PIC16F72 uses a modified Harvard architecture where program memory and data memory have separate address spaces and buses. The program memory bus is 14 bits wide (to accommodate 14-bit instructions), while the data memory bus is 8 bits wide. This separation allows simultaneous access to instruction and data, improving throughput compared to von Neumann architectures where instruction and data share the same bus.
RISC Instruction Set: The instruction set consists of only 35 single-word instructions (except for program branches which are two-cycle). Most instructions execute in a single cycle (200 ns at 20 MHz). The instructions are 14 bits wide and include arithmetic (ADD, SUB), logical (AND, OR, XOR), data movement (MOV, SWAP), bit manipulation (BSF, BCF, BTFSS, BTFSC), and control (GOTO, CALL, RETURN, RETLW) operations. The simple instruction set reduces code size and execution time for control-oriented applications.
Pipeline Operation: The PIC16F72 uses a 2-stage pipeline: while one instruction is being executed, the next instruction is being fetched from program memory. This overlapping enables most instructions to execute in a single cycle. Branch instructions (GOTO, CALL) take two cycles because the pipeline must be flushed and refilled with the target instruction.
Program Memory: The 2K x 14-bit Flash program memory stores the application code. The program counter is 13 bits wide, allowing addressing of up to 8K locations (the PIC16F72 uses only 2K of this space). The reset vector is at address 0x0000, and the interrupt vector is at address 0x0004. The Flash is in-circuit serial programmable (ICSP) via the PGD and PGC pins, allowing firmware updates without removing the device from the board.
Data Memory (RAM): The 128 bytes of data memory are organized as a banked register file. The data memory is divided into four banks (Bank 0-3), each up to 128 bytes. Special Function Registers (SFRs) that control the peripherals occupy the lower addresses in each bank. General-Purpose Registers (GPRs) for user variables occupy the upper addresses. The bank is selected by the RP1:RP0 bits in the STATUS register. Most applications use only Bank 0 and Bank 1 for the majority of operations.
8-Level Hardware Stack: The hardware stack stores return addresses for CALL instructions and interrupt service routines. The stack is 13 bits wide (matching the program counter) and 8 levels deep. There is no stack overflow or underflow detection; exceeding 8 nested calls causes the oldest return address to be lost. The stack is not accessible as data memory (unlike some other MCU architectures).
Interrupt System: The PIC16F72 has a single interrupt vector at 0x0004. All interrupt sources share this vector, and the interrupt service routine must poll the interrupt flag bits to determine which source triggered the interrupt. Interrupt sources include: TMR0 overflow, TMR1 overflow, CCP capture/compare, MSSP (SPI/I2C) events, A/D conversion complete, and external INT pin (RB0). The INTCON, PIE1, and PIR1 registers control interrupt enables and flags.
Timer0: 8-bit timer/counter with an 8-bit programmable prescaler (1:2 to 1:256). Can be clocked from the internal instruction cycle clock (FOSC/4) or from an external pin (RA4/T0CKI). The prescaler is shared with the watchdog timer; it can be assigned to either Timer0 or the WDT, but not both simultaneously.
Timer1: 16-bit timer/counter with a programmable prescaler (1:1, 1:2, 1:4, 1:8). Can be clocked from FOSC/4, from an external pin (RC0/T1CKI), or from an external 32.768 kHz crystal oscillator connected to the T1OSO and T1OSI pins. The crystal oscillator option allows Timer1 to serve as a real-time clock that continues running during SLEEP mode.
Timer2: 8-bit timer with an 8-bit period register (PR2) and both a prescaler (1:1, 1:4, 1:16) and postscaler (1:1 to 1:16). Timer2 is primarily used as the PWM time base for the CCP module. When TMR2 equals PR2, it resets on the next cycle and triggers the postscaler.
CCP Module: The Capture/Compare/PWM module operates in three modes. (1) Capture mode: captures the Timer1 value when an event occurs on the RC2/CCP1 pin (rising edge, falling edge, or every 4th/16th rising edge). (2) Compare mode: generates an interrupt or output event when Timer1 matches the CCPR1 register value. (3) PWM mode: generates a PWM signal with 10-bit duty cycle resolution on the RC2/CCP1 pin. The PWM period is set by PR2 and the Timer2 prescaler; the duty cycle is set by the CCPR1L register and the CCP1X:CCP1Y bits.
ADC Module: The 5-channel 8-bit ADC converts an analog input voltage on one of the AN0-AN4 pins (RA0-RA4) to a digital value. The conversion uses a successive approximation algorithm with a conversion time of approximately 20 us at the maximum recommended clock rate. The ADC reference voltage is the supply voltage (VDD). The result is stored in the ADRES register.
MSSP Module: The Master Synchronous Serial Port can be configured as SPI master or I2C slave. In SPI mode, it generates the clock (SCK) and controls data transfer to external SPI devices. In I2C mode, it responds to the I2C slave address, receiving and transmitting data under master control. The I2C implementation supports 7-bit addressing and standard mode (100 kHz).