Yahoo Groups archive

AVR-Chat

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

Message

Re: [AVR-Chat] Help needed on ATMEGA128 AND TIMER0

2006-02-25 by David Kelly

On Feb 24, 2006, at 9:46 PM, kishor lalu bande wrote:

> i have written following programm
> for delay why it is not working.
> my clock speed is 4Mz and and want use it for LCD display delays
>
> void waitMS(unsigned long ulMS)
> {
>     CLI();          // disable all interrupts
>     ulTick = ulMS;
>     SEI();          // re-enable interrupts
>     while (ulTick>0);
> }

You don't show the definition of ulTick. It must be volatile.

As for timing I/O to LCD's, don't. Poll the LCD for its busy bit,  
while using a timer (such as your ulTick) to prevent an infinite loop  
if the LCD does not respond.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.

Attachments

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.