Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

HELP! mathematic expression in at89c51ed2

Status
Not open for further replies.

fypstudent

Newbie level 3
Joined
Nov 2, 2009
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
i have written a C code for my expression. but i am not sure if my MCU could run it or not...

can my MCU support to do this mathematic expression?

the C code goes like this...
void EQUA (void)
{
for (x=0; x<MAX; x++){
y1 = 214*expf(-powf(((x-120)/6),2.00));
y2 = 61*expf(-powf(((x-181)/17),2.00));
y3 = 48;
y4 = 24*expf(-powf(((x-86)/20),2.00));
y = y1+y2+y3+y4;
if (y>255)
y = 255;
A = (int)y;
P1 = A;
if (x>MAX)
x=0;
}
}

void T0DELAY(void)
{
TMOD=0x01;
TL0=0x70;
TH0=0xCC;
TR0=1;
while (TF0==0);
TR0=0;
TF0=0;
}

int main()
{
while (1){
EQUA();
T0DELAY();
}
}

some one please try it and let me know if P1 got the result or not.
cos the last time i check, P1 does not give me the correct result. it give me a constant '1'
if my MCU could not do it becos it's only 8 bit. what can i do to make it work? i mean with changing the MCU...
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top