
Originally Posted by
richard
not really
addr is the i2c device address , reg is the register you are accessing. that example you refer is for an eeprom
where those words make a little sense, in this context they are totally misleading
once again you are right. I will change the names in the code as well.
One more question. What is the difference on the following?
With the [] and without them. I noticed that i get completely different results. The ones with the [] looks like is the right one as once i place them, i can control the values of the LED's pulse amplidute. Now it is visible the difference.
Code:
addr = $09 ' MODE CONFIGURATION
i2cwrite SDA,scl,contwr,addr,[%00000011],error ' ModLED = $02 as per data sheet heart rate mode, $03 SpO2 mode
pause 10
addr = $0A ' SpO2 mode configuration
i2cwrite SDA,scl,contwr,addr,[%01111101],error ' check the manual for this configuration
pause 100
addr = $0C 'LED PULSE AMLIDUDE FOR for LED1_PA[7:0] 0x0C
i2cwrite SDA,scl,Contwr,addr,[$03],error' if LED1_PA = $3F , 12.6 mA , ($7F is 25.4 mA)
pause 10
addr = $0D 'LED PULSE AMLIDUDE FOR LED2_PA[7:0] 0x0D
i2cwrite SDA,scl,contwr,addr,[$03],error ' if LED2_PA = $1F , 6.2 mA , ($7F is 25.4 mA)
pause 10
and the following:
Code:
addr = $09 ' MODE CONFIGURATION
i2cwrite SDA,scl,contwr,addr,%00000011,error ' ModLED = $02 as per data sheet heart rate mode, $03 SpO2 mode
pause 10
addr = $0A ' SpO2 mode configuration
i2cwrite SDA,scl,contwr,addr,%01111101,error ' check the manual for this configuration
pause 100
addr = $0C 'LED PULSE AMLIDUDE FOR for LED1_PA[7:0] 0x0C
i2cwrite SDA,scl,Contwr,addr,$03,error' if LED1_PA = $3F , 12.6 mA , ($7F is 25.4 mA)
pause 10
addr = $0D 'LED PULSE AMLIDUDE FOR LED2_PA[7:0] 0x0D
i2cwrite SDA,scl,contwr,addr,$03,error ' if LED2_PA = $1F , 6.2 mA , ($7F is 25.4 mA)
pause 10
Bookmarks