hello
i used many floats in this program and here the program see it and if u can help me please i have no much more time
#include "C:\RAPPORT PFE\pcf programme\clock.h"
#include <LCD.C>
#include<math.h>
#use i2c (master,sda=pin_c1,scl=pin_c0)
void main()
{
int retval,s1,s2;
int min,m1,m2;
int hr,h1,h2;
int day,d1,d2;
int mon,mo1,mo2,month;
int year;
int i,p=10;
int mv=0,data;
int h3,h4,m3,m4;
float bta,D,N,N1,N2,N3,t;
float R,G,H,L,B;
float Z ,U1,U2,U,VD,Vn,w;
float fajer,dhuhur,aser,maghreb,icha;
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
lcd_init();
while(1)
{
data=input_b();
//*************************************- Menu -***********************************************
if(data==0x01)
{
mv=mv+1;
if(mv==4)
{
mv=1;
}
delay_ms(150);
}
if(mv==1)
{
lcd_gotoxy(1,1);
lcd_putc("Reveil ");
if (data==0x04 )
{
p=p+3;
if(p>13)
{
p=10;
}
lcd_gotoxy((p-2),2);
lcd_putc(" 00| ");
delay_ms(200);
}
if(data==0x02 && p==10 )
{
h3=h3+1;
if(h3==10 && h4<3)
{
h3=0;
h4=h4+1;
}
if ((h4==2) && (h3>3))
{
h4=0;
h3=0;
}
lcd_gotoxy((p-1),2);
lcd_putc(h4+48);
lcd_gotoxy((p ),2);
lcd_putc(h3+48);
delay_ms(200);
}
//******************************************************************************
if(data==0x02 && p==13 )
{
m3=m3+1;
if(m3==10 && m4<6)
{
m3=0;
m4=m4+1;
}
if ((m4==5) && (m3>9))
{
m4=0;
m3=0;
}
lcd_gotoxy((p-1),2);
lcd_putc(m4+48);
lcd_gotoxy((p ),2);
lcd_putc(m3+48);
delay_ms(200);
}
}
//********************************************************************************
if(mv==2)
{
//********************************************- programme pcf -***************************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x00);
i2c_write(0x00);
i2c_stop();
strt:
{
//********************************- SECONDES -*****************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x02);
i2c_start();
i2c_write(0xa1);
retval=i2c_read(0);
i2c_stop();
if(retval>9)
{ retval=retval-6; }
if(retval>19)
{ retval=retval-6; }
if(retval>29)
{ retval=retval-6; }
if(retval>39)
{ retval=retval-6; }
if(retval>49)
{ retval=retval-6; }
s1=retval/10;
s2=retval%10;
lcd_gotoxy(1,1);
lcd_putc("Time: ");
lcd_gotoxy(13,1);
lcd_putc(s1+48);
lcd_gotoxy(14,1);
lcd_putc(s2+48);
//-********************************- MINUTES -*****************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x03);
i2c_start();
i2c_write(0xa1);
min=i2c_read(0);
i2c_stop();
if(min>9)
{ min=min-6; }
if(min>19)
{ min=min-6; }
if(min>29)
{ min=min-6; }
if(min>39)
{ min=min-6; }
if(min>49)
{ min=min-6; }
m1=min/10;
m2=min%10;
lcd_gotoxy(10,1);
lcd_putc(m1+48);
lcd_gotoxy(11,1);
lcd_putc(m2+48);
lcd_gotoxy(12,1);
lcd_putc(":");
//-********************************- HEURES -*****************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x04);
i2c_start();
i2c_write(0xa1);
hr=i2c_read(0);
i2c_stop();
if(hr>9)
{ hr=hr-6; }
if(hr>19)
{ hr=hr-6; }
h1=hr/10;
h2=hr%10;
lcd_gotoxy(9,1);
lcd_putc(":");
lcd_gotoxy(7,1);
lcd_putc(h1+48);
lcd_gotoxy(8,1);
lcd_putc(h2+48);
//-*******************************-Date -********************************
lcd_gotoxy(1,2);
lcd_putc("Date: ");
//-********************************- jours -*****************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x05);
i2c_start();
i2c_write(0xa1);
day=i2c_read();
day=day & 0x1f;
i2c_stop();
if(day>9)
{ day=day-6; }
if(day>19)
{ day=day-6; }
if(day>29)
{ day=day-6; }
if(day>20)
{d1==2; }
d1=day/10;
d2=day%10;
lcd_gotoxy(7,2);
lcd_putc(d1+48);
lcd_gotoxy(8,2);
lcd_putc(d2+48);
//-********************************- mois -******************************
i2c_start();
i2c_write(0xa0);
i2c_write(0x06);
i2c_start();
i2c_write(0xa1);
mon=i2c_read(0);
i2c_stop();
month=(mon & 0x1f);
if(month>10)
{ month=month-6; }
mo1=month/10;
mo2=month%10;
lcd_gotoxy(9,2);
lcd_putc("/");
lcd_gotoxy(10,2);
lcd_putc(mo1+48);
lcd_gotoxy(11,2);
lcd_putc(mo2+48);
//-*********- alarme de reveil-*********//
if(h1==h4 && h2==h3 && m1==m4 && m2==m3)
{
output_b(0x08);
}
//-***********- calculate the day of the year -****************-//
N1 = floor( (275 * month / 9));
N2 = floor((month + 9) / 12);
N3 = (1 + floor((2008 - 4 * floor(2008 / 4) + 2) / 3));
N = ((N1 - (N2 * N3) ) + (day - 30));
bta=(((2*(0.001))*N)/360);//year angle
//-****-declinaison de soleil-**********-//
D=((180/(0.001))*(0.006918-(0.399912*cos(bta))+(0.070257*sin(bta))-(0.006758*cos(2*bta))+(0.000907*sin(2*bta))-(0.002697*cos(3*bta))+(0.001480*sin(3*bta))));
//-******equatiopn de temps en minutes -****-//
T=(229.18*(0.000075+(0.001868*cos(bta))-(0.032077*sin(bta))-(0.014615*cos(2*bta))-(0.040849*sin(2*bta))));
//-*******(R)=reference de longitude; (G)=degree de fajr et maghreb; (H)=altitude above sea -****-//
R=15;
G=18;
H=25;
L=34;
B=8;
Z=(12+((R-L)/15)-(T/60));
U1=(sin((-0.8333-0.0347*(H/abs(H))*(sqrt(abs(H)))*((0.001)/180))-sin(D*((0.001)/180))*sin(B*((0.001)/180))));
U2=(cos(D*((0.001)/180))*cos(B*((0.001)/180)));
U=((180/(15*(0.001)))*acos(U1/U2));
Vd=((180/0.015)*acos((-(sin(19.5*(0.001/180)))-(sin(D*(0.001/180)))*(sin(B*(0.001/180))))/
((cos(D*(0.001/180)))*(cos(B*(0.001/180))))));
Vn=((180/0.015)*acos((-(sin(17.5*(0.001/180)))-(sin(D*(0.001/180)))*(sin(B*(0.001/180))))/((cos(D*(0.001/180)))*(cos(B*(0.001/180))))));
W=((180/0.015)*acos((sin(atan(1/(1+tan(abs(B-D)*(0.001/180)))))-sin(D*(0.001/180))*sin(B*(0.001/180)))/((cos(D*(0.001/180)))*(cos(B*(0.001/180))))));
fajer=Z-Vd;
dhuhur=Z;
aser=Z+w;
maghreb=Z+U;
icha=Z+Vn;
}
delay_ms(200);
goto strt;
}
}
}
if u have any suggestion please help me
and thnk you