CEN498 Embedded Systems: Assoc. Prof. Dr. Kamil Dimililer
CEN498 Embedded Systems: Assoc. Prof. Dr. Kamil Dimililer
CEN498 Embedded Systems: Assoc. Prof. Dr. Kamil Dimililer
1
28/10/2021
Memory Organization
3
2
28/10/2021
3
28/10/2021
Directives
• Commands that are recognized and
acted upon by the assembler
– Not part of the instruction set
– Used to inform assembler (declare ).
• Different assemblers have different
directives. For Example,
• KEYDATA EQU 0x21 ; Declares that
KEYDATA is used instead of 0x21
Dr. Kamil7Dimililer
Instructions
• Assembled into machine code by
assembler
• Executed at runtime by the CPU
• Member of the instruction set the
selected processor
• Parts
– Label
– Mnemonic
– Operand
– Comment
Dr. Kamil8Dimililer
4
28/10/2021
Labels
• Act as place markers
– marks the address (offset) of code and data
• Follow identifer rules
• Data label
– must be unique
– example: KEYDATA Address of data memory
• Code label
– target of jump and loop instructions
– example: L1: Address of code memory
Dr. Kamil9Dimililer
Dr. Kamil10Dimililer
10
5
28/10/2021
Comments
• Comments are useful
–explain the program's purpose
–when it was written, and by whom
–revision information
–tricky coding techniques
–application-specific explanations
–begin with semicolon (;)
Dr. Kamil11Dimililer
11
• Programmer
• Compiler/assembler
• Processor
Dr. Kamil12Dimililer
12
6
28/10/2021
• ; WRITTEN BY
• ; DATE REV 1
• ; FILE SAVED AS EXP1.ASM
• ; FOR PIC 16F877 40 PIN DEVICE
• ; RESONATOR 10MHz
• ; WATCHDOG DISABLED
• ; CODE PROTECTION OFF
Example •
•
•
; ********** THE ROUTINES START HERE *********
ORG 20H
START CALL INITP ;INITIALISE PORTS
• END
Dr. Kamil Dimililer 13
13
14
7
28/10/2021
Status Register
15
Status Register
16
8
28/10/2021
ADCON1 Register
17
18