Texas Instruments MSP50C6xx User Manual

Page 361

Advertising
background image

Initializing the MSP50C6xx

6-7

Applications

orb a0,0x7c

;set PLLM for CPU clock of 8 MHz

mov *save_clkspdctrl,a0

;save the ClkSpdCtrl value for later, when

;waking up from mid or deep sleep

mov a0~,TIM2REFOSC + TIM2IMR

;disable TIMER 2

out IntGenCtrl,a0~
mov a0~,6553

;setup a 200 ms period

out TIM2,a0~

;load TIM2 and PRD2 in one fell swoop

mov a0~,TIM2ENABLE + TIM2REFOSC + TIM2IMR
out IntGenCtrl,a0~

;use 32 kHz crystal as source, wake up from TIM2

out ClkSpdCtrl,a0

;set clock to full speed!

idle

;go to sleep...

nop

;wake up 200 ms later, clock running at full speed

nop
nop

;****************************************************************
; Upon reset all ports are set to input and port G output is set
; low (0x0000). Therefore it remains only to enable the pullups
; on port F.
;****************************************************************

in

a0,IntGenCtrl

or

a0,PFPULLUPS

;enable port F pullups

and a0,~TIM2IMR

;turn off TIMER 2 interrupt

and a0,~TIM2ENABLE

;turn off TIMER 2 ––– added 28.11.99

out IntGenCtrl,a0

;****************************************************************
; Set the DAC to 10 bits, C3x style. For C5x style set bit 3
; high.
;****************************************************************

movb

a0,0x02

;choose 10 bit DAC, C3x style

orb a0,DACON

;enable DAC

out DACCTRL,a0

;switch DAC on

;****************************************************************
; Initialization complete. Now tidy up and branch to the main
; user code.
;****************************************************************

zac a0

;tidy up

zac a0~

jmp _main

;jump to the main program

Advertising