1. Program Alat Pada Mikrokontroler dengan Code Vision AVR
This program was produced by the CodeWizardAVR V1.25.9 Standard
Automatic Program Generator © Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l.
pranala:http:www.hpinfotech.com
Project :
Version :
Date : 10202016
Chip type : Atmega8535
Program type : Application AVR Core Clock frequency : 16.000000 MHz
Memory model : Small
External RAM size : 0 Data stack size
: 128
include mega8535.h include stdlib.h
include delay.h
Declare your global variables here
void mainvoid {
PORTA initialization Func7 = InFunc6 = InFunc5 =
InFunc0 = In State7 = TState6 = T
State0 = T
Universitas Sumatera Utara
PORTD=0x00; DDRD=0xFF;
Timecounter 1Initialization Clock Source : System Clock
Clock Value : 10800 Khz Mode : Fast PWM Top = 00FFh
OC1A output : Non-Inv OC1B output : Non-Inv
Noise canceler : Off Input Capture on Falling edge
Timer1 overflow interruption : Off TCCR1A = 0xA1
TCCR1A = 0xA1
define heater1 PORTC.6 define heater2 PORTC.7
Alphanumeric LCD Module functions asm
.equ __lcd_port=0x15 ;PORTC endasm
include alcd.h
Standard InputOutput functions include stdio.h
include delay.h
define ADC_VREF_TYPE 0x40
Read the AD conversion result unsigned int read_adcunsigned char adc_input
{
Universitas Sumatera Utara
ADMUX=adc_input | ADC_VREF_TYPE 0xff; Delay needed for the stabilization of the ADC input voltage
delay_us10; Start the AD conversion
ADCSRA|=0x40; Wait for the AD conversion to complete
while ADCSRA 0x10==0; ADCSRA|=0x10;
return ADCW; }
Declare your global variables here
void mainvoid {
PORTA=0x00; DDRA=0x00;
PORTB=0x00; DDRB=0x00;
PORTC=0x00; DDRC=0x00;
PORTD=0x00; DDRD=0x00;
TimerCounter 0 initialization Clock source: System Clock
Clock value: Timer 0 Stopped Mode: Normal top=FFh
OC0 output: Disconnected TCCR0=0x00;
TCNT0=0x00; OCR0=0x00;
Universitas Sumatera Utara
TimerCounter 1 initialization Clock source: System Clock
Clock value: Timer 1 Stopped Mode: Normal top=FFFFh
OC1A output: Discon. OC1B output: Discon.
Noise Canceler: Off Input Capture on Falling Edge
Timer 1 Overflow Interrupt: Off Input Capture Interrupt: Off
Compare A Match Interrupt: Off Compare B Match Interrupt: Off
TCCR1A=0x00; TCCR1B=0x00;
TCNT1H=0x00; TCNT1L=0x00;
ICR1H=0x00; ICR1L=0x00;
OCR1AH=0x00; OCR1AL=0x00;
OCR1BH=0x00; OCR1BL=0x00;
TimerCounter 2 initialization Clock source: System Clock
Clock value: Timer 2 Stopped Mode: Normal top=FFh
OC2 output: Disconnected ASSR=0x00;
TCCR2=0x00; TCNT2=0x00;
Universitas Sumatera Utara
OCR2=0x00; External Interrupts initialization
INT0: Off INT1: Off
INT2: Off MCUCR=0x00;
MCUCSR=0x00; TimersCounters Interrupts initialization
TIMSK=0x00; USART initialization
Communication Parameters: 8 Data, 1 Stop, No Parity USART Receiver: On
USART Transmitter: On USART Mode: Asynchronous
USART Baud Rate: 9600 UCSRA=0x00;
UCSRB=0x18; UCSRC=0x86;
UBRRH=0x00; UBRRL=0x4D;
Analog Comparator initialization Analog Comparator: Off
Analog Comparator Input Capture by TimerCounter 1: Off ACSR=0x80;
SFIOR=0x00; ADC initialization
ADC Clock frequency: 750.000 kHz ADC Voltage Reference: AVCC pin
ADC High Speed Mode: Off ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE 0xff; ADCSRA=0x84;
Universitas Sumatera Utara
SFIOR=0xEF; lcd_init16;
lcd_clear ; lcd_gotoxy0,0;
lcd_putssementara; ftoasuhu_c,1,sementara;
lcd_gotoxy0,1 ; lcd_puts“Wulan Lbs_Inkubator Induksi”;
delay_ms100; while 1
{
Place your code here SUHU= read_adc0+22;
suhu_c=floatSUHU5001023; sprintfsementara,i,SUHU;
if suhu 100 {
PORTC.6 = 0; PORTC.7 = 0;
} if suhu 100
{ PORTC.6 = 1;
PORTC.7 = 1; delay_ms100;
} }
{
Universitas Sumatera Utara
2. Program Antarmuka Komputer menggunakan Software Visual Basic 6.0.