1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

1.

Attempt any FIVE of the following : 10

a) Define RISC and CISC.

 RISC (Reduced Instruction Set Computing): A processor design with simple


instructions executed in one clock cycle.
 CISC (Complex Instruction Set Computing): A processor design with complex
instructions that may take multiple cycles.

b) List any two applications of Harvard architecture.

1. Digital Signal Processing (DSP) systems.


2. Microcontrollers like PIC microcontrollers.

c) Illustrate any two data types used in C with their ranges.

1. int: Range - -32,768 to 32,767 (16-bit system).


2. char: Range - -128 to 127 or 0 to 255.

d) Draw the format of TMOD register.

The TMOD register (Timer Mode Control) is an 8-bit register in 8051 microcontrollers.

| GATE | C/T | M1 | M0 | GATE | C/T | M1 | M0 |


| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |

e) State any two applications of Bluetooth.

1. Wireless audio devices like headphones and speakers.


2. Data transfer between mobile phones and computers.

f) List various temperature sensors used in industry.

1. Thermocouples.
2. RTDs (Resistance Temperature Detectors).
3. Thermistors.
4. Infrared sensors.
g) Define the terms: scalability, predictability related to RTOS.

1. Scalability: The ability of an RTOS to handle increasing workloads efficiently by


adding more resources.
2. Predictability: The RTOS's ability to ensure timely task execution, crucial for real-
time applications.

a) Compare Harvard and Von Neumann architecture

Parameter Harvard Architecture Von Neumann Architecture


Memory Separate memory for instructions and Unified memory for instructions and
Type data. data.
Data Parallel data and instruction fetch Data and instruction fetch is
Transfer possible. sequential.
Faster due to simultaneous fetch Slower due to sequential fetch
Speed
operations. operations.
Example Used in DSPs and microcontrollers. Used in general-purpose processors.

b) Applications for Embedded Systems

i) Small-scale embedded systems:

1. Digital calculators.
2. Automatic washing machines.

ii) Medium-scale embedded systems:

1. Home automation systems.


2. Industrial robotics.

c) C Language Program to Toggle All Bits of Ports P0, P1, P2, and P3
#include <reg51.h>
void delay() {
int i, j;
for (i = 0; i < 100; i++)
for (j = 0; j < 100; j++);
}
void main() {
while (1) {
P0 = ~P0;
P1 = ~P1;
P2 = ~P2;
P3 = ~P3;
delay();
}
}
d) 9-pin RS-232C Connector and Significance of DTR and DSR Signals

Diagram:

-----------------
| 1 2 3 4 5 |
| 6 7 8 9 |
-----------------
Pins:
1. DCD (Data Carrier Detect)
2. RXD (Receive Data)
3. TXD (Transmit Data)
4. DTR (Data Terminal Ready)
5. GND (Ground)
6. DSR (Data Set Ready)
7. RTS (Request to Send)
8. CTS (Clear to Send)
9. RI (Ring Indicator)

Significance of DTR and DSR:

 DTR (Data Terminal Ready): Indicates the device is ready to establish


communication.
 DSR (Data Set Ready): Indicates the device is ready to receive data.

a) C Program to Transfer "MSBTE" Serially at 9600 Baud Rate


#include <reg51.h>
void main() {
SCON = 0x50; // Serial mode 1, 8-bit data, 1 stop bit, REN enabled
TMOD = 0x20; // Timer 1, Mode 2, Auto-reload
TH1 = 0xFD; // 9600 baud rate for 11.0592 MHz crystal
TR1 = 1; // Start Timer 1
while (1) {
SBUF = 'M'; while (TI == 0); TI = 0;
SBUF = 'S'; while (TI == 0); TI = 0;
SBUF = 'B'; while (TI == 0); TI = 0;
SBUF = 'T'; while (TI == 0); TI = 0;
SBUF = 'E'; while (TI == 0); TI = 0;
}
}

b) Comparison Between CAN and I2C Protocols

Parameter CAN Protocol I2C Protocol


Data Transfer Rate Up to 1 Mbps Up to 400 kbps (Standard)
6 (Start, ID, Control, Data, CRC, ACK,
Number of Fields 3 (Start, Data, Stop)
EOF)
Addressing Bits 11-bit or 29-bit identifier 7-bit or 10-bit addresses
Embedded systems,
Applications Automotive, Industrial Automation
Sensors
c) Interfacing of ADC with 89C51

Diagram:

+------+ +-------+
P2.0 -> | SOC | ADC0804 | Data | -> P0 (Data Bus)
P2.1 <- | EOC | | Lines |
P2.2 -> | OE | +-------+

Explanation:

1. SOC (Start of Conversion): Initiates the conversion process in the ADC.


2. EOC (End of Conversion): Signals the completion of the conversion.
3. OE (Output Enable): Enables the ADC output to be read by the microcontroller.

Steps:

1. Set SOC high to start conversion.


2. Wait for EOC to go low, indicating conversion is complete.
3. Enable OE and read the digital data from the ADC.

d) Comparison Between General Purpose OS and RTOS

Parameter General Purpose OS RTOS


Task Execution Best-effort scheduling Deterministic scheduling
Response Time Variable, not time-critical Predictable, time-critical
Use Case PCs, smartphones Embedded systems
Task Priority Less emphasis on priority Strict task prioritization

a) Including Assembly Language in 89C51 C Program

Description:
Assembly language can be included in a C program using the asm keyword. This allows
embedding low-level instructions for tasks requiring precise control over hardware or speed
optimization.

Example:

#include <reg51.h>
void main() {
P1 = 0x00; // Initialize Port 1
asm {
MOV A, #0x55 // Load value into accumulator
MOV P1, A // Output value to Port 1
}
while (1);
}
b) USB Protocol

Diagram:

+------------+ +------------------+
Host | Root Hub |<--->| USB Devices |
| Controller | | (Mouse, Keyboard)|
+------------+ +------------------+

Explanation:

1. USB (Universal Serial Bus):


o Serial communication protocol supporting multiple devices.
o Operates in master-slave mode, where the host controls the communication.
2. Key Features:
o Layers: Physical layer (cable), Protocol layer (data transfer).
o Transfer Types: Control, Bulk, Isochronous, and Interrupt.
o Speeds: Low-speed (1.5 Mbps), Full-speed (12 Mbps), High-speed (480
Mbps), and Super-speed (5 Gbps).

c) Features of Zigbee

1. Low Power Consumption: Operates efficiently on small batteries.


2. Short-Range Communication: Typically up to 100 meters.
3. Mesh Networking: Supports self-healing and robust communication.
4. Low Data Rate: Suitable for low-bandwidth applications like sensors and home
automation.

d) Interfacing Diagram of 4×4 Matrix Keyboard with 89C51

Diagram:

Rows Columns
P1.0 ----> R1 C1 <---- P2.0
P1.1 ----> R2 C2 <---- P2.1
P1.2 ----> R3 C3 <---- P2.2
P1.3 ----> R4 C4 <---- P2.3

Description:

1. Rows are connected to Port 1 pins (P1.0–P1.3).


2. Columns are connected to Port 2 pins (P2.0–P2.3).
3. Microcontroller scans rows and columns to detect key presses.
e) C Program to Rotate Stepper Motor by 90° Clockwise

Step Calculation:

 Step angle = 1.8°


 Steps required for 90° = 901.8=50\frac{90}{1.8} = 50.

4-Step Sequence:

#include <reg51.h>
void delay() {
int i, j;
for (i = 0; i < 300; i++)
for (j = 0; j < 100; j++);
}
void main() {
unsigned char steps[4] = {0x09, 0x0A, 0x06, 0x05}; // Step sequence
int i, count = 50; // 50 steps for 90°
while (count--) {
for (i = 0; i < 4; i++) {
P1 = steps[i]; // Output to stepper motor
delay();
}
}
}

a) Explanation of Watchdog Timer and Semaphore

Watchdog Timer (WDT):

 Definition: A hardware timer used to reset the system if the software fails to operate
correctly within a specified time.
 Working:
1. The timer starts counting after the system is powered on.
2. The system must periodically reset the timer (referred to as "kicking" or
"feeding the dog").
3. If the timer overflows, it generates a system reset, assuming the system is
stuck or malfunctioning.
 Advantages:
1. Ensures system reliability in case of software failure.
2. Detects and recovers from software crashes or infinite loops.

Semaphore:

 Definition: A signaling mechanism in multitasking environments, used to manage


resource access among multiple tasks.
 Types:
1. Binary Semaphore: Has two states: 0 (resource not available) and 1 (resource
available).
2. Counting Semaphore: Tracks the count of available resources.
 Functions:
1. wait() or P operation: Decrements the semaphore value. If it becomes
negative, the task waits.
2. signal() or V operation: Increments the semaphore value, releasing a waiting
task if any.
 Example Use Case: Managing access to a shared printer in a multitasking system.

b) 89C51 C Program to Display "WELCOME" on a 16×2 LCD


#include <reg51.h>
#define LCD P2
sbit RS = P3^0;
sbit RW = P3^1;
sbit EN = P3^2;

void delay() {
int i, j;
for (i = 0; i < 100; i++)
for (j = 0; j < 100; j++);
}

void lcd_cmd(unsigned char cmd) {


LCD = cmd;
RS = 0;
RW = 0;
EN = 1;
delay();
EN = 0;
}

void lcd_data(unsigned char data) {


LCD = data;
RS = 1;
RW = 0;
EN = 1;
delay();
EN = 0;
}

void lcd_init() {
lcd_cmd(0x38); // 2 lines, 5x7 matrix
lcd_cmd(0x0C); // Display ON, Cursor OFF
lcd_cmd(0x06); // Increment cursor
lcd_cmd(0x01); // Clear display
lcd_cmd(0x80); // Set cursor to row 1, column 1
}

void main() {
lcd_init();
lcd_data('W');
lcd_data('E');
lcd_data('L');
lcd_data('C');
lcd_data('O');
lcd_data('M');
lcd_data('E');
while (1);
}

c) C Program to Generate Square Wave of 5 kHz on Pin P1.5

Calculation for Delay:

 For a 5 kHz square wave: Period = 15000=0.2 ms\frac{1}{5000} = 0.2 \, ms.


 Half period = 0.2÷2=0.1 ms=100 μs0.2 \div 2 = 0.1 \, ms = 100 \, \mu s.

Program:

#include <reg51.h>
void delay() {
int i;
for (i = 0; i < 50; i++); // Approx 100 µs delay for 12 MHz crystal
}

void main() {
while (1) {
P1 ^= 0x20; // Toggle P1.5
delay();
}
}

a) Six Characteristics of Embedded Systems

1. Real-Time Operation:
o Perform tasks within specific time constraints for real-time applications like
automotive systems or industrial control.
2. Specific Functionality:
o Designed to perform a dedicated task, unlike general-purpose computers.
3. Low Power Consumption:
o Optimized for energy efficiency, especially for battery-operated systems.
4. Memory Constraints:
o Limited RAM and ROM to save costs and power consumption.
5. Reliability and Stability:
o Must operate continuously without failure, often under harsh conditions.
6. Small Form Factor:
o Compact in size, enabling integration into other devices like smartphones or
appliances.

b) Preemptive and Round Robin Scheduling Algorithms in RTOS


Preemptive Scheduling:

1. Definition:
o Allows the highest-priority task to take control of the CPU, even if another
task is running.
2. Features:
o Task switching is immediate when a higher-priority task becomes ready.
o Ensures critical tasks get CPU time without delay.
3. Advantages:
o High responsiveness for real-time applications.
4. Disadvantages:
o Higher overhead due to frequent context switching.

Round Robin Scheduling:

1. Definition:
o Allocates a fixed time slice (quantum) to each task in a cyclic order.
2. Features:
o Fair CPU time allocation among tasks.
o Tasks are executed in a first-come, first-serve manner.
3. Advantages:
o Simple and predictable.
4. Disadvantages:
o May not prioritize critical tasks effectively.

c) Interfacing Diagram and C Program for 7-Segment Display

Interfacing Diagram:

89C51 Microcontroller
P2.0 - P2.6 --> A-G segments of 7-segment display
P2.7 --------> Common Cathode/Anode (via transistor)

C Program to Display 0–9 Continuously:

#include <reg51.h>
unsigned char digits[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66,
0x6D, 0x7D, 0x07, 0x7F, 0x6F};
// 7-segment codes for 0-9 (common cathode)

void delay() {
int i, j;
for (i = 0; i < 1000; i++)
for (j = 0; j < 100; j++);
}

void main() {
int i;
while (1) {
for (i = 0; i < 10; i++) {
P2 = digits[i]; // Send code to 7-segment display
delay(); // Wait for some time
}
}
}

You might also like