Texas Instruments MSP50C6xx manual New C-- callable functions were declared global

Models: MSP50C6xx

1 390
Download 390 pages 41.72 Kb
Page 346
Image 346

C– – Efficiency

inte iret

 

Cmm1.asm was modified to include routines for sleeping and speaking from

 

C––.

global

_inportD

global

_getSecondsPassed

global

_sleepQuarterSec

global

_speakDays

global

_speakOnes

global

_speakTens

global

_speakTeens

global

_speakAMPM

 

New C–– callable functions were declared global.

external

sleep_light

external

speak

 

Assembly routines that will be called are declared external.

include

”speech\celp\days.qfm”

include

”speech\celp\ones.qfm”

include

”speech\celp\teens.qfm”

include

”speech\celp\tens.qfm”

include

”speech\celp\ampm.qfm”

 

Include statements were used to add speech files for all of the phrases that the

 

clock will need to say.

_sleepQuarterSec

mov a0,8192 – 1 ;setup a 250ms period

out TIM1,a0 ;load TIM1 and PRD1 mov a0, TIM1IMR

call sleep_light nop

ret

A routine was added to sleep for a quarter second using Timer 1 to wake up. The program loads the period into the timer 1 period register, sets the wake-up mask in a0, and calls sleep_light, which is in sleep.asm.

_speakDays

; back up important registers

mov *csave_r5,

r5

;

protect

r5

mov *csave_r3,

r3

;

protect

r3

mov a0,

*r7 – 2 ; synthesis table offset

add

a0, _days_table

mov a0,

*a0

 

ZAC A0~

 

CALL SPEAK

 

; restore important registers

mov r3, *csave_r3

; restore r3

mov r5, *csave_r5

; restore r5

ret

_days_table ; table for table lookup

5-50

Page 346
Image 346
Texas Instruments MSP50C6xx manual New C-- callable functions were declared global, Clock will need to say