Go to Post They have obviously figuered out something special. I want to learn from them. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-02-2008, 18:36
govvijay govvijay is offline
Registered User
FRC #0540
 
Join Date: Jan 2008
Location: VA
Posts: 5
govvijay is an unknown quantity at this point
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.
  #2   Spotlight this post!  
Unread 13-02-2008, 18:45
psy_wombats's Avatar
psy_wombats psy_wombats is offline
Registered User
AKA: A. King
FRC #0467 (Duct Tape Bandits)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Shrewsbury MA
Posts: 95
psy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura aboutpsy_wombats has a spectacular aura about
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.
  #3   Spotlight this post!  
Unread 13-02-2008, 21:21
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Printing Analog Input with Kevin's new code

Quote:
Originally Posted by psy_wombats View Post
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
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Kevin's 2008 code jc4p Programming 4 06-02-2008 17:48
Errors compiling Kevin's new code (pragmas) Bryan Herbst Programming 11 31-01-2008 12:50
Problem with Kevin's code Tottanka Programming 5 04-11-2007 13:32
Problems with Kevin's 2007 default code bruss6 Programming 8 19-01-2007 15:42
What are with the Ls in Kevin's code??!!! HELP!!! RbtGal1351 Programming 2 18-02-2005 16:57


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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