View previous topic :: View next topic |
Author |
Message |
stevenlkz
Joined: 05 Jun 2005 Posts: 5
|
Can PIC16F877 do floating point math? |
Posted: Sun Jun 05, 2005 9:33 pm |
|
|
Hello everyone! Im doing my final project about intelligent traffic system with fuzzy logic that need to build into PIC16F877. But I face a problem that is there are no multiply, divide, square and square root instruction with MPlab. Another problem is I need to do the math in floating point. How can I solve it? Any advices and suggestions do u all can give me?
Thanks for spending your time. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sun Jun 05, 2005 11:53 pm |
|
|
There are no asm instructions but the functionality can be accomplished through asm routines or even better yet let the C compiler do it for you and write it in C. And yes, you can do floating point math. |
|
|
valemike Guest
|
|
Posted: Mon Jun 06, 2005 7:18 am |
|
|
I see you are using MPLAB. Since you cannot use MPLAB in debug mode to reliably interpret CCS's float values, I suggest you allocate pins RC6 and RC7 for RS232 and dump your values to Hyperterminal.
Only the full CCS IDE or printf() to your RS232 will be the only means to see the results of your floating point calculations. |
|
|
stevenlkz
Joined: 05 Jun 2005 Posts: 5
|
|
Posted: Tue Jun 07, 2005 10:21 pm |
|
|
I know that C can do it, but I don't has C compiler, so I just can write in asm. My lecturer also want me to build in PIC16F877, can't send to PC. |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Wed Jun 08, 2005 6:51 am |
|
|
valemike wrote: | I see you are using MPLAB. Since you cannot use MPLAB in debug mode to reliably interpret CCS's float values, I suggest you allocate pins RC6 and RC7 for RS232 and dump your values to Hyperterminal. |
This is wrong.
See:
http://www.ccsinfo.com/faq/?52 |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Wed Jun 08, 2005 7:02 am |
|
|
stevenlkz wrote: | I know that C can do it, but I don't has C compiler, so I just can write in asm. My lecturer also want me to build in PIC16F877, can't send to PC. |
Have you checked out the demo version for your needs?
http://www.ccsinfo.com/demo.shtml _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Wed Jun 08, 2005 7:22 am |
|
|
Well if you can do it in C then obviously you can do it in asm since that is what the C compiler ultimately generates. Microchip has math routines on their website. |
|
|
RobM
Joined: 29 Apr 2005 Posts: 13 Location: Santa Cruz, CA
|
|
Posted: Fri Jun 10, 2005 10:43 am |
|
|
stevenlkz wrote: | I know that C can do it, but I don't has C compiler, so I just can write in asm. My lecturer also want me to build in PIC16F877, can't send to PC. |
You can and should use the PC for development. Connecting a serial port for this purpose is a valuable debug tool. _________________ Rob
_______ |
|
|
stevenlkz
Joined: 05 Jun 2005 Posts: 5
|
|
Posted: Sat Jun 11, 2005 10:58 pm |
|
|
rwyoung wrote: | stevenlkz wrote: | I know that C can do it, but I don't has C compiler, so I just can write in asm. My lecturer also want me to build in PIC16F877, can't send to PC. |
Have you checked out the demo version for your needs?
http://www.ccsinfo.com/demo.shtml |
Is the demo can compile out a Hex file? Or have other compiler other than mplab that can compile out Hex file and suitable for me to do the math operation like multiply or divide? Because the all write only can build the PIC with Hex file. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Jun 11, 2005 11:14 pm |
|
|
I have no idea what you just said but
The C compiler generates a hex file.
MPLAB is an IDE that can be used with the C compiler.
The hex file generated by the compiler can be used with just about any programmer that will program a PIC. |
|
|
|