Keil™, An ARM® Company

Discussion Forum

Coprocessor

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

DetailsMessage
Read-Only
Author
Alexey Gradovtsev
Posted
19-Mar-2003 14:09 GMT
Toolset
C166
New! Coprocessor
Hello All!

Where can I find a complete example of using C167 coprocessor, including its initialization and (espesially desired) chasing when results of calculation are ready for reading? There are some details obscure for me.

Thanks.
Read-Only
Author
Walt Conley
Posted
19-Mar-2003 14:17 GMT
Toolset
C166
New! RE: Coprocessor
What do you mean by C167 coprocessor?
Read-Only
Author
Alexey Gradovtsev
Posted
19-Mar-2003 14:28 GMT
Toolset
C166
New! RE: Coprocessor
Mathematical coprocessor of 16x controller.
Read-Only
Author
Walt Conley
Posted
19-Mar-2003 14:44 GMT
Toolset
C166
New! RE: Coprocessor
AFAIK, this is all transparent to the programmer. Simply use the MUL and DIV instructions and let the processor do the rest.
Read-Only
Author
Alexey Gradovtsev
Posted
20-Mar-2003 08:07 GMT
Toolset
C166
New! RE: Coprocessor
Well, what about Sin, Cos and other non-obvious functions?
Read-Only
Author
Mike Kleshov
Posted
20-Mar-2003 10:11 GMT
Toolset
C166
New! RE: Coprocessor
Hi Alexey,

Sine, cosine and other functions were written in assembly language by Keil Software. They use MUL, DIV, ADD, SUB etc. instructions to do the job. Those functions were well optimized (hopefully :-)). Of course you can try and write your own if you don't like Keil's ones.
C166 and x86 are very different architectures. Don't assume that every processor has a single-instruction sine computation capability just because x86 does. Read the manual.

Regards,
- mike
Read-Only
Author
Alexey Gradovtsev
Posted
20-Mar-2003 10:45 GMT
Toolset
C166
New! RE: Coprocessor
So as far as I realise Keil compiler uses Taylor's series (or smth. similar) to compute sine, cosine, etc? And that's why these appear to be computed VERY slow. I can't see any optimisation here while there's coprocessor's Sin, Cos functions which take 600 and 700 ns, resp. And there's documented interface to coprocessor, but I've got some probs with it. So now the question is HOW to use coprocessor, not IF to use it ;)

I don't care about x86's coprocessor capabilities. If I did, I wouldn't take C16x at all. So if there are manuals/examples, I'd gratefully take them. That's why I ask.
Read-Only
Author
erik malund
Posted
20-Mar-2003 12:45 GMT
Toolset
C166
New! RE: Coprocessor
If you need a math coprocessor you just chose the wrong chip to begin with. The '51s are microcontrollers not microprocessors

Erik
Read-Only
Author
Alexey Gradovtsev
Posted
20-Mar-2003 12:51 GMT
Toolset
C166
New! RE: Coprocessor
So the C16xs are, too.
Or I don't understand your words...
Read-Only
Author
erik malund
Posted
20-Mar-2003 13:50 GMT
Toolset
C166
New! RE: Coprocessor
So the C16xs are, too.
Or I don't understand your words...

Yes they are microcontrollers and for extensive math you need a microprocessor
Have a look at the x86 series

Erik
Read-Only
Author
Alexey Gradovtsev
Posted
20-Mar-2003 14:14 GMT
Toolset
C166
New! RE: Coprocessor
To erik:

You mean that there's x86 processor in C16x controllers, and so what I have to do is find manual on x86 instructions? Could you kindly address me to where I can find it, please? Thanks.
Read-Only
Author
Alexey Gradovtsev
Posted
20-Mar-2003 14:08 GMT
Toolset
C166
New! RE: Coprocessor
To Mike:

C166 and x86 are very different architectures. Don't assume that every processor has a single-instruction sine computation capability just because x86 does. Read the manual.

Oh I didn't at once undestand what you mean. Of course there IS a single-instruction Sin function in MF167's mathematical coprocessor. I just know it because I READ the manual on MF167 microcontroller.
Read-Only
Author
Mike Kleshov
Posted
20-Mar-2003 15:13 GMT
Toolset
C166
New! RE: Coprocessor
Sorry Alexey,
This is clearly a case of misunderstanding. I can see that you mean this controller board:
http://www.kaskod.ru/prkontr/mf167.html
The mathematical coprocessor on this board is external to the C167 microcontroller. Apparently it is Kaskod's proprietary solution and there is no reason for Keil Software to include direct support of this coprocessor in its C166 package. You have to use both Kaskod's and Infineon's documentation to figure out how it all works.
So yes, you should use assembler to utilize the coprocessor and speed up calculations. I would suggest considering the __asm keyword, which was introduced in the C166 toolset in v4.24. It should be better than pragma asm/endasm in many respects.

Best luck!
- mike
Read-Only
Author
Alexey Gradovtsev
Posted
21-Mar-2003 08:32 GMT
Toolset
C166
New! RE: Coprocessor
Mike,

Hm... Yes, I admit my guilt. I didn't say I use Cascod's MF167 controller. I just thought that it's a common approach to hardwire a coprocessor to 16x controllers and that they have common interface.

Thanks a lot!
Read-Only
Author
Jon Ward
Posted
20-Mar-2003 15:18 GMT
Toolset
C166
New! RE: Coprocessor
Of course there IS a single-instruction Sin function in MF167's mathematical coprocessor

Are you talking about the MAC unit? If so, what device has a SIN MAC instruction? Can you provide a link to the datasheet where this MAC instruction is described?

Thanks,
Jon
Read-Only
Author
Graham Cole
Posted
24-Mar-2003 12:16 GMT
Toolset
C166
New! RE: Coprocessor
Before you go adding extra hardware to your system, you might consider alternative software algorithms. As has already been said, a microcontroller is not generally up to the job of doing lots of transendental functions.

Ask yourself just how accurate you need these function to be. Then consider alternatives such as look-up tables.

You might consider using series other that the Taylor series, such as the Pade Approximation (see http://users.pandora.be/martin.brown/home/consult/logx.htm ). Google for more.

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