program adtest
'
'* Project name:
' adc on lcd
'* Author:
' MikroElektronika, September 2006.
'* Description:
' This program demonstrates how to use ADC library.
'* Test configuration:
' MCU: ATmega128
' Dev.Board: Big AVR
' Oscillator: External, 10 MHz
' Ext. Modules:
' SW: mikroBasic for AVR 4.02
' * NOTES:
' connect potentiometer to MCU
'
Code: Select all
dim dataA,dataB as word
textA,textB as string[7]
main:
Lcd_Init(PORTC, 3, 2, PORTC, LCD_HI_NIBBLE)
Lcd_Cmd(LCD_CURSOR_OFF)
Lcd_Out(1,1,"Analog Voltage:")
while true
' adc input PORTF.1
dataA=Adc_Read(1)
dataB=Adc_Read(0)
WordToStr(dataA, textA)
WordToStr(dataB, textB)
Lcd_Out(2,5, textA)
Lcd_Out(2,15, textB)
Delay_ms(10)
wend
end.
but the both Values have the same content, it makes no different if i choose ADCchannel 0 or ADCCannel1 and so on. The result is always the same Value. If i change the code dataA=Adc_Read(1) with dataB=Adc_Read(0) like this:
Code: Select all
dim dataA,dataB as word
textA,textB as string[7]
main:
Lcd_Init(PORTC, 3, 2, PORTC, LCD_HI_NIBBLE)
Lcd_Cmd(LCD_CURSOR_OFF)
Lcd_Out(1,1,"Analog Voltage:")
while true
' adc input PORTF.1
dataB=Adc_Read(0) <---------
dataA=Adc_Read(1) <---------
WordToStr(dataA, textA)
WordToStr(dataB, textB)
Lcd_Out(2,5, textA)
Lcd_Out(2,15, textB)
Delay_ms(10)
wend
end.
What did i wrong, please help me i am a beginner in Mikrobasic
thanks for your support !