Cte 441
Cte 441
System Development
1. Requirements Analysis
2. System Design
The objective of this stage is to develop a comprehensive plan for the system. This includes
selecting an appropriate microprocessor based on performance, cost, and power consumption,
deciding on necessary peripherals such as sensors, actuators, and communication modules, and
determining how they will interface with the microprocessor. Additionally, the overall system
architecture is developed, including data flow, control flow, and interconnections. Memory
design is planned to optimize the use of RAM, ROM, and other storage devices, while ensuring
the system has a reliable and suitable power supply.
3. Hardware Development
The objective of the Hardware Development stage is to build the physical components of the
system. This involves creating detailed circuit diagrams (schematics) that outline all components
and their connections, designing the printed circuit board (PCB) layout to accommodate these
components, and assembling a prototype for initial testing. Additionally, necessary components
and materials are sourced to complete the development.
4. Software Development
This stage aims to create the software that will run on the microprocessor. This involves writing
firmware, which is low-level code that directly interfaces with the hardware, and developing
application software that delivers the system's main functionality. If required, a Real-Time
Operating System (RTOS) is implemented to manage time-critical tasks, and drivers are
developed to facilitate communication with peripherals.
The objective of this stage is to ensure that the hardware and software work together as intended.
It involves unit testing to verify the correct operation of individual components and modules,
integration testing to assess the interaction between hardware and software components, and
system testing to check the complete system against requirements. Additionally, debugging is
performed to identify and resolve any issues found during testing, and validation is conducted to
confirm that the system meets all specifications and requirements.
6. Implementation
The objective of the Implementation stage is to deploy the system in its intended environment.
This includes installing the system in its operational setting, training end-users or operators on
how to use it effectively, and providing detailed documentation such as user manuals, design
documents, and maintenance guides to support ongoing use and upkeep.
7. Maintenance
The Maintenance stage ensures the system continues to operate correctly and efficiently over
time. This involves continuously monitoring system performance, applying necessary software
updates and hardware upgrades, diagnosing and repairing any issues that arise, and collecting
user feedback to make iterative improvements to the system.
In developing a microprocessor-based system, certain tools and components are required. These
include EPROM programmers, EPROM erasers, assemblers, cross assemblers, simulators, and
emulators.
EPROM Programmers
EPROM programmers are specialized devices used to write data into EPROM (Erasable
Programmable Read-Only Memory) chips. They allow for the creation and modification of
EPROMs, which are used to store firmware, software, or data in embedded systems and other
electronic devices. The programmer facilitates the transfer of binary code from a computer to the
EPROM chip, making it ready for use in various electronic applications. It is an essential tools in
the development and production of electronic systems that rely on EPROM technology.
The working principle of an EPROM programmer involves several key steps. First, the EPROM
chip is inserted into the programmer’s socket or adapter. The programmer is then connected to a
computer, where software provides the binary data to be written. The programmer’s firmware
translates this data into a format suitable for the EPROM chip. During the programming process,
the programmer sends electrical signals to the EPROM chip, applying high voltage to the
appropriate pins to set the bits of memory cells to their desired states. This action alters the state
of the memory cells to store the binary data. After programming, the programmer often verifies
the data by reading it back from the EPROM chip to ensure that the write operation was
successful and that the data matches the intended code.
1. Development: During the design and development phase, engineers use EPROM
programmers to load test firmware or software into EPROMs. This allows for the testing
and debugging of the code in real hardware.
2. Production: In manufacturing, EPROM programmers are used to mass-produce
programmed EPROMs that will be installed in devices. This ensures that each device has
the correct firmware or software before shipping.
3. Field Updates: In some cases, EPROMs can be reprogrammed with updated firmware or
software. EPROM programmers are used for these field updates, allowing for
improvements or fixes to be applied to devices already in use.
EPROM Erasers
EPROM erasers are devices used to erase data from EPROM (Erasable Programmable Read-
Only Memory) chips. They are essential for resetting the EPROMs so that they can be
reprogrammed with new data. The primary function of an EPROM eraser is to remove the
existing data stored in the EPROM chip by exposing it to ultraviolet (UV) light, which clears the
memory cells and prepares the chip for new programming.
The working principle of an EPROM eraser is based on the use of ultraviolet (UV) light.
EPROM chips are designed with memory cells that retain data until they are exposed to UV
light. Inside the eraser, a UV light source illuminates the EPROM chip. This light penetrates
through the transparent window on the EPROM package and causes a chemical reaction in the
memory cells that resets their state. The duration and intensity of UV exposure are carefully
controlled to ensure complete erasure of the stored data. After the erasure process, the EPROM
chip is cleared of its previous contents and can be reprogrammed with new data.
EPROM erasers are used in various stages of the development and maintenance of electronic
systems that utilize EPROM chips. In the development phase, erasers are employed to clear
EPROMs after testing and before reprogramming them with updated firmware or software. In
production environments, EPROM erasers are used to prepare chips for new programming runs.
They are also used in field maintenance to erase and reprogram EPROMs that need updates or
fixes. To use an EPROM eraser, the chip is placed inside the eraser chamber, and the device is
activated to expose the chip to UV light for a specified duration. After erasure, the EPROM is
removed and can be reprogrammed as needed.
Assembler
An assembler is a software tool used to convert assembly language code into machine code,
which is directly executable by a microprocessor. Assembly language is a low-level
programming language that is closely related to the machine code of a specific processor. The
assembler translates the human-readable assembly instructions into binary or hexadecimal code
that the microprocessor can understand and execute. This process is crucial for developing
software that interacts directly with hardware.
The working principle of an assembler involves several key steps. First, the assembler reads the
source code written in assembly language. It then parses the code to identify instructions, labels,
and operands. The assembler translates each assembly instruction into its corresponding machine
code opcode, which represents the instruction in binary format. It also resolves symbolic names
for memory addresses or data values and converts them into actual addresses or values. After
processing the entire code, the assembler generates an object file containing the machine code
and additional information, such as address locations for linking and debugging. The object file
is then ready to be linked with other code or libraries to create an executable program.
Cross Assemblers
A cross assembler is a software tool that translates assembly language code written for one
computer architecture (the target architecture) into machine code executable on a different
computer architecture (the host architecture). Essentially, it bridges the gap between different
hardware platforms, allowing software development for one system to be performed on another.
The working principle of a cross assembler involves several steps similar to those of a standard
assembler. The cross assembler reads the source code written in assembly language, which is
designed for the target microprocessor. It parses the code to identify instructions, labels, and
operands, then translates these assembly instructions into the corresponding machine code
opcodes for the target processor. The cross assembler performs this translation on the host
computer, which has a different architecture from the target system. After processing the source
code, the cross assembler generates an object file containing the machine code and additional
metadata required for linking and loading. This object file can then be transferred to the target
system or further processed to create an executable.
Cross assemblers are used in various scenarios, particularly in embedded systems and
development environments where the target hardware cannot support direct assembly.
Developers write assembly language code on a more powerful host computer using a cross
assembler. The generated machine code is then loaded onto the target hardware, such as
microcontrollers or specialized processors, for testing and deployment. Cross assemblers are
particularly useful for developing software for systems with limited resources or specific
hardware constraints. They allow developers to leverage the capabilities of modern development
environments while targeting processors that may be simpler or more specialized.
Assignment
1. Simulators
2. Emulators
MICROPROCESSORS AS ADC AND DAC IN INSTRUMENTATION
Instrumentation
Instrumentation refers to the science and technology of measurement and control. It involves the
use of devices and systems to measure, monitor, and control physical quantities such as
temperature, pressure, flow, level, and more. These devices, known as instruments, can be
standalone or integrated into larger systems for various applications. The key components of
instrumentation are:
1. Sensors and Transducers: These devices convert physical quantities (like temperature,
pressure, or light) into electrical signals that can be measured. For example, a
thermocouple converts temperature into a voltage signal.
2. Signal Conditioning: This involves processing the raw signals from sensors to make
them suitable for further processing. This can include amplification, filtering, and
converting signals from analog to digital form.
3. Data Acquisition Systems (DAS): These systems collect and digitize signals from
sensors. They often include ADCs to convert analog signals into digital data that can be
processed by computers or microcontrollers.
4. Controllers: These devices or systems use the data from sensors to control other devices.
For example, a thermostat uses temperature data to control a heating or cooling system.
5. Display and Recording Devices: These devices show the measured values in a human-
readable form and may also record the data for future analysis. Examples include digital
displays, chart recorders, and computer interfaces.
Control Systems: Microcontrollers use the acquired data to control various actuators and
devices. For example, in an HVAC system, a microcontroller can adjust the temperature by
controlling heating and cooling elements based on sensor data. They implement feedback control
loops, such as PID (Proportional-Integral-Derivative) controllers, to maintain desired system
states.
Signal Processing: Microcontrollers can perform real-time signal processing tasks, such as
filtering, averaging, and transforming data. This capability is essential in applications requiring
immediate response, like medical instruments and automotive sensors. Advanced
microcontrollers can execute complex algorithms, including Fourier transforms and digital
filtering, to enhance signal quality and extract meaningful information.
User Interface: Microcontrollers manage user interfaces, including LCDs, LEDs, and touch
screens, providing real-time feedback and interaction capabilities. They handle input from
buttons, switches, and other user controls, enabling manual adjustments and configurations.
Analog conversion involves converting signals between analog and digital formats. This process
is fundamental in modern electronics and instrumentation, allowing digital systems to interface
with the analog world. There are two main types of analog conversion: Analog-to-Digital
Conversion (ADC) and Digital-to-Analog Conversion (DAC).
The Analog-to-Digital Conversion (ADC) converts an analog signal, which varies continuously
over time, into a digital signal, which has discrete values that can be processed by digital systems
like microcontrollers and computers. The process involves sampling, where the continuous
analog signal is sampled at regular intervals, with the sampling rate high enough to capture the
essential details of the signal, as per the Nyquist theorem. During quantization, each sampled
value is mapped to the nearest value within a finite set of discrete levels, introducing a small
error known as quantization error. Finally, the quantized values are encoded into a binary format,
which can be read and processed by digital systems.
The components of an ADC system include a Sample and Hold Circuit, which captures and
holds the analog value at the moment of sampling, an Analog Comparator that compares the
sampled analog input with reference levels, and a Digital Encoder that converts the output of the
comparator into a binary number.
Signal Processing: The microprocessor processes the acquired digital data to filter out noise and
improve signal quality and performs necessary computations, such as averaging multiple
readings, scaling the data, or applying complex algorithms to derive meaningful information
from the raw data.
Data Storage and Communication: The processed data can be stored in the microprocessor’s
memory for logging, analysis, or future reference and the microprocessor can transmit the
acquired and processed data to other systems or devices using communication protocols such as
UART, SPI, I2C, or Ethernet.
The components of a DAC system include a Binary Decoder, which interprets the digital input
values, a Resistor Ladder (or another conversion method), which converts the decoded binary
values into corresponding analog voltages, and an Operational Amplifier, which is often used to
buffer and amplify the analog output.
The role of Microprocessors in DAC
Data Processing: The microprocessor generates and prepares the digital data that needs to be
converted to an analog signal, which can result from computations, sensor readings, or control
algorithms, and sends this digital data to the DAC through communication interfaces such as
parallel data lines, SPI, I2C, or serial interfaces.
Analog Output: The DAC converts the digital data into an analog voltage or current according
to the microprocessor’s instructions, and the output from the DAC is often passed through a low-
pass filter to smooth out the discrete steps and create a continuous analog signal.
Feedback and Adjustment: The microprocessor can monitor the analog output through
feedback mechanisms to ensure it meets the desired specifications and adjust the digital input
data accordingly, and it can also perform calibration routines to correct any deviations in the
analog output due to factors like component tolerances or environmental conditions.
In an instrument that integrates an ADC and a microprocessor, the input signal typically goes to
the ADC first before being passed to the microprocessor. A simple block diagram for interfacing
an ADC with a microprocessor is as shown in Figure1.
Figure1: A simple block diagram for interfacing an ADC with a microprocessor
The analog signal source, such as a sensor measuring temperature or pressure, provides the
continuous analog signal. This signal is then received by the Analog-to-Digital Converter
(ADC), which samples, quantizes, and converts it into a discrete digital format. The digital data
output from the ADC is transmitted to the microprocessor. The microprocessor processes this
digital data, performing any necessary computations or control tasks. Finally, the processed data
can be used to drive a display for user feedback or to control other systems or devices based on
the results.
The digital data input represents the data that needs to be converted to an analog signal, which is
generated by the microprocessor based on computations or control requirements. The
microprocessor sends this digital data to the Digital-to-Analog Converter (DAC), and may also
configure the DAC, manage data transfer, and control timing and sequencing. The DAC then
receives the digital data from the microprocessor and converts it into an analog signal. This
analog signal output from the DAC, which can be an analog voltage or current, is used to drive
an output device, such as a speaker or motor, or to control other systems based on the analog
signal.
Integration of Sensors and Microprocessors in Measuring Instruments
Sensors are used with microprocessors in measuring instruments to collect and process data
about physical phenomena. Sensors convert physical measurements (like temperature, pressure,
or light) into electrical signals. These signals are then sent to the microprocessor, which either
directly reads digital signals or uses an Analog-to-Digital Converter (ADC) to convert analog
signals into digital data. The microprocessor processes this data, performs necessary
computations, and may display the results or use them to control other devices. This integration
enables accurate, automated measurement and control in various applications.
THE ARCHITECTURE AND APPLICATIONS OF MICROCONTROLLERS
Assignment
Storing commands or codes with their associated service routine addresses in the linear address
space of a microcontroller memory typically involves a process known as interrupt vectoring or
simply organizing program instructions in memory. The procedure is as follows:
For handling interrupts (events that need immediate attention), microcontrollers often use an
interrupt vector table. This table contains addresses of the service routines (ISR - Interrupt
Service Routines) that are executed when specific interrupts occur.
Interrupt vectors are specific memory locations that store the addresses of the ISRs. Each
interrupt source has a corresponding vector. The address of the ISR is placed in these vector
locations.
2. Memory Mapping of Interrupt Vector Table:
Each entry in the interrupt vector table is an address that points to the start of an ISR. The
microcontroller is configured to jump to these addresses when an interrupt is triggered.
Example:
Assume the first few addresses in the linear address space are reserved for the interrupt vector
table:
In this example, the address 0x0000 contains the ISR address for the reset interrupt (0x1000), the
address 0x0004 contains the ISR address for the timer interrupt (0x1010), and the address
0x0008 contains the ISR address for the UART interrupt (0x1020).
Service routines are programmed and stored in program memory. These routine can be store and
reference as follows:
ResetISR:
; Code to handle reset
TimerISR:
UARTISR:
Use the linker script or microcontroller-specific directives to place ISR addresses in the interrupt
vector table. For example, using a directive:
When an interrupt occurs, the microcontroller automatically fetches the address from the
interrupt vector table, then jumps to the fetched address and begins executing the corresponding
ISR. After the ISR execution is complete, control is returned to the main program.
In microcontrollers, status flags are used to indicate the current state or condition of various
operations within the CPU or peripheral units. These flags are typically stored in a special
register known as the status register or flags register. Status flags are essential for managing and
controlling program execution, as they provide feedback on the results of operations and help in
making decisions based on those results.
1. Condition Indication:
• Carry Flag (C): Indicates whether an arithmetic operation generated a carry out or
borrow in the case of addition or subtraction.
• Zero Flag (Z): Indicates whether the result of an operation is zero.
• Sign Flag (S): Indicates the sign of the result (positive or negative) in signed arithmetic
operations.
• Overflow Flag (O): Indicates whether an arithmetic operation resulted in an overflow,
which occurs when the result exceeds the maximum value that can be represented.
2. Control Flow:
• Status flags can be used to control the flow of the program based on the outcomes of
operations. For example, conditional branching instructions can test the state of these
flags to determine whether to execute a particular block of code.
3. Interrupt Handling:
• Some status flags are used to indicate the occurrence of specific events or interrupts,
allowing the CPU to handle them appropriately.
4. Error Detection:
• Flags can be used to detect and handle errors, such as parity errors in communication or
faults in peripheral operations.
Example:
• Carry Flag (C): Set if a carry occurred during addition or a borrow occurred during
subtraction.
• Auxiliary Carry Flag (AC): Used for BCD (Binary-Coded Decimal) arithmetic
operations.
• Zero Flag (Z): Set if the result of an operation is zero.
• Parity Flag (P): Indicates whether the number of set bits in the result is even or odd.
• Overflow Flag (OV): Indicates if an arithmetic overflow occurred.
By checking these flags, the microcontroller can make decisions and handle various conditions
effectively during program execution.
Testing the status flag of a system being monitored involves checking the value of a specific
status flag to determine the current state or condition of that system. This process includes
evaluating the flag to make informed decisions or take appropriate actions based on the system's
status. In a microcontroller, for example, if monitoring for a specific condition such as a timer
overflow, you would test the overflow flag to determine if the timer interrupt requires handling.
If the flag indicates an overflow, you would execute the Interrupt Service Routine (ISR) to
process the event. Testing status flags is essential for effective system monitoring, error
handling, and decision-making in digital systems.
Writing programs to test the status flag of a system being monitored typically involves creating
code that reads the status flag, evaluates its value, and performs actions based on the result. A
simple example of testing the Zero flag in 8051 assembly language is as follows:
Main:
ZeroDetected:
DelayLoop:
The code initializes the accumulator to 0, performs an addition of 1, and then checks the Zero
flag. If the Zero flag is set, indicating the result was zero, it turns on an LED connected to Port
1.0 by setting that pin high. The program then optionally includes a delay loop to keep the LED
on for a brief period before looping back to the main routine to continue execution. If the Zero
flag is not set, the code continuously loops back to the main routine without changing the LED
state.