ADC Configuration Issue

General discussion on mikroBasic for AVR.
Post Reply
Author
Message
joprinz
Posts: 8
Joined: 04 Apr 2008 14:25

ADC Configuration Issue

#1 Post by joprinz » 21 Apr 2008 15:50

According to the help the only code requirement for getting the ADC output is:

Code: Select all

 program TESTADC
dim data as word
       text as string[7]
main:
Glcd_Set_Font(font5x8, 5, 8, 32)
Glcd_Init(PORTC, 0, 1, 2, 3, 5, 4, PORTD)
   while true
    data=Adc_Read(0)
    WordToStr(data, text)
    Delay_ms(10)
    Glcd_Write_Text(text,0,0,1 )
  wend
end.
however I'm getting no output using this code. I tried the same in BASCOM n it seems to work well... I noticed in BASCOM the folowing CONFIG statements are required before getting the ADC Value

Code: Select all

Config Adc = Single , Prescaler = Auto , Reference = Avcc   'config ADC

Start Adc
But in MikroBasic theres no such CONFIG option as per the help file. I was wondering if theres any such Config requirements before calling ADC_READ() ? I would also like to know if the AVCC and ARef needs to be connected to VCC (+5V)?


My Setup:

ATMEGA32
Mikrobasic for AVR
GLCD for Display

Please Advice,

Thank You!

Post Reply

Return to “mikroBasic for AVR General”