Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

Problem with a math equation (16f877a)

Status
Not open for further replies.

martinisonline

Member level 2
Joined
Apr 24, 2005
Messages
47
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Portugal
Activity points
1,792
Math problem??...16f877a

Hy...

I'm implementing a temperature meter based in the ds1820.
It works great, but now, i 'm trying to do the high resolution mode.

i need to do a math equation that is:

temp = temp_read - 0.25 + (count_per_C - count_remain)/count_per_C

these variables are int. The 'temp' must be float because the division, right?

Can i do a divison of 2 int and return 1 float?

viewing at hyperterminal, the variable 'temp' is always 0...

I am using CCS and 16F877A.

Greats...
 

Re: Math problem??...16f877a

Read Dallas AN105 : **broken link removed**

First page 10 for definition of "res' and "LSB"
Then page 18 for float CalcHiResTemp(int temp9, int count_per_degree, int count_remain)

It's all you need including casting.

Do you want to know why I like more parsing at low level rather than C ?

The answer is tight code and beautiful of math :

**broken link removed**

You still need floating point maths ?
 
Re: Math problem??...16f877a

Information : while(true){ printf("Very");} usefull...:)
Tanks...

Do you want to know why I like more parsing at low level rather than C ?

it's more dificult, but more "inside the question"...:)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top