19ecs431 - Embedded Systems
19ecs431 - Embedded Systems
[19ECS431]
B.Tech.DegreeExamination
Ans:
Sophisticated Functionality. ...
Real-Time Operation. ...
Low Manufacturing Cost. ...
Processor and Memory. ...
Tight Design Constraint. ...
Based on Performance and Functional Requirements.----------------2Marks
d) Calculate the memory space of EEPROM with the following Address range 0x0001000 –
0x0001FFF
any four conditional suffix instructions from above instruction ----2 Marks
The SOC bit clears the SAR register for the new result as well as starting the clock of the A/D
converter for another conversion. --------1 mark
-----1 Mark
h) Write about the importance of UART communication.
In UART communication, two UARTs communicate directly with each other. The transmitting
UART converts parallel data from a controlling device like a CPU into serial form, transmits it in
serial to the receiving UART, which then converts the serial data back into parallel data for the
receiving device.
No of transmission lines less.
i)Define multitasking.
Multiple users can execute multiple programs apparently concurrently. Each executing
program is a task (or thread) under control of the operating system. If an operating system can
execute multiple tasks in this manner it is said to be multitasking.----------2 marks
UNIT-I
--3 Marks
4 1-Wires Interface.
1. I2C (Inter Integrated Circuit) Bus:
The sequence of operation for communicating with an I2C slave device is:
1. Master device pulls the clock line (SCL) of the bus to „HIGH‟
2. Master device pulls the data line (SDA) „LOW‟, when the SCL line is at logic
„HIGH‟ (This is the „Start‟ condition for data transfer)
3. Master sends the address (7 bit or 10 bit wide) of the „Slave‟ device to which it wants
to communicate, over the SDA line.
4. Clock pulses are generated at the SCL line for synchronizing the bit reception by the
slave device.
5. The MSB of the data is always transmitted first.
6. The data in the bus is valid during the „HIGH‟ period of the clock signal
7. In normal data transfer, the data line only changes state when the clock is low.
8.Master waits for the acknowledgement bit from the slave device whose address is sent
on the bus along with the Read/Write operation command.
9.Slave devices connected to the bus compares the address received with the address
assigned to them
10. The Slave device with the address requested by the master device responds by
sending an acknowledge bit (Bit value =1) over the SDA line
11. Upon receiving the acknowledge bit, master sends the 8bit data to the slave device
over SDA line, if the requested operation is „Write to device‟.
12. If the requested operation is „Read from device‟, the slave device sends data to the
master over the SDA line.
13. Master waits for the acknowledgement bit from the device upon byte transfer
complete for a write operation and sends an acknowledge bit to the slave device for a
read operation
14. Master terminates the transfer by pulling the SDA line „HIGH‟ when the clock line
SCL is at logic „HIGH‟ (Indicating the „STOP‟ condition).
-----------------2 Marks
--------2 Marks
4. Wire interface (protocol):
--------------2 Marks
UNIT-II
---------------8Marks
B and BL
The B (Branch) and BL (Branch and Link) instructions cause a branch to a target address, and
provide both conditional and unconditional changes to program flow.
B{L}{<cond>} <target_address>
The BL instruction is used to perform a subroutine call. The return from subroutine is achieved
by copying the LR to the PC. Typically, this is done by one of the following methods:
BX
The BX (Branch and Exchange) instruction branches to an address held in a register Rm, with an
optional switch to Thumb execution. The branch target address is the value of register Rm, with
its bit[0] forced to zero. The instruction set to be used at the branch target is chosen by setting the
CPSR T bit to bit[0] of Rm.
BX{<cond>} <Rm>
BLX
This form of the BLX (Branch with Link and Exchange) instruction is used to call a Thumb
subroutine from the ARM instruction set at an address specified in the instruction. This
instruction is unconditional (always causing a change in program flow) and preserves the address
of the instruction following the branch in the link register (R14). Execution of Thumb
instructions begins at the target address.
BLX <target_addr> ---------------- -8 Marks
8. Interface LM35 with LPC2148 and write a C program to read room temperature using
LM35.
Diagram -----------4 Marks
-
#include <lpc214x.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
uint32_t result;
float voltage;
char volt[18];
LCD_Init();
PINSEL1 = 0x01000000; /* P0.28 as AD0.1 */
AD0CR = 0x00200402; /* ADC operational, 10-bits, 11 clocks for conversion */
while(1)
{
AD0CR = AD0CR | (1<<24); /* Start Conversion */
while ( (AD0DR1 & 0x80000000) ==0); /* Wait till DONE */
result = AD0DR1;
result = (result>>6);
result = (result & 0x000003FF);
voltage = ( (result/1023.0) * 3.3 ); /* Convert ADC value to equivalent voltage */
LCD_Command(0x80);
sprintf(volt, "Voltage=%.2f V ", voltage);
LCD_String(volt);
memset(volt, 0, 18);
}
Program ---------------4Marks
9. Explain registers of PLL in detail.
----
Explaination----5Marks
Task States
A task can exist in one of the following states:
Running
When a task is actually executing it is said to be in the Running state. It is currently utilising the
processor. If the processor on which the RTOS is running only has a single core then there can
only be one task in the Running state at any given time.
Ready
Ready tasks are those that are able to execute (they are not in the Blocked or Suspended state)
but are not currently executing because a different task of equal or higher priority is already in
the Running state.
Blocked
A task is said to be in the Blocked state if it is currently waiting for either a temporal or external
event. For example, if a task calls vTaskDelay() it will block (be placed into the Blocked state)
until the delay period has expired - a temporal event. Tasks can also block to wait for queue,
semaphore, event group, notification or semaphore event. Tasks in the Blocked state normally
have a 'timeout' period, after which the task will be timeout, and be unblocked, even if the event
the task was waiting for has not occurred.
Tasks in the Blocked state do not use any processing time and cannot be selected to enter
the Running state.
Suspended
Like tasks that are in the Blocked state, tasks in the Suspended state cannot be selected to enter
the Running state, but tasks in the Suspended state do not have a time out. Instead, tasks only
enter or exit the Suspended state when explicitly commanded to do so through the
vTaskSuspend() and xTaskResume() API calls respectively.
11. Draw and explain the implementation of blinking LED using free RTOS with Arduino.
Task is a piece of code that is schedulable on the CPU to execute. So, if you want to perform
some task, then it should be scheduled using kernel delay or using interrupts. This work is done
by Scheduler present in the kernel. In a single-core processor, the scheduler helps tasks to
execute in a particular time slice but it seems like different tasks are executing simultaneously.
Every task runs according to the priority given to it.
Apart from the LED task, there will be one more task which is created by the kernel, it is known
as an idle task. The idle task is created when no task is available for execution. This task always
runs on the lowest priority i.e. 0 priority. If we analyze the timing graph given above, it can be
seen that execution starts with an LED task and it runs for a specified time then for remaining
time, the idle task runs until a tick interrupt occurs. Then kernel decides which task has to be
executed according to the priority of the task and total elapsed time of the LED task. When 1
second is completed, the kernel chooses the led task again to execute because it has a higher
priority than the idle task, we can also say that the LED task preempts the idle task. If there are
more than two tasks with the same priority then they will run in round-robin fashion for a
specified time.
Every newly created task goes in Ready state (part of not running state). If the created task
(Task1) has the highest priority than other tasks, then it will move to running state. If this
running task preempts by the other task, then it will go back to the ready state again. Else if task1
is blocked by using blocking API, then CPU will not engage with this task until the timeout
defined by the user.
If Task1 is suspended in running state using Suspend APIs, then Task1 will go to Suspended
state and it is not available to the scheduler again. If you resume Task1 in the suspended state
then it will go back to the ready. ------------------------------4Marks
basic idea of how Tasks run and change their states., we will implement two tasks in Arduino
Uno using FreeRTOS API.
APIs to be used: -------------------------------------------------4Marks
1. xTaskCreate();
2. vTaskStartScheduler();
3. vTaskDelay();