Sistem Pengukuran Debit Air Berbasis Mikrokontroler Atmega8

LAMPIRAN

53
Universitas Sumatera Utara

LAMPIRAN I
Syntax Program
/*******************************************************
This program was created by the
CodeWizardAVR V3.12 Advanced
Automatic Program Generator
© Copyright 1998-2014 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 1/25/2017
Author :
Company :
Comments:
Chip type
: ATmega8

Program type
: Application
AVR Core Clock frequency: 8.000000 MHz
Memory model
: Small
External RAM size
:0
Data Stack size
: 256
*******************************************************/
#include
#include
// Alphanumeric LCD functions
#include
#include
#define pump PORTD.3
#define triger PORTC.0
#define pin_triger DDRC.0
#define echo PINC.1
#define pin_echo DDRC.1

float debit;
int waktu;
long int counter;
float jarak, volume;
char buf[20];
// Declare your global variables here

54
Universitas Sumatera Utara

void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port B initialization
// Function: Bit7=In Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
DDRB=(0