Hi,
I am trying the sdcc 2.9.0 for the PIC16F876A device. I have found
that the floating point operations are not working well when negative
numbers are used.
The following example works ok:
#include <pic16f876a.h>
#include <float.h>
volatile float test;
void main(void)
{
TRISB=0x00;
test=1;
PORTB=(unsigned char)(test+2);
while(1);
}
There is an 8-led board connected to the port B. When this program is
executed the number 3 (in binary) is shown.
But if the test variable is assigned to the number -1, it does not work.
The following code does not work. The number 1 should be showed, but all
the leds are off
#include <pic16f876a.h>
#include <float.h>
volatile float test;
void main(void)
{
TRISB=0x00;
test=-1;
PORTB=(unsigned char)(test+2);
while(1);
}
If the test variable is declared as int, it works. So, it seems there
is a problems with negative floating points.
The program is compiled like this:
sdcc -Wl-m -Wl-ainhx8m -mpic14 -p16f876a -o float-error float-error.c
Is this a known bug? Has anyone tested the floating point support for
the pic14?
Thanks
Best regards, Juan
--
Juan Gonzalez Gomez
Blog: http://www.iearobotics.com/blog/
Web : http://www.iearobotics.com/juan
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user