Professional Documents
Culture Documents
h>
#include <alcd.h>
#include <delay.h>
#include <stdio.h>
#define delay delay_ms(200);
unsigned int i=0,S,P=0,A=0,Kec;
float Pulse,Putaran;
// Timer1 overflow interrupt service
routine
interrupt [TIM1_OVF] void
timer1_ovf_isr(void)
{
// Reinitialize Timer1 value
TCNT1H=0xD8EF >> 8;
TCNT1L=0xD8EF & 0xff;
S++;
if(S==1100)
{
i++;
S=0;
}
if(i<5)
{
if(PINA.4==0)
{A=0;}
if(i==5)
{
printf("*");
delay;
Pulse=((float)P/36);
Putaran=((float)Pulse*62.8);
putchar(Kec);
delay;
printf("#");
delay;
P=0;
i=0;
void main(void)
{
PORTA=0x00;
DDRA=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 11059,200 kHz
// Mode: Normal top=0xFFFF
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: On
// Input Capture Interrupt: Off
}
}
#include
#include
#include
#include
<mega8535.h>
<alcd.h>
<stdio.h>
<delay.h>
// 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=0x47;
if(data==0x32)
{lcd_gotoxy(6,0);
lcd_putsf("TIMUR LAUT");}
if(data==0x33)
{lcd_gotoxy(6,0);
lcd_putsf("TIMUR
if(data==0x34)
{lcd_gotoxy(6,0);
lcd_putsf("TENGGARA ");}
if(data==0x35)
{lcd_gotoxy(6,0);
lcd_putsf("SELATAN ");}
if(data==0x36)
{lcd_gotoxy(6,0);
lcd_putsf("BARAT DAYA");}
if(data==0x37)
{lcd_gotoxy(6,0);
lcd_putsf("BARAT
");}
if(data==0x38)
{lcd_gotoxy(6,0);
lcd_putsf("BARAT LAUT");}
while (1)
{
lcd_gotoxy(0,0);
lcd_putsf("ARAH:");
lcd_gotoxy(0,1);
lcd_putsf("KEC :");
lcd_gotoxy(12,1);
lcd_putsf("m/s");
}
}
while(data!=0x2A)
{data=getchar();}
data=getchar();
sprintf(buff,"%d",data);
lcd_gotoxy(7,1);
lcd_putsf("
");
lcd_gotoxy(6,1);
lcd_puts(buff);
while(data!=0x23)
{data=getchar();}
data=getchar();
if(data==0x31)
{lcd_gotoxy(6,0);
lcd_putsf("UTARA
");}
");}