Signal Conditioning and Data Acquisition System
117603Module 3: Embedded Microcontrollers – PIC18F / Others
Q1(e). Which of the following is NOT part of a typical microcontroller? (i) CPU (ii) RAM (iii) I/O Ports (iv) Hard Disk2025?m
Module 3: Embedded Microcontrollers – PIC18F / Others
View this question on its own page →Which of the following is NOT part of a typical microcontroller?
(i) CPU
(ii) RAM
(iii) I/O Ports
(iv) Hard DiskWorked SolutionAnswer
Correct option: (iv) Hard Disk
Explanation
A typical microcontroller integrates essential computing and control resources on a single chip, such as:
- CPU: Executes program instructions.
- RAM: Temporarily stores variables and runtime data.
- I/O ports: Interface with sensors, actuators and external devices.
- Timers/counters: Generate timing functions and count events.
- Peripherals: May include ADC, communication interfaces, PWM and other modules.
A hard disk is a separate mass-storage device and is not normally an integrated component of a microcontroller.
Therefore, the correct answer is (iv).
Q1(f). A timer in a microcontroller counts: (i) External pulses only (ii) Internal clock pulses (iii) Code instructions (iv) Data bytes2025?m
Module 3: Embedded Microcontrollers – PIC18F / Others
View this question on its own page →A timer in a microcontroller counts:
(i) External pulses only
(ii) Internal clock pulses
(iii) Code instructions
(iv) Data bytesWorked SolutionAnswer
Correct option: (ii) Internal clock pulses
Explanation
A timer in a microcontroller is generally driven by the internal system clock or a clock derived from it. It increments its count at regular intervals and is used for generating delays, measuring time intervals, scheduling tasks and producing periodic events.
A counter can instead be configured to count external events or pulses.
Example
If a timer receives a 1 MHz clock, one clock period is:
The timer can therefore measure time by counting these clock periods.
Therefore, the correct answer is (ii).
Q1(g). RISC microcontrollers are characterized by: (i) Many complex instructions (ii) Simple and fast instructions (iii) No registers (iv) Only analog operations2025?m
Module 3: Embedded Microcontrollers – PIC18F / Others
View this question on its own page →RISC microcontrollers are characterized by:
(i) Many complex instructions
(ii) Simple and fast instructions
(iii) No registers
(iv) Only analog operationsWorked SolutionAnswer
Correct option: (ii) Simple and fast instructions
Explanation
RISC (Reduced Instruction Set Computer) microcontrollers use a relatively small and simple instruction set. Instructions are designed to execute efficiently, often in a small number of clock cycles.
Main characteristics of RISC
- Small and simple instruction set.
- Fast instruction execution.
- Large or efficient register usage.
- Simple instruction formats.
- Efficient pipelining in many architectures.
- Suitable for embedded real-time applications.
This approach makes the processor easier to implement and can provide high performance for a given clock frequency.
Therefore, the correct answer is (ii).
Q4(b). Explain the architecture of a microcontroller with neat block diagram. Describe the basics of assembly language and C-language programming used for microcontrollers.20257m
Module 3: Embedded Microcontrollers – PIC18F / Others
View this question on its own page →Explain the architecture of a microcontroller with neat block diagram. Describe the basics of assembly language and C-language programming used for microcontrollers.
Worked SolutionSolution: Microcontroller Architecture, Assembly and C Programming
Microcontroller Architecture
A microcontroller is a compact integrated circuit containing a processor, memory, I/O and peripherals for embedded control applications.
┌─────────────────────┐ │ CPU │ │ ALU + Control Unit │ │ Registers │ └──────────┬──────────┘ │ System Bus ┌────────────────┼────────────────┐ ↓ ↓ ↓ Program Memory Data Memory I/O Ports Flash/ROM RAM/EEPROM GPIO │ │ │ └────────────────┼────────────────┘ ↓ Timers / Counters ADC / PWM / DAC SPI / I²C / UARTMajor blocks
- CPU: Executes instructions.
- ALU: Performs arithmetic and logical operations.
- Registers: High-speed temporary storage.
- Program memory: Stores firmware.
- RAM: Stores temporary variables and stack data.
- EEPROM/Flash: Stores non-volatile data or program code.
- GPIO: Interfaces with external sensors and actuators.
- Timers/Counters: Generate delays and measure/count events.
- ADC/DAC/PWM: Interface between digital electronics and analog systems.
- Communication peripherals: SPI, I²C, UART/USART and others.
Assembly Language Programming
Assembly language uses processor-specific mnemonics representing machine instructions.
Example:
MOVLW 05H MOVWF COUNT INCF COUNT, FThe exact instructions depend on the microcontroller architecture.
Advantages
- Precise hardware control.
- Efficient execution.
- Small and predictable code.
Limitations
- Difficult to write and maintain for large applications.
- Processor-specific.
C Language Programming
C provides structured, readable programming while still allowing direct hardware control through registers, pointers and bit operations.
Example:
#include <stdint.h> int main(void) { uint8_t count = 0; while (1) { count++; } }In practical firmware, initialization functions configure clocks, GPIO, ADC, timers and communication peripherals before the main loop executes.
Assembly vs C
Feature Assembly C Readability Low High Hardware control Very direct Direct through registers/APIs Portability Low Higher Development time Longer Shorter Optimization Can be highly optimized Compiler-dependent Conclusion
A microcontroller combines processing, memory and peripherals in one device. Assembly provides low-level control, while C provides a practical balance of performance, readability and portability for embedded DAQ applications.
Q5(a). Describe the working of ADC and DAC in a microcontroller system with examples.20257m
Module 3: Embedded Microcontrollers – PIC18F / Others
View this question on its own page →Describe the working of ADC and DAC in a microcontroller system with examples.
Worked SolutionSolution: ADC and DAC in a Microcontroller System
ADC: Analog-to-Digital Converter
An ADC converts an analog voltage into a digital code that a microcontroller can process.
Working
Analog Sensor → Signal Conditioning → ADC → Digital Code → CPU- The analog signal is applied to the ADC input.
- The ADC samples the signal.
- The input range is divided into discrete levels.
- The nearest digital code is generated.
- The microcontroller reads the code and converts it into engineering units.
For an ideal -bit ADC with input range :
Approximately, the ADC code is:
Example
For a 10-bit ADC with 0–5 V input:
DAC: Digital-to-Analog Converter
A DAC converts a digital number generated by the microcontroller into an analog voltage or current.
CPU → Digital Code → DAC → Analog Voltage → ActuatorFor an ideal -bit voltage DAC with reference :
The exact transfer equation depends on the DAC architecture and datasheet conventions.
Applications
- ADC: temperature, pressure, light and biomedical sensors.
- DAC: waveform generation, motor control references, audio and analog actuator control.
ADC vs DAC
Feature ADC DAC Conversion Analog → Digital Digital → Analog Input Voltage/current Digital code Output Digital code Analog voltage/current Use Measurement Control/output generation Conclusion
ADC enables the microcontroller to measure the physical world, while DAC enables it to generate controlled analog outputs.