Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Mathematical calculation

Status
Not open for further replies.

amindzo

Member
Hi, how can i calculate this formula with picbasic?

RH(linear)= -2.0468+(0.0367*SORH)-(SORH*SORH*1.5955e-6)

SORH is a 12 bit data that is given from sensor. i should put that data in above formula to calculate the humidity in %. how should i write the code?
 
I don't know if picbasic supports floating point. I can only give you a general hint.
Convert the formula to deal with integers only. Multiply both sides of equation with some integer value in order to get rid of fractional values. Once you have only integer multiplications and additions then you will probably know how to proceed. Finally, you finish with integer division.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top