Forum Discussion

jey1's avatar
jey1
Icon for New Contributor rankNew Contributor
4 years ago

DE10-Standard Computer System with ARM* Cortex* A9

Hi,

I need to read the voltage readings of channels 0 and 1 in the DE10 Standard of ADC 0xFF204000 With C code and then translate this reading into the LED bank (0xFF200000), corresponding to GPIO pins 0-9 (0xFF200060).

How Can I do this? I am a student working on a project. Any assistance much appreciated.

Thanks

Shan

4 Replies

  • jey1's avatar
    jey1
    Icon for New Contributor rankNew Contributor

    So far, I got this..

    #define ADDR_JP1PORT ((volatile char *) 0xFF200060)
    #define ADDR_LED ((volatile char *) 0xFF200000)
    #define ADDR_ADC ((volatile char *) 0xFF204000)

    int main()
    {
    // init interface directions

    int data=0;
    int channel_1=0;
    //int channel_2=0;


    *(ADDR_JP1PORT+4) = 0xFFFFFC00; //set JP1 bit dir to input


    *(ADDR_ADC) = 0; // ADC to read
    //*(ADDR_ADC+4) =1;
    while (1)
    {
    data= *(ADDR_ADC+channel_1);
    data=data/12;
    *(ADDR_LED) = data;
    }
    }

    • jey1's avatar
      jey1
      Icon for New Contributor rankNew Contributor

      I got something and not confident that as supposed to be. Any assistance is very helpful.

      #define ADDR_JP1PORT ((volatile int *) 0xFF200060)

      #define ADDR_LED ((volatile int *) 0xFF200000)

      #define ADDR_ADC ((volatile int *) 0xFF204000)

      int main()

      {

      // init interface directions

      int data=0;

      int channel_1=0;

      //int channel_2=0;

      *(ADDR_JP1PORT+4) = 0xFFFFFC00; //set JP1 bit dir to input

      *(ADDR_ADC) = 0; // ADC to read

      //*(ADDR_ADC+4) =1;

      while (1)

      {

      *(ADDR_JP1PORT)=*(ADDR_ADC);

      data= *(ADDR_ADC+channel_1);

      printf("Data:=%d\n",data);

      data=data/16;

      printf("Data1:=%d\n",data);

      *(ADDR_LED) = data;

      }

      }

    • AminT_Intel's avatar
      AminT_Intel
      Icon for Regular Contributor rankRegular Contributor

      We do not receive any response from you to the previous question/reply/answer that I have provided. This thread will be transitioned to community support. If you have a new question, feel free to open a new thread to get the support from Intel experts. Otherwise, the community users will continue to help you on this thread. Thank you.