Multi-digit word variable to string


Closed Thread
Results 1 to 40 of 44

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,646


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    it could be the chip is not really i2c and behaves differently

    try this, at least its a nicer transaction
    i2cwrite SDA, SCL, addr,[7]
    i2cread SDA, SCL, addr,[TEMP.lowbyte, TEMP.highbyte]



    looking at the wiki link you posted, this would do exactly what the smbus timing diagram describes as a proceedure

    PEC var byte
    i2cread SDA, SCL,addr,reg,[temp.lowbyte,temp.highbyte,PEC] ' reg = $07 ;would be the normal pbp way

    worth trying
    Last edited by richard; - 19th December 2021 at 13:13. Reason: wiki
    Warning I'm not a teacher

  2. #2
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Hi Richard,

    sure i'll try that, and i will try to figure out what is going on with a logic analyzer.

    I have a saleae logic 8.

    Will try that later today. Many thanks for your time once again.

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


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    If there is only one MLX90614 sensor, the 7-bits address is 0x00 by default.
    according to wiki addr =0 where did you get B4 from ?

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,134


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    If the chip is the MAX30102, on page 16 seems that reading needs first a write.

    Ioannis

  5. #5
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Quote Originally Posted by Ioannis View Post
    If the chip is the MAX30102, on page 16 seems that reading needs first a write.

    Ioannis
    it is an IR MLX90614

  6. #6
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Applying the 0x00 is not working.

    When i add back the B4 or B5 for write or read mode correspondingly, everything is in a working order again.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,646


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Its hard to work with crappy information


    Name:  LEO.jpg
Views: 1127
Size:  86.1 KB

    i2cread SDA, SCL,$b4,7,[temp.lowbyte,temp.highbyte,PEC] will do exactly that


    i just realized that what code you posted is in fact a snippet .
    addr and reg are never defined , osc is unknown ,i2c defines unknown, pin settings and i2c pull ups ...........

    could be another waste of time
    Warning I'm not a teacher

  8. #8
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Richard,

    i have thanked you so many times for your effort and help.

    I think i have attached in the code most of the information required.

    You have helped me in the first major issue i had with the right values and the command needed inside the HSEROUT.

    Then we moved to I2C command. I think there i have shared the reg and addr values. For the SCL and SDA i dont think that is necessary at all to post which port is or not.

    Anyway, now the code is working just fine and i need once again to thank you all for your help and time.

    Once again Richard. Life is simpler and shorter than we all think. Smile because you have the knowledge in this field to help people.

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,646


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    Quote Originally Posted by richard View Post
    Its hard to work with crappy information
    could be another waste of time
    and it was

    I had the
    reg var Word
    I think i've seen it as a comment somewhere here in the forum.
    a classic case of monkey see monkey do programming error hidden away by use of snippets
    days wasted, hundreds of posts to solve an elementary error.

    i would not be surprised to find there is still one more major issue for the i2c settings still not addressed
    for this precious secret code . i hope this is not a medical diagnostic device

  10. #10
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Multi-digit word variable to string

    wait a sec,

    im reading the manual again from the SENSOR

    https://www.waveshare.com/w/upload/e/e4/MLX90614-EN.pdf

    Name:  ir sensor 2.png
Views: 1148
Size:  92.8 KB
    Last edited by astanapane; - 19th December 2021 at 13:54.

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