Download ECED 3204. Microprocessors - Myweb.dal.ca

Transcript
ECED 3204. Microprocessors
M68HC11 Microcontroller
Advantages of Named Constants
1. Their value only needs to be changed once (in the Definition Part)
2. Improves readability of Assembly Code
Other Examples:
; Constants
DELAY
equ
2000
; Delay value to initialize counter with
BITMASK1 equ
%00000001 ; Mask used for parity, bit 0 (B0)
BITMASK2 equ
%00110000 ; Mask used to toggle bits 4 & 5 (B4 & B5)
; Instructions (These are just isolated examples, NOT part of a program)
ldx
#DELAY
; Initializing delay counter IX
bita
#BITMASK1 ; Checking if B0 is 0 or 1, <ACCA> even or odd
anda #BITMASK1 ; Does the same as bita but also modify ACCA
; In this case ACCA B1-B7 are cleared
eora #BITMASK2 ; Toggles ACCA bits 4 & 5 (B4 & B5)
Dalhousie University
62
Jose A. Gonzalez-Cueto