C– – Efficiency
5-45
Code Development Tools
; MAIN.CMM
; Revision 1.00
****************************************************************/
#include
”ram\ram.h”
cmm_func
goasm(); // an pseudo main asm routine
cmm_func
getSecondsPassed(); // Retrieves the counter maintained
// by the Timer2 ISR and resets the
// counter.
int days=0;
int hours=12;
int minutes=0;
int seconds=0;
int ampm=0;
/************************************************
/ Updates time variables for clock ticks that
/ have occured.
************************************************/
cmm_func updateTime(){
seconds=getSecondsPassed();
while(seconds>59){
seconds=seconds–60;
+;
if(minutes>59){
minutes=0;
hours++;
if (hours == 12){
if(ampm==0){
ampm=1;
}
else{
ampm=0;
days++;
if(days>6){
days=0;
}//end days
}
}
if (hours>12){
hours=1;
}//end hours
}//end minutes
}//end seconds
}
cmm_func main()
{
goasm(); // run any assembly stuff that needs to be run
while(1){ // infinite loop
updateTime();
}
}
The include statement at the top of the program is for memory allocation
purposes. The C– – compiler is not aware that RAM has been allocated for
assembly and must be kept from overwriting it. This is done with an integer
array called bogus. The array is set to the size of the RAM allocated for
Содержание 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...