Back To Top

Naruto VS Sasuke,who is the strongest?

Saturday, 31 October 2015

listing function math adzan cpp (C++) with mikrocontroler atmega32

#include
#include
#include
#include
#asm
   .equ __i2c_port=0x18
   .equ __sda_bit=0
   .equ __scl_bit=1
   .equ __lcd_port=0x15
#endasm
#include
#include
#include
unsigned char buff[16];
unsigned char h,m,s,day,month,year,set1,set2,set3,set4,set5,set6;
int jamdhuz,mendhuz,detdhuz,asd,asd5,wl=7,tinggi=50,sudsub=18,sudisy=17,month2,year2,aa,bb,aa2,jamash,menash,detash,jammagh,menmagh,detmagh,asd7,jamisy,menisy,detisy,asd9,jamsub,mensub,detsub,asd11,var1;
float jddhuz,sudtandhuz,uudhuz,l0dhuz,deltadhuz,equdhuz,wktdhuz,asd2,asd6,pi=3.14159265359,korlin=-1*6.1744,korbuj=106.8294,jdg,jdl,sudtan,delta,uu,l0,equ,perdhuz,lintang,asd3,asd4,absol,percosash,perhaash,jdash,sudtanash,uuash,l0ash,deltaash,equash,absol2,altnam,koralt,altsej,cosash,haash,wktash,percosmagh,perhamagh,jdmagh,sudtanmagh,uumagh,l0magh,deltamagh,equmagh,cosmagh,hamagh,wktmagh,asd8,sudisya,percosisy,perhaisy,jdisy,sudtanisy,uuisy,l0isy,deltaisy,equisy,coshaisy,haisy,wktisy,asd10,sudsubuh,percossub,perhasub,jdsub,sudtansub,uusub,l0sub,deltasub,equsub,coshasub,hasub,wktsub,asd12;
void main(void)
{
PORTA=0x00;DDRA=0xff;
PORTB=0x00;DDRB=0xff;
PORTC=0x00;DDRC=0xff;
PORTD=0xff;DDRD=0x00;

ACSR=0x80;
SFIOR=0x00;
i2c_init();
rtc_init(0,0,0);
lcd_init(16);
lcd_clear();              
while (1)
      {lcd_clear();
      rtc_get_time(&h,&m,&s);
      rtc_get_date(&day,&month,&year);
      lcd_gotoxy(0,0);
      sprintf(buff,"Time %d:%d:%d",h,m,s);
      lcd_puts(buff);
      lcd_gotoxy(0,1);
      sprintf(buff,"Date %d:%d:20%d", day,month,year);
      lcd_puts(buff);
      delay_ms(50);

lintang=korlin*pi/180;
month2=month,year2=2000+year;
if (month<=2)
{month2=month2+12;year2=year2-1;}
aa= (year2)/100;
aa2=aa/4;
bb = 2 + aa2 - aa;
asd3= 365.25*(year2);
asd4=30.6001*(month2 + 1);
jdg = 1720994.5 + asd3 + asd4 + bb + day +(12/24);

jdl = jdg-(wl/24);
sudtan=2*pi*(jdl - 2451545)/365.25;
delta=(0.37877 + 23.264*sin((57.297*sudtan - 79.547)*pi/180) + 0.3812*sin((2*57.297*sudtan - 82.682)*pi/180) + 0.17132*sin((3*57.297*sudtan - 59.722)*pi/180))*pi/180;
uu = (jdl - 2451545)/36525;
l0 = (280.46607 + 36000.7698*uu)*pi/180;
equ= (-1*(1789 + 237*uu)*sin(l0) - (7146 - 62*uu)*cos(l0) + (9934 - 14*uu)*sin(2*l0) - (29 + 5*uu)*cos(2*l0) + (74 + 10*uu)*sin(3*l0) + (320 - 4*uu)*cos(3*l0) - 212*sin(4*l0))/1000;
perdhuz=12+wl-(korbuj/15)-(equ/60);
jddhuz=jdl+(perdhuz/24)-(12/24);
sudtandhuz=2*pi*(jddhuz - 2451545)/365.25;
uudhuz = (jdl - 2451545)/36525;
l0dhuz=(280.46607 + 36000.7698*uudhuz)*pi/180;
deltadhuz=(0.37877 + 23.264*sin((57.297*sudtandhuz - 79.547)*pi/180) + 0.3812*sin((2*57.297*sudtandhuz - 82.682)*pi/180) + 0.17132*sin((3*57.297*sudtandhuz - 59.722)*pi/180))*pi/180;
equdhuz= (-1*(1789 + 237*uudhuz)*sin(l0dhuz) - (7146 - 62*uudhuz)*cos(l0dhuz) + (9934 - 14*uudhuz)*sin(2*l0dhuz) - (29 + 5*uudhuz)*cos(2*l0dhuz) + (74 + 10*uudhuz)*sin(3*l0dhuz) + (320 - 4*uudhuz)*cos(3*l0dhuz) - 212*sin(4*l0dhuz))/1000;
wktdhuz=12+wl-(korbuj/15)-(equdhuz/60);
asd=wktdhuz;
asd2= ((wktdhuz)-(asd));
jamdhuz=asd;
mendhuz=asd2*60;
detdhuz=((asd2*60)-mendhuz)*60;

absol=lintang-delta;
if (absol<0 p="">{absol=-1*absol;}
percosash=(sin(atan(1/(1+tan(absol))))-sin(delta)*sin(lintang))/(cos(delta)*cos(lintang));
perhaash=acos(percosash)*180/pi;
jdash=jdl+(perhaash/360);
sudtanash=2*pi*(jdash-2451545)/365.25;
uuash=(jdash-2451545)/36525;
l0ash=(280.46607 + 36000.7698*uuash)*pi/180;
deltaash=(0.37877+23.264*sin((57.297*sudtanash-79.547)*pi/180)+0.3812*sin((2*57.297*sudtanash-82.682)*pi/180)+0.17132*sin((3*57.297*sudtanash-59.722)*pi/180))*pi/180;
equash=(-1*(1789 + 237*uuash)*sin(l0ash) - (7146 - 62*uuash)*cos(l0ash) + (9934 - 14*uuash)*sin(2*l0ash) - (29 + 5*uuash)*cos(2*l0ash) + (74 + 10*uuash)*sin(3*l0ash) + (320 - 4*uuash)*cos(3*l0ash) - 212*sin(4*l0ash))/1000;
absol2=lintang-deltaash;
if (absol2<0 p="">{absol2=-1*absol2;}
altnam=atan(1/(1+tan(absol2)))*180/pi;
koralt=1/(60*tan((altnam+7.31/(altnam+4.4))*pi/180));
altsej=(altnam-koralt)*pi/180;
cosash=(sin(altsej)-sin(deltaash)*sin(lintang))/(cos(deltaash)*cos(lintang));
haash=acos(cosash)*180/pi;
wktash=12+wl-korbuj/15-equash/60+haash/15;
asd5=wktash;
asd6= ((wktash)-(asd5));
jamash=asd5;
menash=asd6*60;
detash=((asd6*60)-menash)*60;

percosmagh=(sin((-0.8333-0.0347*pow(tinggi,0.5))*pi/180)-sin(delta)*sin(lintang))/(cos(delta)*cos(lintang));
perhamagh=acos((sin((-0.8333-0.0347*pow(tinggi,0.5))*pi/180)-sin(delta)*sin(lintang))/(cos(delta)*cos(lintang)))*180/pi;
jdmagh=jdl+perhamagh/360;
sudtanmagh=2*pi*(jdmagh-2451545)/365.25;
uumagh=(jdmagh-2451545)/36525;
l0magh=(280.46607 + 36000.7698*uumagh)*pi/180;
deltamagh= (0.37877+23.264*sin((57.297*sudtanmagh-79.547)*pi/180)+0.3812*sin((2*57.297*sudtanmagh-82.682)*pi/180)+0.17132*sin((3*57.297*sudtanmagh-59.722)*pi/180))*pi/180;
equmagh=(-1*(1789 + 237*uumagh)*sin(l0magh) - (7146 - 62*uumagh)*cos(l0magh) + (9934 - 14*uumagh)*sin(2*l0magh) - (29 + 5*uumagh)*cos(2*l0magh) + (74 + 10*uumagh)*sin(3*l0magh) + (320 - 4*uumagh)*cos(3*l0magh) - 212*sin(4*l0magh))/1000;
cosmagh=(sin((-0.8333-0.0347*pow(tinggi,0.5))*pi/180)-sin(deltamagh)*sin(lintang))/(cos(deltamagh)*cos(lintang));
hamagh=acos(cosmagh)*180/pi;
wktmagh=12+wl-(korbuj/15)-(equmagh/60)+(hamagh/15);
asd7=wktmagh;
asd8= ((wktmagh)-(asd7));
jammagh=asd7;
menmagh=asd8*60;
detmagh=((asd8*60)-menmagh)*60;

sudisya=sudisy*pi/180;
percosisy=(sin(-1*sudisya)-sin(delta)*sin(lintang))/(cos(delta)*cos(lintang));
perhaisy=acos(percosisy)*180/pi;
jdisy=jdl+perhaisy/360;
sudtanisy=2*pi*(jdisy-2451545)/365.25;
uuisy=(jdisy-2451545)/36525;
l0isy=(280.46607 + 36000.7698*uuisy)*pi/180;
deltaisy=(0.37877+23.264*sin((57.297*sudtanisy-79.547)*pi/180)+0.3812*sin((2*57.297*sudtanisy-82.682)*pi/180)+0.17132*sin((3*57.297*sudtanisy-59.722)*pi/180))*pi/180;
equisy=(-1*(1789 + 237*uuisy)*sin(l0isy) - (7146 - 62*uuisy)*cos(l0isy) + (9934 - 14*uuisy)*sin(2*l0isy) - (29 + 5*uuisy)*cos(2*l0isy) + (74 + 10*uuisy)*sin(3*l0isy) + (320 - 4*uuisy)*cos(3*l0isy) - 212*sin(4*l0isy))/1000;
coshaisy=(sin(-1*sudisya)-sin(deltaisy)*sin(lintang))/(cos(deltaisy)*cos(lintang));
haisy=acos(coshaisy)*180/pi;
wktisy=12+wl-korbuj/15-equisy/60+haisy/15;
asd9=wktisy;
asd10= ((wktisy)-(asd9));
jamisy=asd9;
menisy=asd10*60;
detisy=((asd10*60)-menisy)*60;

sudsubuh=sudsub*pi/180;
percossub=(sin(-1*sudsubuh)-sin(delta)*sin(lintang))/(cos(delta)*cos(lintang));
perhasub=acos(percossub)*180/pi;
jdsub=jdl-perhasub/360;
sudtansub=2*pi*(jdsub-2451545)/365.25;
uusub=(jdsub-2451545)/36525;
l0sub=(280.46607 + 36000.7698*uusub)*pi/180;
deltasub=(0.37877+23.264*sin((57.297*sudtansub-79.547)*pi/180)+0.3812*sin((2*57.297*sudtansub-82.682)*pi/180)+0.17132*sin((3*57.297*sudtansub-59.722)*pi/180))*pi/180;
equsub=(-1*(1789 + 237*uusub)*sin(l0sub) - (7146 - 62*uusub)*cos(l0sub) + (9934 - 14*uusub)*sin(2*l0sub) - (29 + 5*uusub)*cos(2*l0sub) + (74 + 10*uusub)*sin(3*l0sub) + (320 - 4*uusub)*cos(3*l0sub) - 212*sin(4*l0sub))/1000;
coshasub=(sin(-1*sudsubuh)-sin(deltasub)*sin(lintang))/(cos(deltasub)*cos(lintang));
hasub=acos(coshasub)*180/pi;
wktsub=12+wl-korbuj/15-equsub/60-hasub/15;
asd11=wktsub;
asd12= ((wktsub)-(asd11));
jamsub=asd11;
mensub=asd12*60;
detsub=((asd12*60)-mensub)*60;
      switch (PIND)
      {case 0xFE :
      {lcd_clear();
      set3=0,set1=h;set2=m;
      while (1)
      {
      lcd_gotoxy(0,0);
      lcd_putsf("Set Jam :");                
      lcd_gotoxy(0,1);
      sprintf(buff,"Jam %d:%d",set1,set2);
      lcd_puts(buff);
      if (PIND.1==0)
      {set1++;
      rtc_set_time(set1,set2,set3);
      delay_ms(150);
      if (set1==24 | set1>=100)
      {lcd_clear();set1=0;
      rtc_set_time(set1,set2,set3);
      delay_ms(20);}}
      if (PIND.2==0)
      {set2++;
      rtc_set_time(set1,set2,set3);
      delay_ms(150);
      if (set2==60 | set2>=100)
      {lcd_clear();set2=0;
      rtc_set_time(set1,set2,set3);
      delay_ms(20);}}
      if (PIND.4==0)
      {break;}
      };break;}
     
      case 0xFD :
      {lcd_clear();
      set4=day,set5=month,set6=year;
      while (1)
      {
      lcd_gotoxy(0,0);
      lcd_putsf("Set Tanggal :");                
      lcd_gotoxy(0,1);
      sprintf(buff,"%d-%d-20%d",set4,set5,set6);
      lcd_puts(buff);
      if (PIND.1==0)
      {set4++;
      rtc_set_date(set4,set5,set6);
      delay_ms(150);
      var1=29;
      if (set6%4==0)
      {var1=30;}
      if (set4==var1 | set4>=100 )
      {lcd_clear();set4=0;
      rtc_set_date(set4,set5,set6);
      delay_ms(20);}}
      if (PIND.2==0)
      {set5++;
      rtc_set_date(set4,set5,set6);
      delay_ms(150);
      if (set5==13 | set5>=100)
      {lcd_clear();set5=1;
      rtc_set_date(set4,set5,set6);
      delay_ms(20);}}
      if (PIND.3==0)
      {set6++;
      rtc_set_date(set4,set5,set6);
      delay_ms(150);
      if (set6==100 | set6>=100)
      {lcd_clear();set6=0;
      rtc_set_date(set4,set5,set6);
      delay_ms(20);}}
      if (PIND.4==0)
      {break;}
      };break;}
      case 0xFB :
      {lcd_clear();
      while (1){
      lcd_gotoxy(0,0);
      sprintf(buff,"shubuh %d:%d",jamsub,mensub);
      lcd_puts(buff);
      delay_ms(200);
      lcd_clear();
      if (PIND.4==0)
      {break;}
      sprintf(buff,"dzuhur %d:%d",jamdhuz,mendhuz);
      lcd_puts(buff);
      delay_ms(200);
      lcd_clear();
      if (PIND.4==0)
      {break;}
      sprintf(buff,"ashar %d:%d",jamash,menash);
      lcd_puts(buff);
      delay_ms(200);
      lcd_clear();
      if (PIND.4==0)
      {break;}
      sprintf(buff,"maghrib %d:%d",jammagh,menmagh);
      lcd_puts(buff);
      delay_ms(200);
      lcd_clear();
      if (PIND.4==0)
      {break;}
      sprintf(buff,"isya %d:%d",jamisy,menisy);
      lcd_puts(buff);
      delay_ms(200);
      lcd_clear();
      if (PIND.4==0)
      {break;}};break;}
     
      default : break;}
      if (jamsub==h&mensub==m| jamisy==h&menisy==m| jammagh==h&menmagh==m| jamash==h&menash==m| jamdhuz==h&mendhuz==m)
      {
      PORTA=0xff;}
      else
      {PORTA=0x00;}    
     };
}    

No comments:

Post a Comment

Visitor

Powered by Blogger.

Labels

Copyright © 2012 Bebin Cahyadi | Naruto Vs Sasuke V2 Theme | Designed by Johanes DJ