go_away

Author Topic: Floating Point in Assembly  (Read 2206 times)

0 Members and 1 Guest are viewing this topic.

Offline z.s.tar.gzTopic starter

  • Supreme Robot
  • *****
  • Posts: 540
  • Helpful? 5
  • Linux Guru
Floating Point in Assembly
« on: October 17, 2009, 10:46:58 AM »
Can it be done? I really just need to work with decimals, but floating point would be pretty awesome.
Save yourself the typing. Just call me Zach.

Offline chelmi

  • Supreme Robot
  • *****
  • Posts: 496
  • Helpful? 15
Re: Floating Point in Assembly
« Reply #1 on: October 17, 2009, 11:36:16 AM »
We need more details...
Which micro-controller are you using?

ATmegas does not have a floating point unit, but there is an emulation library (slow and takes a lot of memory space).
I don't know of any micro-controller with a FPU, even the big ARM-based (STM32, AT91SAM*).
If you really need floating point, you can still get an external FPU co-processor like this one http://www.sparkfun.com/commerce/product_info.php?products_id=8129

Chelmi.

Offline z.s.tar.gzTopic starter

  • Supreme Robot
  • *****
  • Posts: 540
  • Helpful? 5
  • Linux Guru
Re: Floating Point in Assembly
« Reply #2 on: October 17, 2009, 03:23:19 PM »
I'm probably going to have to go with a coprocessor as I'm using an atmega 644. How can you have a decimal in binary anyways?
Save yourself the typing. Just call me Zach.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,943
  • Helpful? 98
Re: Floating Point in Assembly
« Reply #3 on: October 17, 2009, 07:56:50 PM »
Yes, it can be done without a float point unit. I had a fixed point and a floating point library written in assembler for a Z80 processor back in the early '80s. And NASA certainly used floating point back back in the '60's that was written in assembler.  MicroChip has a floating point library for their mid-range PICs.  
It can be written in assembler as the on for the PICs, which may be a good place to start, port the PIC code to the processor you're using. Here is a link to the PIC libraries:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1469

Fixed point is easier to write and may be enough for your application. Worth looking into.
« Last Edit: October 17, 2009, 08:00:27 PM by waltr »

Offline z.s.tar.gzTopic starter

  • Supreme Robot
  • *****
  • Posts: 540
  • Helpful? 5
  • Linux Guru
Re: Floating Point in Assembly
« Reply #4 on: October 19, 2009, 03:57:19 PM »
Thanks. If push comes to shove I can just make a big lookup table.

Edit: That's what I think I'm going to do, as it seems to be the best for my application.
« Last Edit: October 26, 2009, 05:27:59 AM by z.s.tar.gz »
Save yourself the typing. Just call me Zach.

 


Get Your Ad Here

data_list