View previous topic :: View next topic |
Author |
Message |
mmdcet
Joined: 07 Jan 2013 Posts: 2
|
want to know where the read_adc() function is defined in ccs |
Posted: Fri Apr 12, 2013 11:07 am |
|
|
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
|
|
Posted: Fri Apr 12, 2013 11:17 am |
|
|
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
|
|
Posted: Fri Apr 12, 2013 12:31 pm |
|
|
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
|
|
Posted: Fri Apr 12, 2013 3:01 pm |
|
|
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 |
|
|
|