Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: No result for ADC in burst mode

2006-02-02 by Guillermo Prandi

> since result[] only has a value put into it and it is
> otherwise unused, it was optimized out (dead code).

You can try using the "volatile" modifier to the variable. That 
forces the compiler to modify it even when it doesn't see the 
point. :)

Guille

--- In lpc2000@yahoogroups.com, Tom Walsh <tom@...> wrote:
>
> scrappystuff64 wrote:
> 
> >I have this code for the ADC in burst mode. The ISR is called 
> >continually, but I don't see a value for the result. Gurus 
enlighten 
> >me, what am I doing wrong?
> >
> >
> >#include <lpc21xx.h>
> >
> >void AD_ISR (void) __irq
> >{
> >  unsigned val,chan;
> >  static unsigned result[8];
> >  val = ADDR;
> >  chan = ((val >>0x18) & 0x07);
> >  val =  (val >> 6) & 0x03FF; //Extract the A/D result
> >  result[chan] = val;
> >  VICVectAddr = 0; //clear the IRQ function address
> >}								
> >							
> >	                 
> >  
> >
> Try dumping your code (arm-elf-objdump) or look at the listings 
file 
> (.lst). I think that you will find that the compiler has decided 
that 
> since result[] only has a value put into it and it is otherwise 
unused, 
> it was optimized out (dead code).
> 
> TomW
> 
> - 
> Tom Walsh - WN3L - Embedded Systems Consultant
> http://openhardware.net, http://cyberiansoftware.com
> "Windows? No thanks, I have work to do..."
> ----------------------------------------------------
>

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.