8051 Microcontroller Help??

Discussion in 'Embedded Systems and Microcontrollers' started by dogar sahab, Nov 15, 2008.

  1. dogar sahab

    Thread Starter Active Member

    Mar 15, 2008
    I am going to make project which is TEMPERATURE MONITOR UNIT and its display on 7-segment display through microcontroller!!!
    All is done and I am going to make a C program for microcontroller!!I have to consider three factors while programming..I am goin to control 3 things through microcontroller..
    1-ADC(I am using external ADC IC)
    2-Motor to drive fan whose speed varies according to the temperature which is sensed through temperature sensor!!
    3-Seven segment display for displaying the temperature!!!
    So I want to take suggestions from you as to what factors I should keep in mind while programming!!??I 'll also write the modules here once I complete them..
    So plz suggest...
  2. RiJoRI

    Well-Known Member

    Aug 15, 2007
    First, I would look around at sites like 8052.com. They probably have quite a few programs or pieces of code for reading ADC chips, PWM for the motor, and 7-segment display drivers.

    I would also test one piece of code at a time. Get the A/D converter working first. Use a variable resistor to simulate temperature changes. Don't forget to filter the data. Consider some type of hysteresis, also, so that your fan is not going faster-then-slower-then-faster repeatedly. Also remember that your sensor will probably NOT be linear. Check the data sheets.

    Do you want some type of intelligence in your software? That is, if the temperature is rising rapidly, do you want the fan to run faster than it normally would? That is, if you have determined that a "normal" temperature rise is one degree per minute, but the temperature is rising at three degrees per minute, should the fan run faster to cool down the whatever-it-is you are cooling more rapidly?

    Also, if you are doing this for a large area, consider thermal inertia.

    You probably won't need floating point calculations. Read the temperature, round it to the nearest fraction -- let's say the nearest tenth -- and do all your calculations with "deci-degrees".

    Next I would write the LED driver. I'd use multiplexing for the display. THis way I could test how the display shows the temperature, still using a pot (variable resistor) for testing.

    After that, the fan PWM code, and now use the pot input to the ADC for testing the PWM output. Get an oscilloscope, and make sure the PWM is working correctly.
    I would then hook up the fan, and test it with the pot to the ADC, and finally test the ADC with the sensor itself.

    Once this is done, you will need to fine-tune your code so that the 805 is working the way you want it to.

    And do not forget screw-ups: what to do if the temperature shows it is -50 degrees F and you are in the desert at noon? That kind of thing.

  3. dogar sahab

    Thread Starter Active Member

    Mar 15, 2008
    ^I am finding difficult to program for PWM!!!
    and plz elaborate somewhat about multiplexing!!!!
  4. Papabravo


    Feb 24, 2006
    Multiplexing of LED segments means only having one digit on at a time. Let's say you have four digits and each one is on for 50 msec. So it takes 200 msec to light all four digits. Then you do it all over again. This takes 7 segment lines and 4 digit lines for a total of 11 lines. The alternative woud be 7 segment lines and a digit line for each digit times 4 for a total of 28 lines.

    Look up "charlieplexing" for an even more exotic arrangement.
  5. dogar sahab

    Thread Starter Active Member

    Mar 15, 2008
    and how to develop algorithem for programming for PWM!!!