1 of 47

Unit 4

2 of 47

3 of 47

Marking System

Unit IV (10 questions )

8 questions one mark (Theory)

2 questions two marks (Code snippets)

Total Marks : 12

4 of 47

Introduction to Android

  • Android is an open source and Linux-based operating system for mobile devices such as smart phones and tablet computers.
  • Android was developed by the Open Handset Alliance, led by Google, and other companies.

5 of 47

6 of 47

7 of 47

  • Android operating system is a stack of software components which is divided into five sections and four main layers as shown below in the architecture diagram.

Android Applications

Android Framework

Libraries

Dalvik Runtime

Linux Kernal

8 of 47

9 of 47

10 of 47

11 of 47

12 of 47

13 of 47

Core Libraries

  • System C library, the standard C system library, tuned for embedded Linux-based devices
  • Media Libraries, support playback and recording of many popular audio and video formats, as well as image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
  • Surface Manager, manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications
  • WebKit, a modern web browser engine which powers both the Android browser and an embeddable web view
  • SGL, the underlying 2D graphics engine
  • 3D libraries, an implementation based on OpenGL ES 1.0 APIs
  • FreeType , bitmap and vector font rendering
  • SQLite , a powerful and lightweight relational database engine

13

14 of 47

15 of 47

16 of 47

17 of 47

18 of 47

19 of 47

20 of 47

Embedded ‘C’

21 of 47

What is Embedded System

  • System
    • A system is an arrangement in which all its unit assemble work together according to a set of rules.
  • Embedded System
    • An embedded system is a microcontroller or microprocessor based system which is designed to perform a specific task.
      • For example, a fire alarm is an embedded system; it will sense only smoke.

22 of 47

Characteristics of an Embedded System

  • Single-functioned
  • Tightly constrained
  • Reactive and Real time
  • Microprocessors based
  • Memory
  • HW-SW systems

23 of 47

  • Advantages
    • Easily Customizable
    • Low power consumption
    • Low cost
    • Enhanced performance
  • Disadvantages
    • High development effort
    • Larger time to market

24 of 47

Basic Structure of an Embedded System

25 of 47

  • Sensor − It measures the physical quantity and converts it to an electrical signal which can be read by an observer or by any electronic instrument like an A2D converter.
  • A-D Converter − An analog-to-digital converter converts the analog signal sent by the sensor into a digital signal.
  • Processor & ASICs (application-specific integrated circuit) − Processors process the data to measure the output and store it to the memory.
  • D-A Converter − A digital-to-analog converter converts the digital data fed by the processor to analog data
  • Actuator − An actuator compares the output given by the D-A Converter to the actual (expected) output stored in it and stores the approved output.

26 of 47

Processors in a System

A processor has two essential units −

  • Program Flow Control Unit (CU)
    • The CU includes a fetch unit for fetching instructions from the memory.
  • Execution Unit (EU)
    • The EU has circuits that implement the instructions pertaining to data transfer operation and data conversion from one form to another. The EU includes the Arithmetic and Logical Unit (ALU) and also the circuits that execute instructions for a program control task such as interrupt, or jump to another set of instructions.

27 of 47

Types of Processors

Processors can be of the following categories −

  • General Purpose Processor (GPP)
    • Microprocessor
    • Microcontroller
    • Embedded Processor
    • Digital Signal Processor
    • Media Processor
  • Application Specific System Processor (ASSP)
  • Application Specific Instruction Processors (ASIPs)
  • GPP core(s) or ASIP core(s) on either an Application Specific Integrated Circuit (ASIC) or a Very Large Scale Integration (VLSI) circuit.

28 of 47

Processors in a System

  • Microprocessor
    • A microprocessor is a single VLSI chip having a CPU, having RAM, ROM, I/O ports and Timer.
  • Microcontroller
    • A microcontroller is a single-chip VLSI unit (also called microcomputer) having limited but integrated computational capabilities, possesses enhanced input/output capability and a number of on-chip functional units.

29 of 47

Features of 8051 Microcontroller

  • 64K bytes on-chip program memory (ROM)
  • 128 bytes on-chip data memory (RAM)
  • Four register banks
  • 128 user defined software flags
  • 8-bit bidirectional data bus
  • 16-bit unidirectional address bus
  • 32 general purpose registers each of 8-bit
  • 16 bit Timers (usually 2, but may have more or less)
  • Three internal and two external Interrupts
  • Four 8-bit ports,(short model have two 8-bit ports)
  • 16-bit program counter and data pointer
  • 8051 may also have a number of special features such as UARTs, ADC, Op-amp, etc.

30 of 47

Black diagram 8051 Microcontroller

31 of 47

8051 Microcontroller

32 of 47

What is Embedded ‘C’

Whenever the conventional ‘C’ language and its extensions are used for programming embedded system, it is referred to as “Embedded C” programming .

33 of 47

��Why ‘C’ for Embedded system��

34 of 47

35 of 47

36 of 47

37 of 47

��Sample Embedded C program��

#include “16F877A.h”

void main()

{

int x;

x=input _A();

output_B(x);

}

Input from Port A

Out data x to Port B

38 of 47

��Sample Embedded C program��

#include “16F877A.h”

void main()

{

int x;

for(x=1;x<=10;x++)

{

output_B(x);

delay_ms(100);

}

}

Delay for 100 milliseconds

39 of 47

��Sample Embedded C program��

40 of 47

��Sample Embedded C program��

41 of 47

42 of 47

Functions provide in MPLAB toolkit

Sr. No.

Library Function

Operation

1.

delay_us(x)

Generate a delay of ‘x’ microseconds

2.

delay_ms(x)

Generate a delay of ‘x’ milliseconds

3.

output_p(x)

Outputs the parameter ‘x’ to port specified by ‘p’

4.

output_high(PIN_P0)

Sets Pin ‘P0’ to logical ‘1’ (High)

5.

output_low(PIN_P0)

Resets or clear Pin ‘P0’ to logical ‘0’ (Low)

6.

input_x()

Returns the value on input port ‘x’

7.

input(PIN_px)

Returns value of ‘x’ pin of the ‘p’ port.

43 of 47

Interfacing Stepper Motor with 8051

  • A Stepper Motor is a brushless, synchronous DC Motor.
  • There are two types of stepper motors Unipolar and Bipolar.
  • Motors can be easily interfaced with a microcontroller using driver ICs such as L293D or ULN2003.

44 of 47

H-bridge for motor driving

45 of 47

Full Step Sequence

46 of 47

Full Step Sequence

Full Drive Stepping Sequence

Step

A

B

C

D

1

1

1

0

0

2

0

1

1

0

3

0

0

1

1

4

1

0

0

1

47 of 47

Keil C Code for Full Drive

#include<reg52.h>

#include<stdio.h>

void delay(int);

void main()

{

do

{

P2 = 0x03; //0011

delay(1000);

P2 = 0x06; //0110

delay(1000);

P2 = 0x0C; //1100

delay(1000);

P2 = 0x09; //1001

delay(1000);

}

while(1);

}

void delay(int k)

{

int i,j;

for(i=0;i<k;i++)

{

for(j=0;j<100;j++)

{}

}

}