Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

about CAN

about CAN

2006-02-17 by praveen gudi

hello friends,
i am intersted to work on AVR on chip CAN.
but, when I write a small program about the initialisation of CAN registers,(like CANMOB,CANSIT ETC)
the compiler is giving the error as invalid register.
I am very much new to CAN protocol.
if u have any files which show how to declare can registers and how the initialisation is done plz help me.
Simple example programs are greatly appreciated.
Thank you.


Praveen Gudi,
Embedded Software Engineer,
Invictus Technologies,
Bangalore- 560 044
Ph: 080-23355875

Yahoo! Mail
Use Photomail to share photos without annoying attachments.

Timer0 question on m128

2006-03-04 by wbounce

I have the following code which according to the doc sets sets the timer to CTC(clearTimerOnCompareMatch) mode with a prescale of 128. I basicaly am trying to have the compare ISR fire once every ms. According to the datasheet on page 95 the formula to find the frequency of compare firing is

f=f(i/o)/ 2*prescale* (1+ocr0)

f(i/o) in my case is 16,000,000

therefore f = 16,000,000/2*128*(1+OCR0) and if OCR0 = 125 f = 496 which means it is firing every 2 ms right?

OCR0 needs to be 62 to give me a 1 ms firing right?

If you are using the asynchronous clock source ie 32768hz is the formulae the same? if so a OCR0 of 32 and prescale is 1 then f = 32768/2*1* (1+32) also yields 496hz or every 2ms right?

SIGNAL(SIG_OUTPUT_COMPARE0)
{
ms_count++;
....
}

void init_timers(void)
{
TIFR |= BV(OCF0);
TCCR0 = BV(WGM01)|BV(CS02)|BV(CS00); /* CTC, prescale = 128 */
TCNT0 = 0;
TIMSK |= BV(OCIE0);
OCR0 = 125;
}

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.