Texas Instruments MSP50C614 User Manual

Page 373

Advertising
background image

MSP50C614/MSP50P614 Initialization Codes

6-5

Applications

6.2.1

File

init.asm

;****************************************************************
; INIT.ASM
;
;
; Copyright: 1998 Texas Instruments, Inc. All rights reserved.
;
; –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
; This Initialization Routine has the following Dependent Files.
; These should be ”included” once within the MAIN program .ASM file:
;
; IMPORTANT:
; Texas Instruments reserves the right to change this routine at any time
; without notice.
; –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
; This Initialization Routine performs the following Functions:
;
; 1. Disable interrupt.
; 2. Zeros all accumulators.
; 3. Clears memory
; 4. Starts PLL with clock frequency defined by PLLMBITS. Appropriately
; sets the RTO trim bits (for C614 only). Switch to idle mode for 200ms
; for PLL to stabilize.
; 5. If DAC interrupt is replaced by Timer 1 interrupt, the period of
; timer 1 is stored in TIM1 register.
; 6. Zeros all system registers except R7 (STACK).
;
; 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.
;
;****************************************************************
C614FLAG EQU 0 ;EQU 1 if MSP50C614 part
RESISTORTRIM EQU 0x20 ;Resistor trim value for MSP50P614 ONLY!
CRO_FLAG EQU 0 ;EQU 0 : for resistor–trimmed osc, RTO
;EQU 1 : for external crystal ref, CRO
PLLMBITS EQU 0x7C ;For CPU clock of 8MHz
;****************************************************************
; 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 *0x000,a0

;clear first RAM location

mov STAT,*0x000 ;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

Advertising