Floating point kit for PIC
Submitted By:
WEBMASTER
Rating:





(
Rate It)
NOTE: Some downloads must be obtained through publishers´s site.
Do you want to get your software listed on this site? Go to our
submissions area.
Screenshot
Details
Number of downloads:
6016
Comments (1)
Excellent - only one bug found, easily fixed




Posted by: mechie on Thursday, April 15, 2004
Using FP32_12.A16 v1.12 originally on a PIC16F84 but now ported to 16F870 - needed extra memory (for my bloated application code)!, I found it easy to port and easy to understand - Very well commented !!
There is a bug in the float -to- integer routine, INT32, if the de-biassed exponent is an integer multiple of 8 the routine does a 'RRF' 255 times, trashing the number to zero.
The following snippet shows the 'simple fix' add 4 lines to beginning of SHIFT32
SHIFT32 MOVF EXP, W
SUBLW 0 ; check for zero remaining
BTFSC _Z
GOTO SHIFT32OK ; if zero already
BCF _C
RRF ACC+B0 ; right shift by EXP
RRF ACC+B1
RRF ACC+B2
DECFSZ EXP
GOTO SHIFT32
SHIFT32OK BTFSC FPFLAGS,RND
Add Your Rating