Добавил:
Eatmore
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:
#include <reg51.h>
#include <math.h>
float fx(float x, float e)
{
// член ряда
float an;
// общий результат
float res;
an = 1;
res = 0;
/*
while (fabs(an)>e)
{
res+=an;
an*=-x;
} */
return 1/(1+x);
}
void main()
{
float x = 0;
int i;
char xdata y[128];
P1=0;
i=0;
while(1) for (x=0; x<0.999999; x+=0.0078125) // 0,0078125 = 1/128
{
y[i]=255*fx(x, 0.05);
P1 = y[i];
i++;
}
for(;;);
}