0% found this document useful (0 votes)
52 views17 pages

CS3691 (EIOT) - Important Questions and Answers

The document discusses various aspects of embedded systems and microcontroller programming, including bit masking in the 8051, interfacing RS-232C with TTL devices, and the function of jump statements in assembly language. It outlines characteristics of embedded systems, the significance of ROM for program storage, and various compilation techniques. Additionally, it covers the architecture of the 8051 microcontroller, task states in Real-Time Operating Systems, sensor interfacing with Raspberry Pi, and hardware/software support for serial communication in the 8051.

Uploaded by

ajithbecse5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views17 pages

CS3691 (EIOT) - Important Questions and Answers

The document discusses various aspects of embedded systems and microcontroller programming, including bit masking in the 8051, interfacing RS-232C with TTL devices, and the function of jump statements in assembly language. It outlines characteristics of embedded systems, the significance of ROM for program storage, and various compilation techniques. Additionally, it covers the architecture of the 8051 microcontroller, task states in Real-Time Operating Systems, sensor interfacing with Raspberry Pi, and hardware/software support for serial communication in the 8051.

Uploaded by

ajithbecse5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

1. Write a program to mask the 0th and 7th bit using 8051.

2. How the RS-232C serial bus is interfaced to TTL logic device?


By using a level shifters, proper wiring connections, grounding both devices together, and
ensuring matching communication settings, we can successfully interface an RS-232C
serial bus with a TTL logic device. This setup allows for reliable data transmission between
modern microcontrollers or other TTL-based systems and older RS-232 equipment.

3. Write about the jump statement.


The jump statement is a fundamental control structure in the assembly language of the 8051
microcontroller. It allows the program to change the flow of execution based on certain
conditions or unconditionally. This capability is essential for implementing loops,
conditional branching, and function calls within the program.

Types of Jump Instructions


There are several types of jump instructions available in the 8051 instruction set, which
can be categorized into two main groups:
 conditional jumps
 unconditional jumps.

4. List out the typical characteristics of an Embedded Systems.


Embedded systems are specialized computing systems designed to perform specific tasks
within larger mechanical or electronic systems. Here are the typical characteristics that
define embedded systems:

 Specific Functionality
 Real-Time Operation
 Resource Constraints
 Reliability and Consistency
 Compact Size
 Embedded Software
 Interfacing and Connectivity
 Cost Sensitivity

5. Why does the program reside in ROM in an embedded system?


The program resides in ROM in an embedded system because ROM is non-volatile
memory, meaning it retains its contents even when power is turned off. This ensures that
the essential firmware and instructions needed for the system’s operation are always
available upon startup. Additionally, ROM is typically used to store software that does not
require frequent updates, providing a stable and reliable environment for executing critical
functions of the embedded system.

6. List out the various compilation techniques.


Compilation techniques of embedded systems include code generation, code optimization,
instruction-level optimization, higher-level optimizations, parallelization techniques,
energy-conserving techniques, and retargetable compilation methodology.

7. List the Characteristics of IoT.


 Connectivity: IoT devices must be able to connect and communicate with each
other and the internet, enabling data exchange.
 Intelligence and Identity: Each device has a unique identity, allowing for tracking
and data interpretation to extract meaningful insights.
 Scalability: IoT systems can accommodate an increasing number of devices
without compromising performance.
 Dynamic and Self-Adapting: Devices can adapt to changing environments and
contexts automatically.
 Safety and Security: Protecting sensitive user data from breaches is critical,
requiring robust security measures across devices.
 Self-Configuring: Devices can configure themselves with minimal user
intervention, facilitating easier integration into existing networks.
 Interoperability: Different IoT devices can communicate seamlessly using
standardized protocols, ensuring compatibility across platforms.
 Autonomous Operation: Devices can operate independently, making decisions
based on collected data without human intervention.
 Ubiquity: IoT devices are widely distributed across various environments, creating
a pervasive network of interconnected objects.
 Context Awareness: Devices can understand their operational context through
environmental sensing, enabling more relevant responses and actions.
8. How debugging works in Arduino?
Debugging in Arduino primarily relies on using the Serial Monitor for outputting
information about program execution, setting breakpoints for controlled execution flow,
utilizing external debuggers where applicable, handling errors effectively, and testing
incrementally to ensure each part of the code functions correctly before moving on.

9. List the various libraries in Arduino.


The Arduino environment supports a wide range of libraries that extend its functionality.
Here are some of the various categories and examples of libraries available in Arduino:

Communication Libraries:
 SPI: For communicating with devices using the Serial Peripheral Interface.
 Wire: For I2C communication.
 Ethernet: For connecting to the Internet via Ethernet.
 WiFi: For wireless communication.

Data Processing Libraries:


 ArduinoJson: A simple and efficient JSON library for embedded C++.
 DHT-sensor-library: For temperature and humidity sensors.

Device Control Libraries:


 Servo: To control servo motors.
 Stepper: To control stepper motors.

Display Libraries:
 LiquidCrystal: For controlling LCDs based on the HD44780 driver.
 TFT: For drawing graphics on TFT displays.

Sensor Libraries:
 Adafruit Sensor Library: A unified sensor library for various sensors.
 MPU-6050: For interfacing with the MPU-6050 accelerometer and gyroscope.

Timing Libraries:
 TimerOne: To manage timed events using hardware timers.

Audio Libraries:
 AudioZero: To play audio files from an SD card (Arduino Due only).

Other Libraries:
 Firmata: For communicating with applications on the computer using a standard
serial protocol.
 SD: For reading from and writing to SD cards.

These libraries can be installed through the Arduino IDE’s Library Manager, allowing
users to easily integrate additional functionalities into their projects.
10. Infer sketch in Arduino.
An Arduino sketch is a program written in the Arduino programming language, which is
based on C/C++. It consists of two main functions: setup() and loop().

Setup Function:
This function runs once when the program starts. It is used to initialize variables, pin
modes, and other settings that need to be configured before the main loop begins.

Loop Function:
After the ‘setup()’ function has been executed, the ‘loop()’ function runs continuously in a
cycle. This is where the main logic of your program resides, allowing it to perform tasks
repeatedly until the board is powered off or reset.

11. With a neat sketch, explain about the internal RAM organization of 8051. Also write
program to demonstrate stack operation in 8051 microcontroller.

The 8051 microcontroller features a specific internal RAM organization that is crucial for
its operation. The internal RAM is divided into several sections, each serving different
purposes.

Structure of Internal RAM

General Purpose Registers (GPRs):


The 8051 has a total of 32 general-purpose registers, which are organized into four banks
(Bank 0 to Bank 3). Each bank contains 8 registers (R0 to R7).
These registers are used for temporary data storage and manipulation during program
execution.

Bit Addressable Area:


The internal RAM includes a bit-addressable area from addresses 20H to 2FH. This allows
individual bits in this range to be accessed and manipulated directly.
This feature is useful for controlling flags or status indicators.

Stack Area:
The stack in the 8051 is implemented using the internal RAM, starting from address 07H
up to the upper limit of the available RAM.
The stack pointer (SP) register points to the current top of the stack and can be initialized
by the user. By default, it starts at address 07H.

Data Memory:
The remaining space in the internal RAM serves as data memory where variables can be
stored during program execution.

Program Demonstrating Stack Operation in 8051 Microcontroller


The following assembly language program demonstrates basic stack operations such as
pushing data onto the stack and popping data off the stack.
12. With a neat sketch, explain the architecture of 8051 microcontroller with timer mode
operation.

The 8051 microcontroller is a widely used 8-bit microcontroller that integrates various
components necessary for embedded system applications. Its architecture consists of
several key elements, including the CPU, memory, I/O ports, timers, and control logic.

Key Components of 8051 Architecture

Central Processing Unit (CPU):


The CPU is the brain of the microcontroller, responsible for executing instructions stored
in memory. It controls all operations and manages data flow between different components.

Memory:
The 8051 microcontroller has two types of memory:
 Program Memory (ROM): Stores the executable code. Typically, it can hold up
to 64KB.
 Data Memory (RAM): Used for temporary data storage during program
execution. It includes general-purpose registers and special function registers
(SFRs).
I/O Ports:
The microcontroller has four parallel I/O ports (P0, P1, P2, P3), each consisting of 8 bits.
These ports are used to interface with external devices.

Timers/Counters:
The 8051 features two timers/counters (Timer 0 and Timer 1), which can be configured for
various timing operations or event counting.

Control Logic:
This component manages the operation of the CPU and peripherals by generating control
signals based on the instruction set.

Timer Mode Operation


The timers in the 8051 microcontroller can operate in different modes depending on the
requirements:

 Mode 0 (13-bit Timer Mode): Uses THx and TLx registers to count from 0 to
8191.

 Mode 1 (16-bit Timer Mode): Utilizes both THx and TLx as a single 16-bit timer
counting from 0 to 65535.
 Mode 2 (8-bit Auto-reload Mode): Uses TLx as an auto-reloading timer where
THx holds the value to reload into TLx after overflow.

 Mode 3 (Split Timer Mode): Splits Timer 0 into two independent 8-bit timers
while Timer 1 remains a full-fledged timer.

13. Discuss the various states of a task in Real-Time Operating Systems.

In Real-Time Operating Systems (RTOS), tasks are fundamental units of execution that
can exist in various states throughout their lifecycle. Understanding these states is crucial
for managing task scheduling, resource allocation, and ensuring timely execution of critical
operations. The primary states of a task in an RTOS include Running, Ready, Blocked,
Terminated, and sometimes additional states like Dormant or Suspended.

 Running State
The Running state indicates that a task is currently being executed by the CPU. In
this state, the task has control over the processor and is actively performing its
designated operations. Only one task can be in the Running state at any given time
on a single-core processor. If a higher-priority task becomes ready to run, it may
preempt the currently running task, leading to context switching.
 Ready State
A task enters the Ready state when it is prepared to execute but is not currently
running because another task with a higher priority is utilizing the CPU. Tasks in
this state are waiting for their turn to be assigned CPU time by the scheduler. The
transition from Ready to Running occurs when the scheduler selects this task based
on its priority and availability of CPU resources.

 Blocked State
The Blocked state occurs when a task cannot proceed with its execution due to
waiting for an event or resource that is not currently available. This could involve
waiting for I/O operations to complete, waiting for a semaphore or mutex, or
waiting for user input. While in this state, the task does not consume CPU cycles
until it is unblocked by the occurrence of the event it was waiting for.

 Terminated State
When a task completes its execution or encounters an error that prevents further
operation, it transitions into the Terminated state. In this state, all resources
allocated to the task are released, and it no longer consumes any system resources
or CPU time. The operating system may clean up any remaining data associated
with this task during termination.
 Dormant State
Some RTOS implementations include a Dormant state where tasks reside before
they are started or after they have completed execution but have not yet been
terminated completely. A dormant task does not occupy CPU time and will only
transition to Ready when it is explicitly started again.

 Suspended State
In certain systems, tasks may also enter a Suspended state where they are
temporarily halted but can be resumed later without losing their context (e.g.,
register values). This might occur due to manual intervention from other tasks or
system conditions requiring temporary suspension.

14. Assume the following tasks to be executed with one processor, with the tasks arriving
in the order listed in table 1.

Table 1
i T (Pi) Arrival Time
0 80 0
1 20 10
2 10 10
3 20 40
4 50 45
15. Illustrate the Sensors and sensor Node interfacing using any Embedded target
boards Raspberry Pi.

To illustrate the interfacing of sensors with a Raspberry Pi, we will explore the steps
involved in connecting various sensors to the Raspberry Pi and programming it to read data
from these sensors.
To illustrate the sensors and sensor node interfacing, we need to understand the following
components:

 Understanding the Raspberry Pi


 Selecting Sensors
 Wiring the Circuit
 Programming the Raspberry Pi
 Testing and Running the System

Understanding the Raspberry Pi


The Raspberry Pi is a low-cost, credit-card-sized computer that can be used for various
applications, including sensor interfacing. It has GPIO (General Purpose Input/Output)
pins that allow it to interact with external devices such as sensors.

Selecting Sensors
For this illustration, we will use two common types of sensors:
 Ultrasonic Sensor (HC-SR04): Used for measuring distance.
 PIR Motion Sensor: Used for detecting motion.

Ultrasonic Sensor (HC-SR04)


Pins:
Vcc: Power supply (+5V)
Trig: Trigger pin (input)
Echo: Echo pin (output)
GND: Ground

PIR Motion Sensor


Pins:
VCC: Power supply (+5V)
GND: Ground
OUT: Output signal (high when motion is detected)
Wiring the Circuit

Ultrasonic Sensor Wiring


 Connect the Vcc pin of the HC-SR04 to a +5V pin on the Raspberry Pi.
 Connect the GND pin of HC-SR04 to a ground pin on the Raspberry Pi.
 Connect the Trig pin of HC-SR04 to GPIO24 on the Raspberry Pi.
 Connect the Echo pin through a voltage divider made from two resistors (1kΩ and
2kΩ) to GPIO23 on the Raspberry Pi.

PIR Motion Sensor Wiring


 Connect VCC of PIR sensor to +5V on Raspberry Pi.
 Connect GND of PIR sensor to ground on Raspberry Pi.
 Connect OUT of PIR sensor to GPIO18 on Raspberry Pi.
 Programming the Raspberry Pi

We will write Python code using RPi.GPIO library to read data from both sensors.

Sample Code for Ultrasonic Sensor


Sample Code for PIR Motion Sensor

Testing and Running the System


Once the sensors have been connected and the code is written,
 Ensure your Raspberry Pi is powered on and connected properly.
 Open a terminal window and run your Python scripts using python3 .py.
 Observe output messages indicating distance measurements or motion detection.
16. Discuss in detail, the hardware and software support provided by 8051 for serial
communication.

The 8051 microcontroller is equipped with built-in support for serial communication,
which allows it to communicate with other devices using the Universal Asynchronous
Receiver/Transmitter (UART) protocol. This capability is crucial for applications that
require data exchange between the microcontroller and peripherals such as computers,
sensors, or other microcontrollers.

HARDWARE SUPPORT

UART Interface
The 8051 microcontroller features a built-in UART that facilitates serial communication.
The UART includes two primary pins:

 TXD (Transmit Data): This pin is used to send data from the microcontroller.
 RXD (Receive Data): This pin is used to receive data into the microcontroller.
These pins are typically located on Port 3 of the 8051, specifically at P3.0 (RXD)
and P3.1 (TXD).

Voltage Levels
The UART operates at TTL voltage levels:

 Logic ‘0’ corresponds to 0V.


 Logic ‘1’ corresponds to +5V.

However, when interfacing with devices that use RS232 standards, a level converter like
the MAX232 IC is required because RS232 operates at different voltage levels (from -25V
to +25V). The MAX232 converts TTL levels from the 8051 to RS232 levels suitable for
communication with PCs and other devices.

Baud Rate Generation


The baud rate for serial communication can be configured using Timer 1 of the 8051. The
standard crystal frequency used is typically 11.0592 MHz, which allows for various baud
rates through division:

 The machine cycle frequency is obtained by dividing the crystal frequency by 12.
 The internal UART divides this frequency further to achieve standard baud rates
such as 9600 bps.

For example, to achieve a baud rate of 9600 bps:


Timer settings are adjusted so that Timer 1 operates in auto-reload mode with an
appropriate value loaded into TH1 register.
SOFTWARE SUPPORT

Special Function Registers (SFRs)


The software configuration for serial communication involves several key registers:

SCON (Serial Control Register): This register controls the operation modes of the
UART.
 SM0 and SM1 bits determine the mode of operation.
 REN bit enables reception.
 TI (Transmit Interrupt Flag) indicates when transmission is complete.
 RI (Receive Interrupt Flag) indicates when reception is complete.

SBUF (Serial Buffer Register): This register holds data being transmitted or received.
Writing data to SBUF initiates transmission, while reading from SBUF retrieves received
data.

TMOD and TCON Registers: These registers are used to configure Timer 1 for baud rate
generation:
 TMOD sets Timer modes.
 TCON controls timer operations like starting or stopping timers.

Initialization Procedure
To set up serial communication on the 8051, a typical initialization procedure includes:

 Configuring Timer 1 in auto-reload mode.


 Loading TH1 with a value corresponding to the desired baud rate.
 Setting up SCON for mode selection and enabling reception.

Example code snippet for initialization might look like this:

Thus, the hardware support provided by the 8051 includes dedicated pins for TXD and RXD, TTL
voltage compatibility along with necessary level conversion via MAX232 IC, and configurable
baud rates using Timer settings. On the software side, it offers special function registers like SCON
and SBUF along with initialization procedures and functions for transmitting and receiving data
effectively.

You might also like