pea
developer
Hi all,
I recall this being covered many moons ago, but can't seem to find the post.
I would like to change the RTC (Mr.Mirkos SDK) from 1/64 second to 1/32 second but can't recall the logic to do this. The current code is:
	
	
	
		
Would I be correct in thinking:
	
	
	
		
?
Aha, found the wayward post:
According to squidge:
( value + 1 ) / 128 second
therefore (also adding the 8th bit)
value = (128/t)+127;
where t = number of times per second to fire
So for 1/32 seconds (32 times per second)
value = (128/32)+127;
value = 131; // %10000011 or 0x83
				
			I recall this being covered many moons ago, but can't seem to find the post.
I would like to change the RTC (Mr.Mirkos SDK) from 1/64 second to 1/32 second but can't recall the logic to do this. The current code is:
		Code:
	
	void setupRTCInt( void ) {
   // enable RTC
   rCLKCON |= 0x800;
   //
   // The CPU clock indepentent RTC Timer
   //
   // The ticnt register 0x15700044 (32 bit) offers:
   //
   // BIT   7: 0=disable 1=enable timer
   // BIT 0-6: tick time count value 1-127
   //
   // %10000000 should result in a 1/128 timer, but is not working
   // %10000001 result in 1/64 timer
   // %11111111 result in 1/1  timer
   
   rTICINT = 0x81;
   rGLOBALCOUNTER = 0;
}Would I be correct in thinking:
		Code:
	
	   // %10000000 should result in a 1/128 timer, but is not working
   // %10000001 result in 1/64 timer
   // %10000011 result in 1/32  timer
   // %10000111 result in 1/16 timer
   // %10001111 result in 1/8 timer
   // %10011111 result in 1/4 timer
   // %10111111 result in 1/2 timer
   // %11111111 result in 1/1  timerAha, found the wayward post:
According to squidge:
( value + 1 ) / 128 second
therefore (also adding the 8th bit)
value = (128/t)+127;
where t = number of times per second to fire
So for 1/32 seconds (32 times per second)
value = (128/32)+127;
value = 131; // %10000011 or 0x83
 
	
 
 
		 
 
		