Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Discussion Groups | Freescale DSPs | fractional number

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

fractional number - bblaundry - Mar 1 19:17:00 2004



Hello All,

I am having trouble working with fractions within my project. I am
using a DSP56F826 chip with Codewarrior tools.

I am trying to create functions that will convert fractional data
(Frac16 and Frac32) into int and long int data.

Does anyone know how to do this either in C or in assembly?

Thanks,

Brad





(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

RE: fractional number - Johnson, Jerry - Mar 1 19:32:00 2004

RE: [motoroladsp] fractional number

Frac16 and Fract32 are representations of the values +1.0 to -1.0 so to convert them to an integer, just multipy them by the range you wish to represent.

For example: to have a range of -100 to 100, multiply the Fractxx value by 100.

Another way to look at this is to think in terms of the following equation:
 Fract = (integer value)/(maximum integer value)

So, multiplying a Fract16 by the maximum integer value yields the represented integer value.

If your range of integer values happens to be +32767 to -32768, then the Fract16 value is the corresponding integer value!!!

Jerry.



-----Original Message-----
From: bblaundry [mailto:b...@microwavedata.com]
Sent: Monday, March 01, 2004 1:17 PM
To: m...@yahoogroups.com
Subject: [motoroladsp] fractional number


Hello All,

I am having trouble working with fractions within my project.  I am
using a DSP56F826 chip with Codewarrior tools.

I am trying to create functions that will convert fractional data
(Frac16 and Frac32) into int and long int data.

Does anyone know how to do this either in C or in assembly?

Thanks,

Brad



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/PNArlB/TM
---------------------------------------------------------------------~->

_____________________________________
/groups.php3
 
Yahoo! Groups Links


 


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information visit http://www.messagelabs.com
________________________________________________________________________


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information visit http://www.messagelabs.com
________________________________________________________________________


(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

RE: fractional number - Estevam Fabio-R49496 - Mar 1 19:32:00 2004

Brad,

Maybe you can use the following macros provided in SDK to assist you in the
conversion from fractional to integer:

#define FRAC16(x) ((Frac16)((x) < 1 ? ((x) >= -1 ? (x)*0x8000 : 0x8000) :
0x7FFF))
#define FRAC32(x) ((Frac32)((x) < 1 ? ((x) >= -1 ? (x)*0x80000000 : 0x80000000)
: 0x7FFFFFFF))

and as an example you can use them as:

UWord16 Int16 = FRAC16(0.25)
UWord32 Int32 = FRAC32(0.75)

Hope this helps.

Best regards,

Fabio Estevam

-----Original Message-----
From: bblaundry [mailto:]
Sent: segunda-feira, 1 de março de 2004 16:17
To:
Subject: [motoroladsp] fractional number Hello All,

I am having trouble working with fractions within my project. I am
using a DSP56F826 chip with Codewarrior tools.

I am trying to create functions that will convert fractional data
(Frac16 and Frac32) into int and long int data.

Does anyone know how to do this either in C or in assembly?

Thanks,

Brad

_____________________________________
/groups.php3

Yahoo! Groups Links




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )