Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Printing Analog Input with Kevin's new code (http://www.chiefdelphi.com/forums/showthread.php?t=63994)

govvijay 13-02-2008 18:36

Printing Analog Input with Kevin's new code
 
We are trying to print analog values from our autonomous switch, but we are only getting 0 values. I was just wondering how do you print analog inputs using Kevin's new code.

Thanks,
Vijay G.

psy_wombats 13-02-2008 18:45

Re: Printing Analog Input with Kevin's new code
 
It should be normal, something like:

Code:

        for (k = 1; k <= NUM_ADC_CHANNELS; k++) {
            printf("ADC %d: %d\r\n", k, Get_ADC_Result(k));
        }

If you want to get fancy. Make sure the number of ADC channels is set correctly in adc.h. This looks more like an electrical problem though. You may want to check with an oscilloscope that you are actually getting values from the ADC.

Kevin Watson 13-02-2008 21:21

Re: Printing Analog Input with Kevin's new code
 
Quote:

Originally Posted by psy_wombats (Post 698304)
It should be normal, something like:

Code:

        for (k = 1; k <= NUM_ADC_CHANNELS; k++) {
            printf("ADC %d: %d\r\n", k, Get_ADC_Result(k));
        }

If you want to get fancy. Make sure the number of ADC channels is set correctly in adc.h. This looks more like an electrical problem though. You may want to check with an oscilloscope that you are actually getting values from the ADC.

Get_ADC_Result() returns an unsigned int, so you'll want to use %u in your printf() format string instead of %d.

-Kevin


All times are GMT -5. The time now is 00:56.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi