CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Can PIC16F877 do floating point math?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stevenlkz



Joined: 05 Jun 2005
Posts: 5

View user's profile Send private message

Can PIC16F877 do floating point math?
PostPosted: Sun Jun 05, 2005 9:33 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Sun Jun 05, 2005 11:53 pm     Reply with quote

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







PostPosted: Mon Jun 06, 2005 7:18 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Jun 07, 2005 10:21 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 08, 2005 6:51 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 08, 2005 7:02 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Wed Jun 08, 2005 7:22 am     Reply with quote

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. Razz Microchip has math routines on their website.
RobM



Joined: 29 Apr 2005
Posts: 13
Location: Santa Cruz, CA

View user's profile Send private message

PostPosted: Fri Jun 10, 2005 10:43 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jun 11, 2005 10:58 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Sat Jun 11, 2005 11:14 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group