Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/02/08 21:38
Read: times


 
#154321 - Floating Point Routine Listed
Hello Group -

I have downloaded the Floating Point Routine (http://8052.com/codelib/float51.asm) to use on an 8051 micro (P89C668). I am having a problem compiling it using Keil IDE.

What I am trying to do:
-I will have a 24/25 bit number and need to divide this number by 12,700.

(Basically, my Micro is reading an Digital Encoder and it takes this 24/25 bit output and then divides it by 12,700 to get a reading in Displacement)

I will be using the "Floating Point Divide" sub included in the routine. But I do not understand how to pass the arguments to this function.

Let's use an example: I want to divide 148,000 / 12,700. (This equals 11.65354 inches) (Output from encoder = 148,000)

-How do I pass these numbers to the function?
-Where is my result located?
Please explain how to use...

(Since I could not compile the code because of the following errors, I simply created RAM locations for the below variables)

My Code:
=======

 float_arg	  equ    31h
  Aarg		  equ    34h
  Barg		  equ    39h
  expbias	  equ	 3dh
  Bexp            equ    40h
  Aexp		  equ    43h
  Quo             equ    46h
  arg             equ    49h
  Aext2           equ    4ch
  Aext            equ    4fh 


Errors when compiling are from the following lines:
===================================================

float_arg	equ	3	;3 bytes mantissa
float_exp	equ	1	;1 byte exponent
expbias		equ	128	;exponent bias

Quo:	ds	float_arg	;holds quotient of divide
Aarg:	ds	float_arg
Aexp:	ds	float_exp
Barg:	ds	float_arg
Bexp:	ds	float_exp
Aext:	ds	1		;extension for Aarg
Aext2:	ds	1		;for holding the aligned bit 


Thank You very much in advance!

Robert


List of 9 messages in thread
TopicAuthorDate
Floating Point Routine Listed            01/01/70 00:00      
   Contact Jerson            01/01/70 00:00      
   Floating Point Routine Listed            01/01/70 00:00      
      Replied to personal email            01/01/70 00:00      
   Floating Point Routine Listed            01/01/70 00:00      
      You\'re almost there            01/01/70 00:00      
         Floating Point Routine Listed            01/01/70 00:00      
            No - I COUNTRY            01/01/70 00:00      
               Floating Point Routine Listed            01/01/70 00:00      

Back to Subject List