Back to the 2026 paper

Module 3: Embedded Microcontrollers – PIC18F / Others

20267m

Describe the architecture of a PIC18F microcontroller and discuss the role of timers and counters.

Worked SolutionAI Assisted

PIC18F Architecture

The PIC18F family is an 8-bit RISC microcontroller from Microchip with Harvard architecture (separate program and data buses), so instructions and data are fetched at the same time.

MermaidDiagram
Rendering diagram…

Main features

Block Description
CPU 8-bit, 16-bit instruction width, about 75 instructions, hardware multiplier 8x8
Program memory Flash, 16 KB to 128 KB
Data memory SRAM up to 4 KB, banked, plus special function registers
EEPROM Non-volatile storage for settings
I/O ports PORTA to PORTE with TRIS direction registers
Peripherals 10-bit ADC, comparators, CCP/PWM, UART, SPI, I2C
Interrupts Priority-based, high and low levels
Clock Internal or external oscillator with PLL

Timers and counters

A timer counts internal clock pulses (fosc/4f_{osc}/4), so it measures time. A counter counts external pulses on a pin, so it counts events.

Timer Size Typical use
Timer0 8 or 16 bit Delays, event counting
Timer1 16 bit Real-time clock, capture
Timer2 8 bit PWM time base
Timer3 16 bit Capture/compare

Delay: T=(65536−preload)×prescaler×4/foscT = (65536 - preload) \times prescaler \times 4/f_{osc}.

Applications: periodic ADC sampling, PWM motor control, pulse width and frequency measurement, timeouts.

Exam tip

Draw the block diagram, name Harvard architecture and give the timer vs counter difference.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.