C– – Efficiency
5-46
assembly divided by two because C– – integers are 16 bit. The perl script in
the main project directory can be used to resize bogus automatically or it can
be done manually. To use the perl script, build the project after making any
changes to assembly ram allocation. Run the perl script and then rebuild the
project. To manually adjust bogus, build the project and then examine the list
file mainasm.lst. Find RAMEND_ASM in the cross reference table and use it
to replace the value in the define statement in ram.h. Rebuild the project to put
the changes into effect. This only needs to be done when changes are made
to assembly RAM allocation. Changes to C– – or assembly code other than
RAM allocation do not require adjustments to bogus.
The next items in the program are function prototypes. All C– – functions have
a return type of int (16 bit) and are declared with the mnemonic cmm_func. The
first one is goasm(). Notice that there is no leading underscore because it is
being called from C– – instead of assembly. The second one is the function in
cmm1.asm for reading the value of seconds_passed.
Global variables are defined next. An integer is used to keep track of each
element of the time. Global variables can be initialized when they are declared.
The function updateTime() is used to update the time. It calls
getSecondsPassed() to determine the number of seconds that have passed
since the time has been updated. It then recalculates the time variables (hours,
minutes, etc.) updateTime() does not pass any values when it returns although
it is technically of type int, like all C– – functions.
The main() function is the starting point for user code. After the 6xx part has
been initialized main() is called from vroncof2.asm. The first call from main()
is to doasm() which is in mainasm.asm. This is the function that sets up the
timer and initializes seconds_passed. The program then goes into an infinite
loop where updateTime() is called. In later projects, this infinite loop will be
expanded to scan keys and write to the LCD.
Example 5–2. Second Project (C–– With Speech)
Adding speech to the first project increases functionality, but also increases
the complexity of the project.
Содержание MSP50C6xx
Страница 1: ...MSP50C6xx Mixed Signal Processor User s Guide Mixed Signal Products SPSU014A Printed on Recycled Paper...
Страница 6: ...vi...
Страница 14: ...xiv...
Страница 24: ...1 10...
Страница 296: ...Instruction Set Summay 4 210 Assembly Language Instructions...
Страница 332: ...Implementation Details 5 36 R7 Return Addr Return Addr Param 2 Param 2 Param 1 Param 1 R5 Stack data Function call...
Страница 366: ...6 12...