Hi,
I didn't see the " CMCON = 7 " ... Default value ... yes, but, just to be sure of .
Also, did you try to tie RA.0 to ground or to RA1 ... it makes a superb noise input, as left floating !
Note unused portA pins should be tied to ground through 10 k resistors ...
- or use RA.0 as input !!! and other RA pins as outputs, if unused.
Alain
Last edited by Acetronics2; - 21st December 2008 at 10:19.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Try this setting . . .
. . . If I read it right . . .Code:ADCON1 = %00001101 ' VREF off A.0 & A.1 as analog ADCON2.7 = 1 ' Right justified ADCON0.2 = 1 ' Channel 1 enabled ADCON0.1 = 1 ' A/D conversion in process ADCON0.0 = 1 ' A/D Module Enabled
Edit: you posted while I was working on mine . . .
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
I tried:
ADCON0 = %00000011
as I am using AN0 pin for input now, no change.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi, JavPar
Could you Post your HEX code ???
Purpose is to verify the config real settings ....
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Test results:
1.) Didn't see any change when changed to 8 bits, so I'm back to using 10 bits.
2.) I edited my code so only RA0 is being used for input analog.
3.) When connect ADCIN pin to any GND on the project, I get steady 0V readings. When connect pin to 5V I get erratic 5V readings BUT, noticed that when connect pin to 5V before my on/off switch, then I get 5V steady. Noticed also that when connected to 5V before on/off switch, this makes the PIC kind of work because my green LED connected to PORTD.2 starts to blinks like if my project is running but LCD stays off. Nothing happends when connect ADCIN pin to 5V after on/off switch. Removed the on/off switch, 5V voltage readings are erratic anywhere in the project.
4.) Erratic readings are less npticeable when in 5V ranging from 1020 to 1023. When connect an angular sensor for example I get ranges from 480s to 540s aproximately. Other things I have connect ot ADCIN pin are a 1.5V battery and a 3V wall ac/dc adapter. I get erratic readings from both also.
DEFINE LOADER_USED 1 'Bootloader Used
@ __CONFIG _CONFIG1H, _OSC_HS_1H
DEFINE OSC 8
Define ADC_BITS 10
Define ADC_CLOCK 3
Define ADC_SAMPLEUS 50
adval var word
TRISA = %00000001
ADCON0 = %00000001
ADCON1 = %00001110
'ADCON2.7 = 1
ADCON2 = %10001011
CVRCON.4 = 0
'CMCON = 7
Pause 1000
Serout2 PORTD.0,16468,[$1b, $2a, $ff]
loop:
HIGH PORTD.2
ADCIN 0, adval
pause 50
Serout2 PORTB.7,16468,[dec adval] ' to PC
Serout2 PORTD.0,16468,[$fe, 1]
Serout2 PORTD.0,16468,[dec adval] ' to LCD
LOW PORTD.2
pause 50
Goto loop
End
Bookmarks