• Skip to primary navigation
  • Skip to main content
FDI: Future Designs, Inc.

FDI

Future Designs, Inc.

  • Products
    • μEZ GUI
    • ELI
    • ΣyG
    • Modular Development Kits – DK
    • Other Products
    • End of Life
    • All Products (By part number)
  • Engineering Design
  • Production
  • Support
    • Forums
  • About FDI
    • News
    • Management
    • Partners
    • Distributors
    • Practices
    • Careers
    • New Customer Referral
  • Contact Us
  • Show Search
Hide Search

ADC value always 0?

Homepage › Forums › μEZ › Software › ADC value always 0?

  • This topic has 0 replies, 1 voice, and was last updated 3 months ago by Logan Moon.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • February 6, 2025 at 9:33 pm #16772
    Logan Moon
    Keymaster

      (This message was transferred over from our old forum)
      Posted August 19, 2015
      By Todd DeBoer
      [hr]
      On 05/21/2010 aschoonen asked, “I’m trying to read a value with the ADC using uEZ 1.04, but the UEZADCRequestSingle() always gives me 0.

      The code I have is:

      Code:

      #include “uEZADC.h”

      static T_uezDevice adc;
      static ADC_RequestSingle adcRequest;
      static TUInt32 adcValue;

      void main()
      {
      UEZADCOpen(“ADC0″, &adc);

      adcRequest.iADCChannel = 5;
      adcRequest.iBitSampleSize = 10;
      adcRequest.iTrigger = ADC_TRIGGER_NOW;
      adcRequest.iCapturedData = &adcValue;

      while(1)
      {
      UEZADCRequestSingle(adc, &adcRequest); // ADC value is stored in adcValue

      // some code to output adcValue to screen
      }

      UEZADCClose(adc);
      }
      (To be honest: the code I have is much more, but the settings of the ADC in code above are the same.)

      This is running on the ARM7 touch screen development kit with a 10K potentiometer attached to GPIO99_AD0.5 and to 3.3V and ground.

      Does anyone have any clue why adcValue is always 0?”
      [hr]
      (Follow up post)

      Answered:

      My first guess would be that the pin for channel 5 is not configured for A/D (UEZADCOpen does not configure pins). If you are using one of the DK-TS-KITs, check file Platform/FDI/ARM_CARRIER/LPC2478_pinConfig.h and change Code:

      /* —– Pin P1[31] —– */
      #define PINCFG_P1_31 0 // GPIO Port 1.31
      //#define PINCFG_P1_31 1 // USB_OVRCR2n
      //#define PINCFG_P1_31 2 // SCK1
      //#define PINCFG_P1_31 3 // AD0[5]
      #define PINSET_P1_31 0
      #define PINCLR_P1_31 0
      #define PINDIR_P1_31 0 // Input
      #define PINMODE_P1_31 3 // Pull Down into Code:

      /* —– Pin P1[31] —– */
      //#define PINCFG_P1_31 0 // GPIO Port 1.31
      //#define PINCFG_P1_31 1 // USB_OVRCR2n
      //#define PINCFG_P1_31 2 // SCK1
      #define PINCFG_P1_31 3 // AD0[5]
      #define PINSET_P1_31 0
      #define PINCLR_P1_31 0
      #define PINDIR_P1_31 0 // Input
      #define PINMODE_P1_31 3 // Pull Down if you have not already done so.

    • Author
      Posts
    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.
    Log In

    Partners

    NXP
    Renesas

    ARM
    SEGGER

    STMicroelectronics
    SAFERTOS

    FreeRTOS

    Copyright © 2025 Future Designs, Inc. | μEZ GUI | ELI | Engineering Design | Production | Privacy Policy | Log in