| Flavio58 
 
 
 Joined: 08 Sep 2003
 Posts: 21
 
 
 
			    
 
 | 
			
				| Debug problem.... |  
				|  Posted: Fri Jul 25, 2003 7:58 am |   |  
				| 
 |  
				| Using RTCC I created a clock that count the seconds number elapsed since 1-1-2001. In my software I wrote two functions....
 The first receive as arguments the string address where store the date-time string and the seconds number.
 
 void	asciiDate(char *d, int32 sec)
 
 The sedcond function execute the inverse function.
 It receive 5 arguments (day, month, year, hour, minute) and return the seconds number elapsed since 1-1-2001
 
 int32	numSeconds(int16 d, int16 m, int32 y, int32 hours, int32  minutes)
 
 To try these functions I wrote in main function :
 
 seconds = numSeconds(17, 3, 2002, 12, 20);
 while(1) {
 ...
 asciiDate(utilBuff, seconds);
 
 }
 
 The first caledd function terminate wirh :
 
 ....
 if(modulo==0)
 ++numdays;
 numdays += d-1;
 sec += (numdays* 84600) + (hours*3600+minutes*60);
 return sec;
 }
 
 When I try to debug these function the debugger flow into this function but it stop (without return to main function) on the last line of the following mixed-code function.
 
 
 106:               	if(modulo==0)
 107:               		++numdays;
 000224    524D     MOVF 0x1, 0,
 108:               	numdays += d-1;
 00023C    0E01     MOVLW 0x1
 109:               	sec += (numdays* 84600) + (hours*3600+minutes*60);
 000256    C048     MOVFF 0x48, 0x59
 110:               	return sec;
 000306    C049     MOVFF asciiDate$hour, 0
 111:               }
 000316    EF7A     GOTO 0xaf4
 00031C    FFFF     NOP
 00031E    6AEA     CLRF FSR0H, 0     <<<<<< HERE ... LOOP
 
 The function don't return ....
 I use MPLAB 6.30 with CCS compiler and ICD 2 debugger (connected to PICDEM 2 board).
 I am not a PIC expert but this problem rememeber me in Unix/Wn/Dos environment when the stack crash and the software lost the return address....
 Is possible this supposition  ?
 ___________________________
 This message was ported from CCS's old forum
 Original Post ID: 144516352
 |  |