CS3691 (EIOT) - Important Questions and Answers
CS3691 (EIOT) - Important Questions and Answers
Specific Functionality
Real-Time Operation
Resource Constraints
Reliability and Consistency
Compact Size
Embedded Software
Interfacing and Connectivity
Cost Sensitivity
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.
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.
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.
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.
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.
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.
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:
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.
We will write Python code using RPi.GPIO library to read data from both sensors.
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:
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.
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.
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:
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.