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

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

[avr-gcc-list] struct vs. global


From: Marlin Unruh
Subject: [avr-gcc-list] struct vs. global
Date: Tue, 27 Mar 2001 17:22:32 -0700

Hi,

I was experiencing a problem with my program. I was using global registers
and the program was hitting the rhubarb. For testing purposes I had an LED
that is flashing at 1Hz. The time delay is interrupt driven. I noted that
the LED would stay on longer than normal, or would flash very fast. Very
erratic behavior. The code would hang, but no always consistent. I am not
using an emulator, so I really don't know what was happening, other than
'global registers crossing boundaries'. I then changed the variables
involved in the time delay, and timer flags, from 'global' to 'struct' now
the code is running perfect. Why is it that structures are preferred over
global variables? From what I saw it is unstable to use global's. Right?
Wrong? Why?

Marlin




reply via email to

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