Here simple Bascom AVR code to use internal ADC in AVR ATMEGA8535 using Basic Compiller AVR
In this project use PORTA.0 as ADC(0) with display LCD 16x2.
Copy paste this code in BASCOM AVR
$regfile = "m8535.dat"
$crystal = 12000000
'$sim
Dim Volt As Long
Config Adc = Single , Prescaler = Auto , Reference = Internal
Cursor Off
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Portb.7 , Db6 = Portb.6 , Db5 = Portb.5 , Db4 = Portb.4 , E = Portb.3 , Rs = Portb.2
Do
Start Adc
Volt = Getadc(0)
Waitus 200
Stop Adc
Cls
Locate 1 , 1
Lcd " TEST ADC"
Lowerline 'Lowerline LCD
Lcd Volt
Waitms 100
Loop
Wednesday, May 18, 2011
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment