Professional Documents
Culture Documents
Adc
Adc
: 6/7/2011
Author
: yogi
Company : CERC
Comments:
Chip type
: ATmega8535
Program type
: Application
Clock frequency
: 4.000000 MHz
Memory model
: Small
: 0
: 128
*****************************************************/
#include <mega8535.h>
#include <delay.h>
#include <stdio.h>
#include <stdlib.h>
dat%=1000;
data = dat / 100;
data+=0x30;
lcd_putchar(data);
dat%=100;
data = dat / 10;
data+=0x30;
lcd_putchar(data);
dat%=10;
data = dat + 0x30;
lcd_putchar(data);
}
// Declare your global variables here
void main(void)
{
// Declare your local variables here
PORTA=0x00;
DDRA=0x00;
PORTB=0x00;
DDRB=0x00;
PORTC=0x00;
DDRC=0x00;
PORTD=0x00;
DDRD=0x00;
// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: AVCC pin
// ADC High Speed Mode: Off
// ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x82;
SFIOR&=0xEF;
while (1)
{
// Place your code here
dataADC=read_adc(0);
(no1)
lcd_gotoxy(0,0);
(no3)
lcd_gotoxy(0,1);
tampil(dataADC);
lcd_gotoxy(7,1);
tampil(Temp);
};
Temp=(dataADC*4.9/10);
no7
(no7)
(x,y) =
(no8)
(no9)