Having trouble with SERIN command and MAX6675


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: it's working... but bit-shifting not clear to me :-(

    Unless you are trying to get the fractional part of the reading 10 bits is all you need.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: it's working... but bit-shifting not clear to me :-(

    Quote Originally Posted by mackrackit View Post
    Unless you are trying to get the fractional part of the reading 10 bits is all you need.
    I don't get it, Dave...
    Roger

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    why do I have to shift by "2" instead of what has been said above (shift by 3) or even shift by 1 since bit 14 is the second bit to start with?
    the data can be read in msb first by shiftin but it is then translated to a normal binary representation so bit 14 is read as bit 14.

    shifting by 2 is incorrect , as dave indicated
    Temp = RawTemp >> 5
    will get the high 10 bits of the 12bit reading ,resulting in the integer component of the reading

    or

    Temp = RawTemp >> 3
    int_part=temp/4
    fract_part=(temp//4)*25

    lcdout $FE, $C0,"Tmp ", #int_part,".",dec2 fract_part," C"
    Warning I'm not a teacher

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    This is confusing to me.

    My code gives me almost exactly what my home thermometer shows:
    Name:  K640_20170416_132314.JPG
Views: 2140
Size:  80.3 KB

    This code
    Code:
    Temp = RawTemp >> 3
    int_part=temp/4
    fract_part=(temp//4)*25
    lcdout $FE, $C0,"Tmp ", #int_part,".",dec2 fract_part," C"
    display this:
    Name:  K640_20170416_132716.JPG
Views: 1932
Size:  98.7 KB
    Where is the truth?
    Last edited by flotulopex; - 16th April 2017 at 12:42. Reason: typo
    Roger

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    for a start your temp var is a declared as byte , how can 12 bit reading fit in that ?
    Warning I'm not a teacher

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    I corrected my code just after I sent it - couldn't edit the post anymore, should have mentionned it, sorry
    Roger

  7. #7
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    938


    Did you find this post helpful? Yes | No

    Default Re: Having trouble with SERIN command and MAX6675

    Anyway, I understand the calculation to get the temperature value BUT why do I have around 5°C diffrence between the thermocouple and my home thermometer?

    Must a thermocouple be kind of "adjusted" (correct the result in the code) or something like that?
    Roger

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