beautypg.com

Texas Instruments MSP50C6xx User Manual

Page 359

background image

Initializing the MSP50C6xx

6-5

Applications

6.2.1

File

init.asm

;****************************************************************
; INIT.ASM
;
; Revision 1.04
;
; Modified from revision 1.03: if not CRO, we check port 0x2F
; to distinguish between P and
; C parts.
;
; Turn off TIMER 2 rather than leave it running.
;
; Modified to cope with 6 bit trim value. Top 5 bits go to bits
; 15–11 in ClkSpdCtrl, LSB of trim goes to bit 9 in ClkSpdCtrl.
;
; A fairly basic but compact initialization routine for the 614.
; This sets the 614 to run at 8 MHz, 10 bit DAC at 8 kHz.
;
; Geoff Martindale, BP
; May 2000
;****************************************************************

;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;! FOR RESISTOR TRIM USERS:
;! DO NOT WRITE TO PORT G PRIOR TO READING THE RTRIM VALUE!
;! THIS PRESERVES THE ZERO VALUE AT PORT 0x2F WHEN READING THE
;! TRIM VALUE (should be zero if P part, should be non–zero if
;! C part).
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;****************************************************************
; Start off by clearing all the RAM (and tags) and then zero
; every register. The status register (STAT) must be cleared
; immediately upon power up.
;****************************************************************
init614

zac a0

;clear a0

mov *0x001,a0

;clear second RAM location, leave first for C––

mov STAT,*0x001

;clear status register

mov STR,32–2

;set string register to loop 32 times

zacs

a0

;clear all accumulators

out IFR,a0

;clear pending interrupts

out IntGenCtrl,a0

;clear all interrupt mask bits, disable timers

mov r0,0x000

;point to beginning of RAM

mov r4,RAM_SIZE – 2

;do a loop RAM_SIZE times

BEGLOOP
rtag

*r0

;reset tag

mov *r0++,a0

;clear the RAM

ENDLOOP

mov STR,0

;clear string register