Heart rate sensor MAX30102


Closed Thread
Results 1 to 40 of 85

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Richard,

    looking at your code,i'm learning lots of things.

    All the registers you have are constants. And that is what i've thought also in the beggining.
    Code:
    ;-----------------------  REGISTER -------------------------
    REG_TEMP_INT         con $1F
    REG_TEMP_FRAC        con $20
    REG_TEMP_CONFIG      con $21
    REG_PART_REVISION    con $FE
    REG_MODE             con $09
    REG_SPO2_CONFIG      con $0A        ;SPO2_ADC_RGE[6:5]SPO2_SR[4:2]LED_PW[1:0]
    REG_LED1_PA          con $0C
    REG_LED2_PA          con $0D
    FIFO_WR_PTR          con $04        ;FIFO_WR_PTR[4:0]
    FIFO_RD_PTR          con $06
    FIFO_DATA            con $07
    FIFO_CONFIG          con $08        ;FIFO_A_FULL[3:0]   SMP_AVE[7:5]
    STATUS1              con 0          ;A_FULL[7]
    
    
    ' -----------------------------------------------------------------------------|
    But in the manual it says that we never use constants for the I2C command.

    What i have realised is that you refer to the

    Code:
    reg var byte
    everytime you need to asign a constant value to it. Is that right? with that way we alter the restriction of using constants. (or am i wrong?)

    Sencod question.

    I see you are always using the Write Address:

    Code:
    ADDR = $ae     ; addr is  0x57 << 1
        reg = REG_PART_REVISION
        i2cread  SDA,scl,ADDR,reg,[REVISION,PARTID]
        reg = REG_MODE 
        i2cwrite  SDA,scl,ADDR,reg,[3] 
        reg = REG_SPO2_CONFIG
        i2cwrite  SDA,scl,ADDR,reg,[$20]
        reg = REG_LED2_PA 
        i2cwrite  SDA,scl,ADDR,reg,[9]
        reg = REG_LED1_PA 
        i2cwrite  SDA,scl,ADDR,reg,[9]
        reg = FIFO_CONFIG  
        i2cwrite  SDA,scl,ADDR,reg,[16]
    even if you want to read from:

    Code:
        reg= REG_TEMP_INT        
        i2cread  sda,scl,ADDR,reg,[fifo[0],fifo[1]]
    im confused here. When do we use the write address and when do we use the read address!!!

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,721


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    But in the manual it says that we never use constants for the I2C command.



    What i have realised is that you refer to the

    Code:
    reg var byte
    everytime you need to asign a constant value to it. Is that right? with that way we alter the restriction of using constants. (or am i wrong?)

    in pbp constants are 16 bit, they are fine in i2c when a 16 bit value is appropriate and the endianness matches
    if you use a var there is never any doubt, you get what you asked for but the endianness must match



    im confused here. When do we use the write address and when do we use the read address!!!
    there is no such thing as write address or read address in pbp there is only the address
    Warning I'm not a teacher

  3. #3
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    there is no such thing as write address or read address in pbp there is only the address
    there is an adress of 7 bits....then PBP is taking care for the Read or Write bit.

    The following is from the manual of the MAX30102.

    Name:  RW address.png
Views: 5345
Size:  7.7 KB

    But in the program under the registers we are using the AE which is related to write address. Isnt it?

    Code:
     ADDR = $ae     ; addr is  0x57 << 1

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,721


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    But in the program under the registers we are using the AE which is related to write address. Isnt it?
    you are trying to create a problem that does not exist there is no such thing as write address or read address in pbp there is only the address
    a pbp i2c address is the 7bit manufacturer's address left shifted 1 bit, the only variation is for crappy ancient eeproms where the "page"
    address forms part of the address[control] , but bit0 is still under pbp control regardless

    you don't quibble the hserout command adding start and stop bits to your serial transmission or even calculating the parity and inserting it also

    Name:  ser.jpg
Views: 5430
Size:  67.8 KB

    why should the i2c "high level" commands not be able to set the r/w bit as required, after all that's why you use pbp. it stops you needing to dig into the bowels of i2c transactions

    the manual

    Name:  i2c.jpg
Views: 4965
Size:  252.6 KB

    lets not hear any more of this nonsense
    Last edited by richard; - 12th January 2022 at 23:57.
    Warning I'm not a teacher

  5. #5
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    Thanks Richard,

    just wanted to understand it. Now it is clear.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,721


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    now have low pass filtering on pic
    Name:  HB2.jpg
Views: 4909
Size:  139.6 KB
    73 rpm tonight
    Warning I'm not a teacher

  7. #7
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: Heart rate sensor MAX30102

    That's really impressed Richard.

    Im still working step by step on the code, im still at an early stage.

    Just need to understand the methodology.

Similar Threads

  1. New PIC failure rate
    By timmers in forum General
    Replies: 5
    Last Post: - 26th March 2009, 12:11
  2. Rf module baud rate
    By tazntex in forum Serial
    Replies: 4
    Last Post: - 5th August 2008, 18:47
  3. Replies: 6
    Last Post: - 18th January 2008, 08:17
  4. SHIFTOUT Clock rate
    By Brock in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th July 2006, 23:42
  5. Detect baud rate
    By Dick M in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd July 2005, 21:10

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