Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] AD problem

2005-12-22 by Richard Duits

The line:
VICVectAddr0 = 0;
in IRQ_ADC should be
VICVectAddr = 0;


Richard.


zhengy_yong wrote:

> the problem is i can only enter the interrupt
> funciton once,then never enter the function again.
> are there any problems with my program?
> anyone can give me a suggestion?
>
>
> #include "config.h"
> unsigned int  result[20];
> unsigned char channelx[20];
>
> void __irq IRQ_ADC(void)
> {
>    unsigned int  value   = 0x0000;       //result of the ADC converter
>    unsigned char channel = 0x00;         //the channel
>    unsigned char i             = 0;     
>    value        = ADDR;  //read the result and clear the DONE sign
>    channel      = (value>>0x18)&0x07; //get the channel
>    value        = (value>>6)&0x03ff;  //convert the ADC result
>    if(channel == 0x00)                //switch the channel
>              ADCR = ADCR&0xFFFFFF00|0x02;  
>     else if(channel == 0x01)
>              ADCR = ADCR&0xFFFFFF00|0x04;
>     else if(channel == 0x02)
>             ADCR = ADCR&0xFFFFFF00|0x08;
>     else if(channel == 0x03)
>             ADCR = ADCR&0xFFFFFF00|0x01;
>     channelx[i]  = channel;
>       result[i]    = value;
>       i++;     
>       if(i<20)             //whether get 20 result ?
>             i++;
>       else
>             i = 0;
>       VICVectAddr0 = 0;    //clear the IRQ function address
> }
>
> int main(void)
> {
>     PINSEL1       = 0x01400000;//connect the pin to adc
>     ADCR          = 0x00201501;//setup the ADCR only use the ain0
>     ADCR            = ADCR|0x00010000;//use burst model
>     VICIntSelect = 0x00000000;      //
>     VICVectCntl0 = 0x32;
>     VICVectAddr0 = (int)IRQ_ADC;    //address of the IRQ function
>     VICIntEnable = 0x00040000;      //enamble the ADC interrupt
>     while(1)
>     {
>       ;                           //wait for the interrupt
>      }
>       return(0);
> }
>
>
>
>
>
> SPONSORED LINKS
> Microprocessor 
> <http://groups.yahoo.com/gads?t=ms&k=Microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=tsVC-J9hJ5qyXg0WPR0l6g> 
> 	Microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=DvJVNqC_pqRTm8Xq01nxwg> 
> 	Pic microcontrollers 
> <http://groups.yahoo.com/gads?t=ms&k=Pic+microcontrollers&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=TpkoX4KofDJ7c6LyBvUqVQ> 
>
> 8051 microprocessor 
> <http://groups.yahoo.com/gads?t=ms&k=8051+microprocessor&w1=Microprocessor&w2=Microcontrollers&w3=Pic+microcontrollers&w4=8051+microprocessor&c=4&s=93&.sig=1Ipf1Fjfbd_HVIlekkDP-A> 
>
>
>
> ------------------------------------------------------------------------
> YAHOO! GROUPS LINKS
>
>     *  Visit your group "lpc2000
>       <http://groups.yahoo.com/group/lpc2000>" on the web.
>        
>     *  To unsubscribe from this group, send an email to:
>        lpc2000-unsubscribe@yahoogroups.com
>       <mailto:lpc2000-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>        
>     *  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>       Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------------------------------------------------
>

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.