0% found this document useful (0 votes)
12 views

Ch03_Embedded_Systems programming

design embedded system using microprocessors

Uploaded by

Bewnet Getachew
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Ch03_Embedded_Systems programming

design embedded system using microprocessors

Uploaded by

Bewnet Getachew
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

EMBEDDED SYSTEMS

CHAPTER 3: EMBEDDED MICROPROCESSOR AND


PROGRAMMING
3.1 WHAT IS AN EMBEDDED SYSTEM PROGRAMMING?

BEWNET GETACHEW , MS.C.


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.1 INTRODUCTION
• Microprocessor is a digital
device on a chip which can fetch
instructions from a memory,
decode and execute them i.e.
performs certain arithmetic and
logical operations, accept data
from input device, and send
results to output devices
• Basically, there are five building
blocks of a digital computer
namely:
 Input Unit
 Memory Unit
 Arithmetic and Logical Unit (ALU)
 Control Unit
 Output Unit
Image Courtesy of
Recording Connection of Canada

3.1 INTRODUCTION
CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.2 BASIC MICROPROCESSOR SYSTEM


• The Microprocessor alone does
not serve any useful purpose
unless it is supported by
memory and I/O ports. The
combination of memory and I/O
ports with microprocessor is
known as microprocessor based
system.

• microprocessor is the central


processing unit executes the
program stored in the memory
and transfer data to and from
• the outside world through
The microprocessor I/O
is interconnected with memory and I/O ports by the data
ports.
bus, the Address bus and the control bus. A bus is basically a
communication link between the processing unit and the peripheral devices
Image Courtesy of
Recording Connection of Canada

3.2 BASIC MICROPROCESSOR SYSTEM


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.3 EMBEDDED PROGRAMMING LANGUAGES


• Programming languages provide this necessary link between man and
machine.
• categorize Programming language as low Level and high level programming
languages

a. Low-Level Programming Language


 "close to the hardware."
 does not need a compiler or interpreter to run
 Low-level programming languages are sometimes divided into two
categories: first generation, and second generation programming
languages.
 First Generation Programming Language - Machine language
 Second Generation Programming Language Assembly language

3.3 EMBEDDED PROGRAMMING LANGUAGES


CH.1:3:INTRODUCTION
CH. EMBEDDED SYSTEMS PROGRAMMING
TO EMBEDDED SYSTEMS

A typical assembly language statement of 8085 microprocessor written by the


programmer is given below, which is divided in to four fields namely, Label,
Mnemonics or Operation code (Opcode), Operand and comments.

Label Mnemonics Operand Comments

START: LXI H, 2500 H ; Initialize H-L register pair

 A utility program called an assembler is used to translate assembly language


statements into the target computer's machine code.
• conversion of machine language to the assembly language is done by
dissembler.
b. High-Level Programming Language In high level languages
the words in English are
converted into binary
language of different
microprocessors with the
help of a program called
Interpreter or Complier.
CH. 3: EMBEDDED SYSTEMS PROGRAMMING

• The high level programming language developed so far may be categorized into
third, fourth and fifth generation programming languages
 Third Generation Programming Language including Java, C++,
 Fourth-Generation Programming Language IDE , SQL , MATLAB etc.
 Fifth-Generation Programming Language artificial intelligence

Problems
3.1 Discuss basic microprocessor system with the help of block diagram.
3.2 What are low level embedded programming languages? Discuss them.
3.3 Discuss first generation embedded programming languages.
3.4 Discuss second generation embedded programming languages.
3.5 Write short note on high level embedded programming languages.
3.6 What is the difference between assembly language and machine language?
3.7 Mention the brief description of Assembly Language. What are the advantages of
assembler? Image Courtesy of
Recording Connection of Canada
CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor

Image Courtesy of
Recording Connection of Canada

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

. INTERFACING LED WITH 8085


Fig. shows how to interface the LED to microprocessor. As you can see the Anode
is connected through a resistor to GND & the Cathode is connected to the
Microprocessor pin. So when the Port Pin is HIGH the LED is OFF & when the Port
Pin is LOW the LED is turned ON.

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
PIN ASSIGNMENT WITH 8085

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
CIRCUIT DIAGRAM TO INTERFACE LED WITH 8255

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
ASSEMBLY PROGRAM TO ON AND OFF LED USING 8085

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
Statement: Design a system (both Software and Hardware) that will cause 4 LEDs
to flash 10 times when a push button switch is pressed. Use 8255. Assume
persistence of vision to be 0.1 seconds.
INTERFACING SCHEME

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
Program

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

3.4 PROGRAMMING 8085 Microprocessor


CH. 3: EMBEDDED SYSTEMS PROGRAMMING

WRITE A PROGRAM TO CONTROL THE TRAFFIC LIGHT SYSTEM USING 8085 & 8255 PPI.
DESCRIPTION: This Program controls light of one square. By changing the delay
between two signals one can change the speed of traffic.
8255 Port Address.
Port A- 00H
Port B -01H
Port C- 02H
Control Word 03H

3.4 PROGRAMMING 8085 Microprocessor


Address Label Mnemonics Hex Code Comments
2000 MVI A, 80 3E, 80 Initialize 8255, port A and port B in output
mode
2002 OUT CNT REG D3, 03
2004 START MVI A, 09 3E, 09
2006 OUT PORTA D3, 00 Send data on PORTA to glow R1 and R2
2008 MVI A, 24 3E, 24 .
200A OUT PORTB D3, 01 Send data on PORTB to glow G3 and G4
200C MVI C, 28 0E, 28 Load multiplier count (40ıο) for delay
201E CALL Delay CD,30,20 Call delay subroutine (20 seconds)

2012 MVI A, 12 3E, 12


2014 OUT PORTA D3, 00 Send data on Port A to glow Y1 and Y2
2016 OUT PORTB D3, 01 Send data on port B to glow Y3 and Y4
2018 MVI C, 0A 0E, 0A
201A CALL Delay CD,30,20 Call delay subroutine (5 seconds)
201D MVI A, 24 3E, 24
201F OUT PORTA D3, 00 Send data on port A to glow G1 and G2
2021 MVI A, 09 3E, 09 Jump back to read status
2023 OUT PORTB D3, 01 Send data on port B to glow R3 and R4
2025 MVI C, 28 0E, 28 Load multiplier count (40ıο) for delay
2027 CALL Delay CD,30,20 Call delay subroutine (20 seconds)

202A MVI A, 12 3E, 12


202C OUT PORTA D3, 00 Send data on port A to glow Y1 and Y2
202E OUT PORTB D3, 01 Send data on port B to glow Y3 and Y4
2030 MVI C, 0A 0E, 0A Load multiplier count (10ıο) for delay
2032 CALL Delay CD,30,20 Call delay subroutine (5 seconds)
2035 START JMP C3, 04, 20 Jump back to start
Delay subroutine:
Address Label Mnemonics Hex Code Comments
2030 DELAY LXI D, 2050 31, 50,20 Load count to give 0.5 sec delay

2033 Back DCX D 1B Decrement counter

2034 MOV A, D 52
2035 ORA E B3 Check whether count is 0

2006 Back JNZ C2,33,20 . If not zero, repeat

2009 DCR C 0D Check if multiplier zero, otherwise repeat

200A DELAY JNZ C2,30,20 DELAY

200D RET C9 Return to main program


CH. 3: EMBEDDED SYSTEMS PROGRAMMING
Write an assembly language program to check the even parity or the odd parity of
the number stored in memory location 0030 H. Send 00 H or EE H at the output
port 02 H if the parity is odd or even respectively.

LXI H,0030
MOV A,M
ORA A
JPO 000F
MVI A,EE
OUT 02
JMP 0013
MVI A,00
OUT 02
HLT
# ORG 0030
# DB 04H
3.4 PROGRAMMING 8085 Microprocessor
CH. 3: EMBEDDED SYSTEMS PROGRAMMING

Questions:
1. What is microprocessor?
2. What are the basic units of microprocessor?
3. What is a bus?
4. Why data bus is bi-directional?
5. List the flags of 8085?
6. Why interfacing is needed for I/O devices?
7. What is a port?

3.4 PROGRAMMING 8085 Microprocessor

You might also like