I thought this (declaring a variable as volatile) applies only when we are using the variable in C, i.e. when the compiler needs to know that variable will be modified by hardware/ISR.
However in this case the variable is modified only in assembler and the function used to retrieve the value (GetCounter) is also written in assembler. Does it really make a difference in this case if the variable is declared as volatile or not? Thanks, Omar On Tue, Jan 3, 2012 at 9:48 PM, Volker Kuhlmann <list0...@paradise.net.nz> wrote: > On Wed 04 Jan 2012 01:50:46 NZDT +1300, Omar Choudary wrote: > > Whenever you declare a variable in C/C++ that is being modified by > something other than your program, e.g. ISR or hardware, you have to > declare that variable volatile. Failure to do so means your program may > only work intermittently. > > You are missing the volatile declaration for your counter variable. > > Volker > > -- > Volker Kuhlmann > http://volker.dnsalias.net/ Please do not CC list postings to me. > > _______________________________________________ > AVR-GCC-list mailing list > AVR-GCC-list@nongnu.org > https://lists.nongnu.org/mailman/listinfo/avr-gcc-list _______________________________________________ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org https://lists.nongnu.org/mailman/listinfo/avr-gcc-list