0
\$\begingroup\$

I'm using a Microchip PIC18 and I need to use matrices in my code. I know DSPIC do have matrix libraries, that simplifies the implementation. Does anybody know whether any is available also for the 18 family (my present PIC18 embeds an hw multiplier)?

Thank you all!

\$\endgroup\$
2
\$\begingroup\$

If you're just using simple, fixed size matrices like 2x2 or 3x3 affine transforms, it's not very difficult to implement them yourself. That link shows how to compute the determinant and inverse of a matrix. Multiplication, addition, etc. are much easier. In fact, the Cairo source code, a drawing library, has GPL/LGPL/MPL licensed code for dealing with matrices (2D affine only): cairo-matrix.c

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Microchip themselves doesn't have any suitable libraries for the PIC18. Someone on the Microchip forums might have written some routines you can use, though.

I'd be inclined to use a 16-bit PIC, it would make things much easier.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ If you need to do a lot of multiplications per second, you would be wise to choose a PIC with a hardware multiplier. \$\endgroup\$ – markrages Jan 6 '11 at 19:03
  • \$\begingroup\$ Actually, the device does have an 8x8 hardware multiplicator. I agree with the 32bit choice, but I'm not the one who chose it.. \$\endgroup\$ – stef Jan 6 '11 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.