LIN_TRAFO Scaling function

Shohadawy
2009-12-21
2010-02-02
  • Shohadawy - 2009-12-21

    I'm using a pressure sensor that outputs 4-20mA related to a pressure of 0-250 bar. There is an example for a sensor in the manual which states that I should put the sensor range "4-20 mA" in the IN_MIN and IN_MAX respectively.I tried this but I got great errors in the reading

    The resolution of the A/D of the DUO PLC is 12 bits, shall I put 0 in the IN_MIN and 4095 in the IN_MAX

    Waiting for your reply.

     
  • TimvH

    TimvH - 2010-01-12

    In ST you could do it like this:

    Pressure := analogValue * 250 / 4095;

     
  • shooter - 2010-02-02

    this answer is wrong

    the bits are in different place.

    check your analog card for this, mine begin at 7 (bits are shifted) and stop at 4095-7.

    to scale use simple math like y=a+bx

    b = 250/ 4081

    and a=0 for a normal 4/20 mA card.

    stay as long as possible in INTeger for speed calcs.

     

Log in to post a comment.