Download presentation
Presentation is loading. Please wait.
Published bySilvester Clark Modified over 9 years ago
1
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical Engineering Department بسم الله الرحمن الرحيم ECOM 4315 — Fall 2008 Lecture 16
2
The LUT is used when being disable to find a special relation between the input and the output in any way. LUT can be used in: ? ? ? Seven segment LCD CODE Look Up Table: Look Up Table
3
Seven segment( 0 9) using indirect addressing Seven segment ( available characters) Look Up Table: Example
4
SEVEN segment EXAMPLE
5
SEVEN segment EXAMPLE
6
SEVEN segment EXAMPLE
7
Macros are a very useful element in assembly language. They could briefly be described as "user defined group of instructions which will enter assembler program where macro was called". It is possible to write a program even without using macros. But with their use written program is much more readable, especially if more programmers are working on the same program together. Macros have the same purpose as functions of higher program languages. Macros
8
How to write macros? Macros From the way they were written, we could be seen that macros can accept arguments, too which is also very useful in programming. Whenever argument appears in the body of a macro, it will be replaced with the value. In order to use a macro in the program, it is necessary to include macro file in the main program with instruction include "macro_name.inc".
9
1)In execution stage, the subroutine puts the address of the called function in PC and hide the original value of PC (before calling) in the stack. 2) The macro in compilation process (not in execution), copies the macro in the place where it is called. It doesn't put address on stack. 3) The subroutine can be written or called in any place, but the macro must be declared before calling. 4) The subroutine takes more time in execution, but the macro doesn't take time. This can be considered as an advantage to the macro. 5) The subroutine doesn't take size in the program, but the macro takes as it is copied in the program during calling. It is considered as disadvantage to the macro. Macros What's the difference between macro and subroutine?
10
(Using Macros internally ) Types for using of Macros:
11
(Using Macros internally ) Types for using of Macros:
12
(Using Macros externally ) Types for using of Macros:
13
(Using Macros externally ) Types for using of Macros:
14
(Using Macros externally ) Types for using of Macros:
15
Notes: The first Macro is declared internally in the same file, but the second Macro is declared externally. In calling Macros, we didn't write the command call or other commands. We call it by writing its name directly. The program with internally or externally macro is the same size. Externally macros must be included in the same folder of the main program in which it is called,or writing its extension in the include statement. Macros Notes
16
Write two programs ( internally macro,externally macro) 1) BANK0 BANK1 2) Macro for reading from EEPROM Macro for Writing to EEPROM 3) Macro to perform multiplication process ( one digit) then (two digits) Macro to perform division process (one digit ) then ( two digits) Deadline: second week (2/11/2008 Tuesday) H.W#7
17
Design # 2 ( DC motor with optical encoder) Design problems Design controller for DC motor Switch for on/off Switch for right/left rotation Switch for speed control. speed level (8 led’s) Close loop with k controller.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.