Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

micro controller for finding ratio

Status
Not open for further replies.

Baalu

Newbie level 3
Joined
Jun 20, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
Hi

I wanted to find the ratio of a set of no:s using a microcontroller.
eg 30.5/16.8 = 1.8
Data is received by an SPI and transmitted through an USART.

Can anyone suggest a suitable microcontroller, preferable with lesser no; of cycles per division
 

Baalu

Newbie level 3
Joined
Jun 20, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
Thanks for the reply.

I am planning to use PIC/dsPIC for my application.

But I haven't worked in microcontrollers before. From the datasheets of a few PICs I have seen they are capable of giving only an integer result.So if I need, for eg: 30/4..can i get the result as result= 7.5 rather than Quotient = 7 and reminder = 2? Can dsPIC30x or PIC24x give the required result as a floating point number?
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
most microcontroller compilers and libraries have float variables with, if the device does not have floating point hardware, the float calculations done in software. This is the case with the PIC24 and dsPIC. also you can print float and double results using printf() etc
Code:
  float x = 30/4.0f;
  printf("%f\n", x);
would give a float result 7.5

if you are looking for a more sophisticated (and expensive) development board the Microchip Explorer 16 is good
Explorer 16 Development Board

if can take PIC24, dsPIC and PIC32 PIMs and a range of daughter boards can be plugged in
PICDEM - PICtail Plus
 
Last edited:
  • Like
Reactions: Baalu

    Baalu

    points: 2
    Helpful Answer Positive Rating

Baalu

Newbie level 3
Joined
Jun 20, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
Is there a corresponding code in assembly language. How is it stored in the memory?
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top