
Originally Posted by
lerameur
yes actually, i went and read that , its like a diode, loosing 0.7 volt, so you need a bit more to compensate..
i have been working on the a/d conversion, again this is my first time, I am reading section 12 of he pic16f88 datasheet.
i wrote this program , bit it do not display the right inotmation:
'RECEIVE PIC
INCLUDE "modedefs.bas"
DEFINE OSC 20 'use external 20mhz crystal
CMCON = 7
ANSEL = %00001100 'Put port 2 and 3 analog and otehr digital
ADCON1 = %11000001 ' Set PORTA analog and RIGHT justify result
ADCON0 = %00010001 ' Configure and turn on A/D Module
DEFINE LCD_DREG PORTB ' Set LCD Data port
DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 1 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 0 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2500
DEFINE LCD_DATAUS 250
DEFINE CHAR_PACING 2000
pause 1000
' Define ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
input1 var word : input2 var word
TRISA = %11111111 ' Set PORTA to all input
Pause 500
loop: ADCIN portA.2, input1
ADCIN portA.3, input2
Lcdout $fe, 1 ' Clear LCD
Lcdout "Value1: ", DEC input1 ' Display the decimal value
lcdout $FE,$C0, "Value2: ", dec input2
Pause 200
Goto loop
End
Bookmarks