So...
clock() or time() seems to be useless for my goal.
I'm trying to implement a differente way... I hope it works, and I wait your suggests:
I would check the value of clock ticks every 25 ms, exploiting TPM registers and control bit, through an ISR on TPM1OF register, according to a 4MHz frequency of mcu clock.... (isn't it?)
TPM1OF changes to $0000 after reaching the modulo value programmed in the TPM counter modulo registers.
I thought this could be possible in this way, placing this code in vectortable.c :
Code:
#define TIMER_CNT 0x9E58; //Setting the granularity of a tick every 25mstypedef void(*tIsrFunc)(void);extern unsigned long timer0_tick; //this variable will be count the ticksextern interrupt void IRQIsr(void);//extern interrupt void KBD_ISR();extern interrupt void Vscirx();extern interrupt void Timer0_ISR(){ //Start of my ISR unsigned long long i; TPM1SC_TOIE=0; i = TIMER_CNT + TPM1CNTL+(TPM1CNTH<<8); TPM1CNTL= i; TPM1CNTH= (i>>8); TPM1SC_TOIE=1; timer0_tick ++; };
[..... some other code lines after]
Timer0_ISR , /* vector 08: TPM1OF */
Could it works good?
Will timer0_tick contain the value of time ticks after mcu started?
Can I use in this way timer0_tick in main.c and send it to another device?
Message Edited by Topoestivo on
2007-06-26 06:58 PMMessage Edited by Topoestivo on
2007-06-26 06:59 PM