Thread: is this program simpler than it looks/sounds? Can someone give me pseudo-code?

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    42

    is this program simpler than it looks/sounds? Can someone give me pseudo-code?

    or start me off...it's getting near finals and I just do not have time anymore.


    The table below is taken from real live hardware and a HUMIREL sensor, which has the ability to read the temperature and the humidity. We will only be dealing with the temperature, however. The table relates temperature in degrees C and voltage in millivolts. What actually happens is that the voltage will be determined by some other code reading an A/D (analog to digital) converter and then passed to your program to determine the temperature to the nearest ½ degree. Note that the table is in 1 degree increments!

    Your assignment is to write a program so that the user can input the voltage from the A/D in milli-volts (mv) and then your program must spit out the temperature to the nearest ½ degree.

    // "Ambient Temperature Sensor October 8, 2007"
    // Resistance values taken from Humirel data sheet for the HTF3227LF Temperature and Humidity Module

    // Vout mv Temp Deg C


    2402 -10
    2397 -9
    2392 -8
    2387 -7
    2382 -6
    2376 -5
    2370 -4
    2364 -3

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Dom View Post
    or start me off...it's getting near finals and I just do not have time anymore.

    Well, we're not here to do your homework for you... so you can foget that right away.

    Yes your program is very simple... a lookup table and not much more.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    You should look into interpolation: Interpolation - Wikipedia, the free encyclopedia. In your case, linear interpolation should be sufficient. It's quite simple, but I doubt anybody here really has the time or desire to write anything for you simple because you're going into finals. Many of us have "done our time" in school, and time management is a great lesson to learn. We all have our own stuff to do: jobs, families, school of our own (as student or teacher). I can guarantee you, however, that if you make a effort to do this yourself, and post your attempt here, you will get help sorting out any issues or correcting it. To get you started, define a function that takes the millivolts from the sensor as an int parameter, and returns a float corresponding to the temp to the nearest 1/2 degree.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    Looks like on average there are 5.42857... millivolts per degree. So that would give you a simple formula. Will the range of millivolts be outside of the given range 2364 to 2402? If so then things will get inaccurate because such sensors are rarely linear.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pseudo Code (Please Help)
    By slimdime in forum C++ Programming
    Replies: 1
    Last Post: 09-05-2010, 09:47 AM
  2. pseudo-code
    By Seb in forum C Programming
    Replies: 7
    Last Post: 04-27-2009, 01:36 PM
  3. producing c/c++ code from flowcharts,pseudo code , algorithims
    By rohit83.ken in forum C++ Programming
    Replies: 3
    Last Post: 02-20-2008, 07:09 AM
  4. what is pseudo-code
    By The_Master in forum C++ Programming
    Replies: 2
    Last Post: 12-09-2006, 06:53 AM
  5. Replies: 1
    Last Post: 10-01-2001, 10:39 AM