avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] altering array variable and interrupts


From: Philipp Burch
Subject: Re: [avr-gcc-list] altering array variable and interrupts
Date: Tue, 15 Jan 2008 21:41:58 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hi,

ok, if you need to modify the characters, then you can just declare the mentioned array volatile and not PROGMEM. What do you mean with "I don't think this really completely stops execution"? Have you tested it, or are you just guessing? What's the interval of the interrupt, how is F_CPU defined and do you use optimization? There's an easy way to check if the program continues: Place a cli(); instruction right before your mainloop. If it doesn't hang in the interrupt, the program should then just run inside the infinite loop and hence not do anything with the controllers pins, so you can easy check.

btw: You should reply to "address@hidden", or I'm the only recipient of the mail.

Philipp
Hi,
Thanks for reply. I do want to modify that array of char not to prevent changing them. Basicaly each time interrupt occurs it should read the array and output values, and I will change values often. I know delay inside interrupt is not a good tactic but I just didn't have time to compute the right low-to-high transaction time in CPU clocks to match the 74hc161 4-bit counter logical diagaram I clock from interrupt; hence I used a delay. I don't think this really completely stops execution of the program so the value never change. Cornel

----- Original Message ----
From: Philipp Burch <address@hidden>
To: address@hidden
Sent: Tuesday, January 15, 2008 8:24:17 PM
Subject: Re: [avr-gcc-list] altering array variable and interrupts

Hi,

I guess, your ISR takes too long. Delayloops in ISRs are very, very bad
style, because they block the whole CPU. I suppose, the Interrupt comes
more often than every 3ms, so there is no way for the AVR to execute any
code outside the ISR. You should rewrite the complete program, there are
many unnecessary things, such as character generation at runtime. Just
declare a PROGMEM array with all your digits and read from it with
pgm_read_byte() (From avr/pgmspace.h, check the manual of avr-libc),
that saves RAM and initialization work. And it prevents the characters
from getting modified (Or do you really need this "feature"?).

Philipp
> sorry I forgot to put url: http://rafb.net/p/fxrljj42.html
> >





reply via email to

[Prev in Thread] Current Thread [Next in Thread]