EasyManua.ls Logo

ST ST7 - Page 174

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...
174/317
6 - STMicroelectronics Programming Tools
The main program is the following:
ST7/
;=============================================================
;= Main (caterpillar) =
;=============================================================
#include "Register.inc"
EXTERN Delay500 ; By default, external label defined as a word
; definition of the constants
; =========================
BYTES ; The following constants defined as bytes
watch EQU $FF
cpudiv2 EQU 0 ; normal speed
segment 'rom'
WORDS ; Next labels are words.
; Initialisations
; ===============
reset:
ld a, #cpudiv2
ld miscr, a ; fq 8MHz /2 = CPU clock = 4MHz
ld a, #watch
ld wdgr, a ; Start watchdog
ld paddr, a ; port A as output
clr paor ; open drain, no pull up
ld padr, a ; leds off
rsp ; initialize stack
; Main program
; ============
Start:
ld x, #00
Next:
ld a, (table,x)
ld padr, a ; Switch one LED on pa0 OFF, others ON
call Delay500 ; according to table contents
inc x
cp x, #08 ; If at end of table, go back to the beginning
jreq Start
jra Next
; table of the patterns that are output in sequence
; =================================================
table: dc.b 1, 2, 4, 8, 16, 32, 64, 128
; Interrupt vectors
; =======================
segment 'vectit' ; ($FFE0)
DC.W 0 ; skip 8 vectors
DC.W 0
DC.W 0
DC.W 0
DC.W 0

Table of Contents

Related product manuals