PDA

View Full Version : Adcon



Martin....
- 19th January 2007, 16:41
Hi

I want to use the command ADCIN but my pro compiler brings errors with ADCON. Can Anybody tell me whats wrong
Itīs an Error in the pbppic14.lib. mostly the error is "undefinded Symbol"
can anybody help me

Martin

mat janssen
- 19th January 2007, 16:44
Show us your code please !

Martin....
- 19th January 2007, 17:13
DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 2
DEFINE ADC_SAMPLEUS 100

PORTA = 5
TRISA = $85
PORTB = 6
TRISB = $86

POKE TRISA, %11111111
POKE TRISB, %00000000

W0 var byte

ADCON1 = 2 'This line is not working !!!!!!!!!
ADCIN 0, W0 'This line is not working, too

Martin

HenrikOlsson
- 19th January 2007, 17:41
Hi,
First you set TRISA to $85 and then overwrite with 255 using the POKE command, same goes for TRISB, seems strange to me but is probably not related to your problem.

You didn't say what PIC you are using??

BTW, even though they still work it is recomended to not use the PEEK/POKE commands.

/Henrik Olsson.

Martin....
- 19th January 2007, 19:35
Iīm using the pic16f627a. The problem is that the compiler does not racognize the command ADCON. There must be something to include or to register.

martin

BigWumpus
- 19th January 2007, 19:45
The PIC16F627A has no ADC, it has no ADCON1-register and ADCON is no command.

Martin....
- 19th January 2007, 20:23
ah ok....is there anotherway to meassure voltage ??

thanks martin

mat janssen
- 20th January 2007, 08:30
To use a 16F819 or a 16F873(6)(a).
Or if you want to do something under or above an sertain input voltage then you can use the 16F627a with its internal comperators.