Texas Instruments MSP50C6xx User Manual

Page 348

Advertising
background image

C– – Efficiency

5-52

playing. In some cases speech files can be played to debounce keys. This is
why there is no delay in the main() function. Pressing SW2 calls a function, but
the switch will not be read again until the time has been spoken so there is no
need for a delay there.

Example 5–3. Third Project (C–– with an LCD)

The main difference between this project and the second project is the addition
of an LCD display. The variables storing the time were also changed to an
array of ints instead of separate int variables to demonstrate the use of C– –
arrays. This is not the clearest or easiest way to keep track of the time. It was
added as an example of C– – arrays. Multidimensional arrays are not
supported in C– –, but the same functionality can be achieved by multiplying
and adding the indices. For example, if an array is defined as:

int a [3*4]; // equivalent to int a [3][4] in C

Then the element at row x column y can be accessed by using index = rowNum
* row + column.

value = a[3*1+0]; // equivalent to value = a[1][0] in C

-

[Root]

J

cmm1.asm

J

cmm1_ram.irx

J

flags.irx

J

main.cmm

J

main.irx

J

main_ram.irx

J

mainasm.asm

J

vroncof2.asm

J

rtc.rpj

J

[dsp]

H

[celp]

celp.irx
celp4.obj

H

[common]

util.obj
util2.obj

H

[general]

dsp_var.irx
dsputil.asm
getbits.asm
speak.asm
speak.irx
spk_ram.irx

H

[melp]

Advertising