Need Advice
Posted: 17 Jun 2007 10:03
I'm using PIC16F73 for the below program and I'm trying to measure small voltages. The program shows the correct voltage but often it fluctuates.. For eg when measured in the ADC input the Voltage is 0.037 but at the same time the text I get on the LCD is 00025 , 000022 , 00019 etc. The question is why it does not hold the value. But the multimeter shows the correct constant voltage. Is there any calculation to give the right output??
program AdcOnLcd2
dim CurrentValue as float
dim Text as char[10]
dim rrrr as word
main:
INTCON = 0
OPTION_REG = $80
ADCON1 = $82
TRISA = $FF
Lcd_Init(PORTB)
Lcd_Cmd( LCD_CURSOR_OFF)
Lcd_Cmd(LCD_CLEAR)
while true
CurrentValue = ADC_read(2)
CurrentValue = CurrentValue*(5000.0 div 255.0)
rrrr=CurrentValue
WordToStrWithZeros(rrrr, Text)
Lcd_Out(2, 8, text)
delay_ms(1000)
wend
end.