Hi guys,

i've made a simple circuit to measure the ad value from 2 channel of my 16F88 pic out to a LCD.

The strange thing is that porta.1 's values are conditioned by the results in porta.0 !

For example... this is what i get on my LCD...


Porta.1 = 5.00v lcd = 5.0
porta.0 = 5.00v lcd = 5.0

Porta.1 = 0.17v lcd = 0.17
Porta.0 = 5.00v lcd = 4.17

porta.1 = 2.54v lcd = 2.54
porta.0 = 5.00v lcd = 4.54

porta.1 = 5.00v lcd = 5.00
porta.0 = 4.58v lcd = 5.00

Here's the code:

output portb.7
low portb.7

Define osc 4

' Define LCD pins
Define LCD_DREG PORTB
Define LCD_DBIT 0
Define LCD_RSREG PORTB
Define LCD_RSBIT 4
Define LCD_EREG PORTB
Define LCD_EBIT 5
Define LCD_BITS 4

'variables
va1 var word
va2 var word
temp var word
volt var word

pause 200 'init LCD
lcdout $fe,1 'clear LCD

'Define ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result ( 8 or 10 bits )
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS

input porta.0
input porta.1

ADCON1 = %10000011 ' set porta analog and right justify result

loop:

ADCIN 0, va1
ADCIN 1, va2

temp = (va1 */ 500 ) >> 2
volt = (va2 */500) >>2

high portb.7

lcdout $fe,2,"VOLTAGE..",dec (volt/100),",",dec2 volt,"V"
lcdout $fe,$c0,"TEMP.....",dec (temp/100),",",dec2 volt,"V"

pause 250

Goto loop

End

Thanks