Author Topic: Example #8 in Part two  (Read 10993 times)

Fernandz

  • Newbie
  • Posts: 10
    • View Profile
Example #8 in Part two
« on: March 02, 2003, 01:48:08 PM »
In part two example #8 the H.V.A.C application you show two formulas to convert ADC input to temp. S=ADC(5)*(300-160)/4096*160 and T=ADC(1)*(500+100)/4096-100. What is the reason for subtracting the temp range in the first formula and then adding the 160, and on the second formula adding the range and subtracting 100?
   My second question is im using a thermister (3,000Ohms @77 deg.F) connected to a simple voltage divider circuit. I would like to convert the 0 to 5 volt analog signal to a temperture ( 0 volts would be about 100 deg.f @ around 1900 Ohms and 5 volts would be about 60 deg. F @ around 4600 Ohms)
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Example #8 in Part two
« Reply #1 on: March 04, 2003, 10:15:56 AM »
That is to scale the input so that they translate into the temperature range of interest. Since 0 represent the lowest temperature (16.0 C) and fullscale  (4096)represents the maximum set value = 30.0 C, the actual range that ADC input represents is = (30.0-16.0) =14.0 degree. The formula will then take an input values between 0 and 4096 and scale it to 160 to 300.

E.g. if ADC(5) = 0, the formula translate to:

   S = 0 + 160  = 160   ' represent 16.0 degree

if ADC(5) = 2048,

   S = 2048*(140)/4096+160 = 230  'represent 23.0.

if ADC(5) = 4096,

   S = 4096*(140)/4096+160 = 300   'represents 30.0

(Note that in real life ADC the fullscale will never be reached. The maximum reachable value is 4092 for M-series PLC).

Due to use of Integer math and not floating point math, the mulitplication has to be carried out before the division so that the computation will not be trancated.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS