CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

want to know where the read_adc() function is defined in ccs

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mmdcet



Joined: 07 Jan 2013
Posts: 2

View user's profile Send private message

want to know where the read_adc() function is defined in ccs
PostPosted: Fri Apr 12, 2013 11:07 am     Reply with quote

I have a program for adc. The code is as follows:
Code:

#include<16f877a.h>
#fuses HS,NOLVP,NOWDT,PUT
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7)

void main() {
   int i, value, min, max;
   
   printf("Sampling:");
   
   setup_adc_ports( RA0_ANALOG );
   setup_adc( ADC_CLOCK_INTERNAL );
   set_adc_channel( 0 );
   
   do {                       
      min = 255;             
      max = 0;               
      for(i = 0; i <= 30; ++i) {
         delay_ms(100);
         value = read_adc();
         if(value < min)
            min = value;
         if(value > max)
            max = value;
      }
      printf("nrMin:%x MAX: %x", min, max);
   } while (TRUE);
}


I couldn't find where the function read_adc() is defined.
Can anybody help me in knowing this ?
_________________
£aBiVa
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Apr 12, 2013 11:17 am     Reply with quote

How about in the USER manual??

Right where it last was printed.

Also in the online help if you use the CCS IDE.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 12, 2013 12:31 pm     Reply with quote

If you're looking for the source code for read_adc(), it is not included
with the compiler. It's a built-in compiler function.

You can look at the .LST file and see the .ASM code. Set the .LST file
format to Symbolic, in the Project options. Then it's easier to read,
because PIC register names will be used.
Ttelmah



Joined: 11 Mar 2010
Posts: 19498

View user's profile Send private message

PostPosted: Fri Apr 12, 2013 3:01 pm     Reply with quote

It is also important to understand that there isn't a single 'function' as such.

There are different versions according to the hardware. About four different ADC's in the different chips. Then different code according to the settings (ADC=8, ADC=10, ADC=16 etc..). Then different code according to how it is called (read_adc(ADC_START_ONLY) for example only sets the go/done bit).

The compiler chooses from perhaps a total of about fifty different 'functions' for what it generates with the command.....

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group