Hi I have been going through example and I am struck on one thing.... Need to generate 250mS So I look at the table, the fastest rate which allws timer T3 to have a period of 250mS is 156.25 kHz hence T31= 100b 250mS/420 = 59.52 where 420mS is the maximum period. The intial value of the timer register is 39009 (65535*0.595)... I am still baffled with value of T3_RELOAD=100 so can someone kindly tell where 100 come from? Thank you
#include <reg167.h> #define T3_RELOAD 39009 /* T3 reload value : 250 ms */ //#define T3_RELOAD 100 /* T3 reload value : 250 ms */ /* Timer T3 ISR */ void T3_elapsed(void) interrupt 0x23 { T3 = T3_RELOAD; /* reset T3 */ P2 ^= 0x0001; /* toggle P2.1 */ } /* main program */ void main(void) { DP2 |= 0x0001; /* P2.1 : output */ P2 |= 0x0001; /* initially: LED off */ T3 = T3_RELOAD; /* load initial timer value T3 */ /* T3 in timer mode, counting down, pre-scale factor 128, period: 420 ms */ /* alternate output function disabled */ /* T3CON = 0000.0000.1000.0100 = 0x0084 */ T3CON = 0x0084; T3IC = 0x0044; /* enable T3 interrupt, ILVL = 1, GLVL = 0 */ IEN = 1; /* allow all interrupts to happen */ T3R = 1; /* start timer (T3CON |= 0x0040) */ while(1); /* forever... */ } /* main */
Happy new year 2006 Chris.... Can you please kindly explain where the value comes from GPT12E_T3? Eric
Ah I got it now... 39062 = 0x9896 Btw do you have any more example of using general peripheral ranging from CAPCOM and PWM? Eric
...do you have any more example of using general peripheral ranging from CAPCOM and PWM? Try http://www.hitex.co.uk or http://www.hitex.co.uk/download/c166examples/examplesrequest.html You'll find a wealth of information here, as well as many "must-have" tools for C16x development. Steph-
Eric, A short answer your question is no. I think like a lot of people, I answer questions in the forum on my own time so my preference (effort) would be to answer a specific question not generate code examples. Very simple code is fine to get the point across but I think it is more important for you to understand the underlying concepts. Here I am more than willing to go the extra mile to try to answer your questions. -Chris
I suggest: use Infineon DaVE together with the simulator to find out how the peripherals work. See: http://www.keil.com/appnotes/docs/apnt_182.asp