--_003_000d01cbe0ccb5a4d5a00300a8c0main_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable IVP wrote: > can I have recommendations please for floating point and fixed point > assembly routines for 16F or 18F There are 32 bit fixed point and 24 bit floating point routines included in my PIC development environment. See http://www.embedinc.com/pic/dload.htm. Look in the SOURCE > PIC directory after software installation. The 24 bit floating point source files all have "fp24" in their name somewhere. The description of the floating point format is in FP24FLT.INS.ASPIC, and I have also attached it. This floating point format is handy for most things a PIC will do. It only has 16 bits of precision, but that's plenty when values come in as 12 bit A/D readings and go out as 10 bit PWM duty cycle values. The routines also don't bother with all the NaN stuff, which is a silly waste of cycles in a small embeddd system dealing with real world data. The arithmetic routines saturate as necessar= y but otherwise keep on going. The 32 bit fixed point routines don't have consistent naming conventions. There are names like ADDA, SUBA, MULU, DIVU, and probably a few others. Look around. All of this code assumes my PIC development environment, of course. It would be a good idea to start using it in general, although there will be a bit of a learning curve to get started. All these routines rely on my general register model, usually REG0-REG12 on a PIC 16 and REG0-REG15 on a PIC 18. The first 4 registers are also grouped together and called REGA, then REGB and REGC, for most of the wide data math routines. > Project requires * and / plus trig functions in the range 0.0000 to > 180.0000, which I think fixed point would be sufficient for I haven't implemented trig yet for 8 bit PICs as it hasn't come up in that form yet. However, I'd do that with a lookup table where a full circle is represented as a power of 2. The lookup table contains one quadrant of a sine. The high bit of the angle then specifies whether to negate the result, and the next lower bit which direction to index into the table. Th= e table would have 2**N intervals, so the next N lower angle bits identify th= e first table entry and the remaining lower angle bits the interpolation fraction. --_003_000d01cbe0ccb5a4d5a00300a8c0main_ Content-Type: text/plain; name="fp24.txt" Content-Description: fp24.txt Content-Disposition: attachment; filename="fp24.txt"; size=2515; creation-date="Sat, 12 Mar 2011 07:51:05 GMT"; modification-date="Sat, 12 Mar 2011 07:51:05 GMT" Content-Transfer-Encoding: base64 OyAgIDI0IGJpdCBmbG9hdGluZyBwb2ludCBmb3JtYXQ6DQo7DQo7ICAgICAyNCBiaXRzIGFyZSB1 c2VkIHRvIGRlc2NyaWJlIGEgZmxvYXRpbmcgcG9pbnQgdmFsdWUgdXNpbmcgMSBzaWduIGJpdA0K OyAgICAgNyBleHBvbmVudCBiaXRzLCBhbmQgMTYgbWFudGlzc2EgYml0cyBhcyBmb2xsb3dzOg0K Ow0KOyAgICAgfCAgICAgICAgIGJ5dGUgMiAgICAgICAgfCAgICAgICAgIGJ5dGUgMSAgICAgICAg fCAgICAgICAgIGJ5dGUgMCAgICAgICAgfA0KOyAgICAgfCAgICAgICAgICAgfCAgICAgICAgICAg fCAgICAgICAgICAgfCAgICAgICAgICAgfCAgICAgICAgICAgfCAgICAgICAgICAgfA0KOyAgICAg IDIzIDIyIDIxIDIwIDE5IDE4IDE3IDE2IDE1IDE0IDEzIDEyIDExIDEwICA5ICA4ICA3ICA2ICA1 ICA0ICAzICAyICAxICAwDQo7ICAgICAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCjsgICAgIHwgIHwgICAgICAg ICAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIHwNCjsgICAgIHwgU3wgICAgICBFWFAgICAgICAgICAgIHwgICAgICAgICAgICAgICAgICAg TUFOVCAgICAgICAgICAgICAgICAgICAgICAgIHwNCjsgICAgIHwgIHwgICAgICAgICAgICAgICAg ICAgIHwgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHwNCjsg ICAgIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLQ0KOw0KOyAgICAgUyAgLSAgU2lnbiBiaXQuICAwIGZvciBwb3Np dGl2ZSBvciB6ZXJvIHZhbHVlLCAxIGZvciBuZWdhdGl2ZSB2YWx1ZS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plain; name="ATT00001.txt" Content-Description: ATT00001.txt Content-Disposition: attachment; filename="ATT00001.txt"; size=208; creation-date="Sat, 12 Mar 2011 07:51:05 GMT"; modification-date="Sat, 12 Mar 2011 07:51:05 GMT" Content-Transfer-Encoding: base64 LS0gDQpodHRwOi8vd3d3LnBpY2xpc3QuY29tIFBJQy9TWCBGQVEgJiBsaXN0IGFyY2hpdmUNClZp ZXcvY2hhbmdlIHlvdXIgbWVtYmVyc2hpcCBvcHRpb25zIGF0DQpodHRwOi8vbWFpbG1hbi5taXQu ZWR1L21haWxtYW4vbGlzdGluZm8vcGljbGlzdA0K --_003_000d01cbe0ccb5a4d5a00300a8c0main_-- .