Ttelmah
Joined: 11 Mar 2010 Posts: 19536
|
|
Posted: Thu Dec 23, 2010 3:21 am |
|
|
Several things:
1) Why not use the CCS ADC setup functions. For 99.9% of code, there is no reason at all, to ever get involved in talking directly to registers.
2) If asking a question about an error like this, _always_ post the compiler version.
3) Have you tried compiling what you posted, with just a minimum 'header', so something like:
Code: |
#include <16F689.h>
#fuses HS
#use delay(clock=8000000)
#separate
void port_init (void) {
OUTPUT_A(0x00);
//ANSEL=0x0C;
//ANSELH=0x07;
SET_TRIS_A(0x1F);
OUTPUT_B(0x00);
SET_TRIS_B(0x30);
OUTPUT_C(0x00);
SET_TRIS_C(0xC0);
port_a_pullups(FALSE);
//WPUB=0x00;
//CM1C0N0=0x00;
//CM2CON0=0x00;
}
void main(void) {
setup_spi(FALSE);
port_init();
while(true) ;
}
|
Does it still give a problem?.
4) It is 'common' in CCS, for the actual location where a problem is reported, to have almost no relevance to the actual problem. The compiler carries on steaming through code, till an earlier problem suddenly makes something not work, and reports the problem here, rather than several lines earlier, where the actual error is. I suspect your fault is like this....
Best Wishes |
|