EasyManua.ls Logo

ST ST7 - The REG72251.ASM File and the REGISTER.INC File

ST ST7
317 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
176/317
6 - STMicroelectronics Programming Tools
Delay500:
ld a, #DELAY1 ; 2 cycles
ld Time, a ; 4 cycles
Loop1:
ld a, #DELAY2 ; 2 cycles
ld {Time+1}, a ; 4 cycles
Loop2:
ld a, #DELAY3 ; 2 cycles
ld {Time+2}, a ; 4 cycles
Loop3
ld a, #watch ; 2 cycles
ld wdgr, a ; 4 cycles
dec {Time+2} ; 5 cycles
jrne Loop3 ; 3 cycles
dec {Time+1} ; 5 cycles
jrne Loop2 ; 3 cycles
dec Time ; 5 cycles
jrne Loop1 ; 3 cycles
ret
END
; Internal loop: 14 cycles
; Intermediate loop: 14 cycles
; External loop: 14 cycles
; total: (((((14*DELAY3+14)*DELAY2)+14)*DELAY1)+14)*0.25
; =493519 microseconds
You may have noticed that the secondary source file provides one public label, and that the
corresponding external declaration stands in the main program.
6.4.3.3 The REG72251.ASM file and the REGISTER.INC file
The REG72251.ASM file contains the declaration of all the registers of the ST72251 in an abso-
lute segment, because their addresses are fixed by hardware. Each declaration is made
public by adding a dot before each label, so that any other source file of the project can make
reference to the registers, provided the necessary
EXTERN statements are added to that
source file. Here is an excerpt from the
REG72251.ASM file:
ST7/
;*************************************************************
;* ST72251 registers :
;* This file declares the labels of all the registers
;* of the Input/Output peripherals. The bit numbers
;* within each register and the corresponding EXTERN

Table of Contents

Related product manuals