Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1198 Discussions

Using the DE-Series ADC Controller

Letangly
Beginner
760 Views

When the following c-code is loaded, the leds will light up but not respond to the attached pot.

The leds hold their initial value, and this initial value changes on different load attempts (I'm not sure what changes I've made to make this happen). 

De0 Nano
Platform Designer Modules:
    Nios ii, econ-mode
    on-chip memory
    ADC   
    Leds   
   JTAG

=========================================================

#define ADC_ADDR 0x00011000 //Qsys defined base address for the ADC
#define LED_ADDR 0x00011020 //Qsys defined base address for the LEDs

int main (void)
{

volatile int * adc = (int*)(ADC_ADDR);
volatile int * led = (int*)(LED_ADDR);

unsigned int data;
int channel;

data = 0;
channel = 0;

while(1)
{
*(adc) = 0; //Start the ADC read
data = *(adc+channel); //Get the value of the selected channel
data = data/16; //Ignore the lowest 4 bits
*(led) = data; //Display the value on the LEDs
usleep(100000);


//*(led) = 0x00;
//usleep(100000);
//*(led) = 0xFE;
//usleep(100000);


}
return 0;
}

========================================================

Any help is greatly appreciated

0 Kudos
1 Solution
EricMunYew_C_Intel
Moderator
708 Views

Hi, Joseph


I think your ADC is not reading a new data.

You may need to check your reference design.


Can we close it if you have no more inquiry ?


Eric




View solution in original post

0 Kudos
2 Replies
EricMunYew_C_Intel
Moderator
718 Views

Hi, Joseph


May I know which document you are referring to ?


Eric


0 Kudos
EricMunYew_C_Intel
Moderator
709 Views

Hi, Joseph


I think your ADC is not reading a new data.

You may need to check your reference design.


Can we close it if you have no more inquiry ?


Eric




0 Kudos
Reply