Piotr Piwko

Problem with TBM

Discussion created by Piotr Piwko on Feb 19, 2006
Latest reply on Feb 21, 2006 by Piotr Piwko
Hi,

I would like to use Timebase Module (TBM) in GP32. I set timebase rate to 1Hz but TBM generates too many tamebase interrupt. Please tell me what do I wrong. This is my code in CW08:

/* TBM interrupt handle */
void interrupt 16 tbm_interrupt()
{
if(LED_PIN == 1)
led_off();
else
led_on();
}

void main(void)
{
EnableInterrupts; // Enable interrupts
LED_DDR = 1; // Led pin as output

/* TBM (Timebase Module) */
TBCR_TBON = 0; // Disable TBM
TBCR_TACK = 1;
// Timebase rate to 1Hz
TBCR_TBR2 = 0; TBCR_TBR1 = 0; TBCR_TBR0 = 0;
TBCR_TBIE = 1; // Enable timebase interrupt
TBCR_TBON = 1; // Enable TBM

for(;:smileywink: {
__RESET_WATCHDOG(); // Watchdog
}
}

Thank you for your time

Outcomes