Scaling and offset of a sensor


Results 1 to 6 of 6

Threaded View

  1. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Scaling and offset of a sensor

    I think I got it.

    My sensor is read at channel 0. So:

    Code:
    offset    var    word
    sensor    var    word
    
    offset_store:         'offset processing
        adcin 0,offset
        write 0,word offset
    return
    
    read_pressure:
        adcin 0,sensor
        sensor=sensor-offset
        sensor=sensor*1023/(1023-offset)
    return
    the problem is how to manage the sensor*1023 since the result might be more than a word and I'd prefer not to use LONG.

    But the 1023/(1023-offset) ends up in a small number like 1.62 or similar. It is not known untill the offset is measured and cannot be substituted as a constant and use */ operator.

    Ioannis
    Last edited by Ioannis; - 13th March 2023 at 20:08.

Similar Threads

  1. Help with scaling math..
    By ardhuru in forum General
    Replies: 4
    Last Post: - 15th May 2017, 23:41
  2. Offset to variable howto ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 3rd October 2008, 09:36
  3. Scaling ADC values
    By purkolator in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th November 2007, 05:14
  4. Help scaling voltage...
    By sirvo in forum Schematics
    Replies: 6
    Last Post: - 30th July 2007, 19:35
  5. Need help with scaling
    By champion in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 13th November 2006, 03:20

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts