Discussion Forum

about C lib.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
pattaraporn suebtao
Posted
17-Apr-2006 05:57 GMT
Toolset
C51
New! about C lib.
How can I use Keil to compute exponential function?

is use #include <stdlib.h>?

thank you sir.
Read-Only
Author
A.W. Neil
Posted
17-Apr-2006 06:52 GMT
Toolset
C51
New! RTFM!
http://www.keil.com/support/man/docs/c51/c51_exp.htm

http://www.keil.com/demo/limits.asp

You could also try a lookup table.

Remember: the 8051 is a simple 8-bit microcontroller - it is not generally well suited to maths-intensive applications.
Read-Only
Author
pattaraporn suebtao
Posted
17-Apr-2006 13:26 GMT
Toolset
C51
New! RE: RTFM!
thank you for your helping very much.
I feel so good for every your answer.This help me understand about KEIL better than two days ago.
And this time, I have some question to ask go again. :D .
  Can Keil compute Imaginary part?.
    


this program I show you about my idea to compute Img.


#include <math.h>
...

i = sqrt(-1);

Is it correct program?.


Thank alot for your answer.
pattaraporn;
Read-Only
Author
A.W. Neil
Posted
17-Apr-2006 15:09 GMT
Toolset
C51
New! Back to basics
"This help me understand about KEIL better than two days ago."

Surely, in two days you could have managed to find the section in the Manual that describes the standard library functions?

Anyhow, This has nothing to do with Keil specifically.

This is basic 'C' textbook stuff.

Ask yourself: does the 'C' programming language, or the standard 'C' library make any mention of complex numbers?

Again, the 8051 is a simple 8-bit microcontroller - it is not generally well suited to maths-intensive applications.

In fact, if you want direct language support for complex numbers, you'd be better off with FORTRAN.

NO, I don't think there's a FORTRAN implentation for the 8051...!
Read-Only
Author
pattaraporn suebtao
Posted
18-Apr-2006 06:16 GMT
Toolset
C51
New! RE: Back to basics
In basic, I must include complex.h to compute complex number but I cant't   #include <complex.h>  on Keil


Does keil has complex.h library?.
yes, it does -->> Why my program error
No,it doesn't -->> How can I compute complex number with KEIL?.

I need to use Keil to compute complex number because it can implement on 8051.
It's some part of my senior project.

sincerely yours
pattaraporn

Read-Only
Author
A.W. Neil
Posted
18-Apr-2006 06:52 GMT
Toolset
C51
New! RTFM!
The complete Keil library is described in the C51 Manual. Here it is:

http://www.keil.com/support/man/docs/c51/c51_library.htm
Read-Only
Author
pattaraporn suebtao
Posted
18-Apr-2006 07:26 GMT
Toolset
C51
New! RE: RTFM!
I can't found library about complex number.
Can you more advise me?.
Read-Only
Author
pattaraporn suebtao
Posted
18-Apr-2006 07:28 GMT
Toolset
C51
New! RE: RTFM!
I'm not found library for complex number.
can you more advise me?
Read-Only
Author
A.W. Neil
Posted
18-Apr-2006 08:14 GMT
Toolset
C51
New! RE: RTFM!
You're a Senior student - you should know by now how to use the research facilities available to you!

* Have you checked your college library?

* What does Google say?
Read-Only
Author
Neo A
Posted
18-Apr-2006 09:56 GMT
Toolset
C51
New! RE: RTFM!
8051 is not intended for complex calculations. Thinking to do complex calc on 8051 is almost futile.
- Neo
Read-Only
Author
A.W. Neil
Posted
18-Apr-2006 11:05 GMT
Toolset
C51
New! Futile?
I wouldn't go as far as to say, "futile".
Read-Only
Author
erik malund
Posted
18-Apr-2006 13:42 GMT
Toolset
C51
New! RE: Futile?
I wouldn't go as far as to say, "futile".

Agreed, it can be done. To test the result, start the calculation when you leave work and hope the result has been calculated when you arrive in the morning :)

Erik
Read-Only
Author
Christoph Franck
Posted
18-Apr-2006 12:19 GMT
Toolset
C51
New! RE: RTFM!
Quite likely, you'll have to put together your own structures and functions to deal with complex numbers.

Most applications for '51 MCUs don't involve heavy maths stuff because the processor neither has the RAM, ROM or CPU power to handle general purpose complex number libraries and the like efficiently.

You will have to determine _what exactly_ you need to do that involves complex numbers, and then implement it. Alternatively, considering if and how to avoid the use of complex numbers could also be an option.
Read-Only
Author
pattaraporn suebtao
Posted
21-Apr-2006 04:25 GMT
Toolset
C51
New! RE: RTFM!
thank you for your suggestion very much,
I need to calc complex number on 8051
because of I have to calc FFT.
Also,I will try to produce my own function to calc complex no.
thank you very much.
  I will ask you when I can solve this proble.

(^_^)

pattaraporn

Read-Only
Author
Christoph Franck
Posted
21-Apr-2006 08:19 GMT
Toolset
C51
New! RE: RTFM!
I need to calc complex number on 8051 because of I have to calc FFT.

Actually, you don't. Using the exponential notation in frequency analysis is merely a convenient way to pack a sine and a cosine function into a single expression. The only complex operations necessary are addition/subtraction and multiplication, which are trivial to implement.

If you're using anything like calls to exponential or trigonometric library functions (instead of just using a lookup table), you're essentially doing the exact opposite of a Fast Fourier Transform, because the resulting code will run very slowly.
Read-Only
Author
A.W. Neil
Posted
21-Apr-2006 08:49 GMT
Toolset
C51
New! Get Googling!
http://en.wikipedia.org/wiki/Cooley-Tukey_FFT_algorithm

http://www.fftw.org/
Read-Only
Author
Hans-Bernhard Broeker
Posted
21-Apr-2006 09:41 GMT
Toolset
C51
New! RE: RTFM!
I need to calc complex number on 8051
because of I have to calc FFT.


Says who? Who decided that an 8051 was an appropriate choice of processor to run an FFT on? Is that person generally crazy, or did (s)he just want to make you miserable in this particular case?

That said, no, you don't need complex numbers to implement an FFT. They're convenient to use if you have them, but they're quite definitely not worth the hassle of implementing them from scratch just to use them in an FFT.

Morale: you'll want to learn a lot more about 8051's, C and FFT before you go anywhere near implementing this.
Read-Only
Author
Christoph Franck
Posted
21-Apr-2006 09:49 GMT
Toolset
C51
New! RE: RTFM!
Is that person generally crazy, or did (s)he just want to make you miserable in this particular case?

Maybe it is a special, hidden kind of test for the students. Will they realize that their target hardware is not suited for the task, or will they not ?
Read-Only
Author
Drew Davis
Posted
21-Apr-2006 23:10 GMT
Toolset
C51
New! RE: RTFM!
This tech note might be of interest. Though it's not for an 8051, it is for a low-powered 16-bit micro without floating point hardware.

http://www.maxim-ic.com/appnotes.cfm/appnote_number/3722
Read-Only
Author
A.W. Neil
Posted
22-Apr-2006 10:25 GMT
Toolset
C51
New! Capability
"Will they realize that their target hardware is not suited for the task"

I wonder how the capability of an 8051 compares to the computing facilities available to Cooley & Tukey at the time of their 1965 paper...?

Discuss.
Read-Only
Author
Hans-Bernhard Broeker
Posted
22-Apr-2006 11:20 GMT
Toolset
C51
New! RE: Capability
I wonder how the capability of an 8051 compares to the computing facilities available to Cooley & Tukey at the time of their 1965 paper...?

That's actually quite irrelevant. Even if, as I would guess, a modern-day high-end 8051 can outperform anything available to the inventors of the algorithm, using one of those today, when other hardware outperforms them by orders of magnitude, is exactly as wrong as if that weren't the case.

Using an 8051 to do an FFT today is about as crazy an idea as using a screwdriver to dig a grave when there's a shovel available.
Read-Only
Author
Andy Neil
Posted
22-Apr-2006 22:29 GMT
Toolset
C51
New! RE: Capability
"That's actually quite irrelevant"

I didn't say it was relevant - I just offered it as an interesting thought.

I think you can tell from my previous posts in this thread that I very much doubt the applicability of an 8051 to this project...
Read-Only
Author
pattaraporn suebtao
Posted
24-Apr-2006 02:50 GMT
Toolset
C51
New! RE: Capability
Thank you very much,
I'll ask you when I finish my project.

    ^_^
pattaraporn

Next Thread | Thread List | Previous Thread Start a Thread | Settings