Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
Robot Code

Robot Code

Ratings: (0)|Views: 68|Likes:
Published by api-3701797

More info:

Published by: api-3701797 on Oct 14, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

ALGORITHM
The Algorithm implemented in the 8085 microprocessor kit to drive the DC
Motor is as shown:

1) Busy Wait for a Key Press
2) Detects a Key Pressed
3) Identify the Key
4) Passes Control to the Appropriate Subroutine
5) go back to 1 unless the Exit Key was identified in step 3

Assembly Code and Listing
00010000
0002 0000
.ORG 2000h
0003 2000 31 00 29
LXI SP, 2900H ;Initialise the
Stack Pointer
0004 2003 3E 08
MVI A,08h
0005 2005 20
RIM
0006 2006 CD 32 20
KBREAD: CALL RDKBD;READ KEYBOARD
FUNCTION
0007 2009
0008 2009
;USING THE KEYBOARD AS JOYSTICK :The following key patterns are
used
;
9-->The BOT will be driven toward the Front
;
4-->The BOT will be turned toward the Left
;
6-->The BOT will be turned toward the Right
;
1-->The BOT will be driven backward
;
5-->The Exit Code. This will result into Program
Termination
;
9
;
4
5
6
;
1
;Given below is the assembly code that checks the key-value. This is
analogous to switch-case programming structure in C
0023 2009 FE 09
CPI 09h
;compare with
key value 09
0024 200B CC 00 21
CZ FRONT
;If matched
call the subroutine FRONT
0025 200E CA 06 20
JZ KBREAD
;Go back to
Read the Keyboard
0026 2011
0027 2011
0028 2011 FE 01
CPI 01h
;compare with key
value 01
0029 2013 CC 1E 21
CZ BACK
;If matched call
the subroutine BACK
0030 2016 CA 06 20
JZ KBREAD;Go back to
Read the Keyboard
0031 2019
0032 2019 FE 06
CPI 06h
;;compare with
key value 01
0033 201B CC 3C 21
CZ RIGHT;If matched call
the subroutine RIGHT
0034 201E CA 06 20
JZ KBREAD
0035 2021
0036 2021 FE 04
CPI 04h
0037 2023 CC 5A 21
CZ LEFT
0038 2026 CA 06 20
JZ KBREAD
0039 2029
0040 2029 FE 05
CPI 05h
0041 202B CA 31 20
JZ EXIT;If Key 5 was
pressed Exit
0042 202E C3 06 20
JMP KBREAD
0043 2031
0044 2031 76
EXIT:
HLT
0045 2032
;Subroutines FRONT , BACK , RIGHT , LEFT are described below

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->