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
Summary of Contents for MSP50C6xx
Page 6: ...vi...
Page 14: ...xiv...
Page 24: ...1 10...
Page 296: ...Instruction Set Summay 4 210 Assembly Language Instructions...
Page 366: ...6 12...