Thanks for the reply.
do you mean that i cannot use the following format?
Code:DataPin var LATC.1 ClockPin var LATC.2
Thanks for the reply.
do you mean that i cannot use the following format?
Code:DataPin var LATC.1 ClockPin var LATC.2
if that will become
I2CREAD DataPin, ClockPin, Control,{Address,}[Var{,Var...}]{,Label}
then yes that is not allowable and will cause difficult to determine bugs.
you have to remember pbp is ancient technology, latx registers did not exist when it was created
it never gets any significant updates
Last edited by richard; - 17th August 2020 at 15:06.
Warning I'm not a teacher
It is a bit consfusing for me.
But i will try to figure it out.
My goal is to communicate with this heart sensor. First step is to send this command to light up the LED and then try to read the information needed.
I have tried this I2C ping program http://www.picbasic.co.uk/forum/showthread.php?t=20185, in order to see if the sensor responds with the ACK. (i though that the sensor was dead)
this i2c sniffer will usually do the job
Code:DEFINE I2C_SLOW 1 anselA=0 'dig i/o ANSELC=0 TRISC= %11111111 TRISA= %11111110 SCL var Portc.1 ' I2C Clock PortA.3 SDA var Portc.0 ' I2C Data PortA.2 I VAR BYTE addr var byte rd var byte porta.0=1 DEFINE DEBUG_REG PORTA DEFINE DEBUG_BIT 0 ; if not used for pwr DEFINE DEBUG_BAUD 38400 DEFINE DEBUG_MODE 0 pause 2000 Debug "Start",13 ,10 addr=0 for I = $02 to $fe step 2 I2Cread SDA,SCL,i,addr,[rd] ; or I2Cread SDA,SCL,i,[rd] ; Debug "found addr ",#i , 13,10 nak: Next I end
Last edited by richard; - 18th August 2020 at 01:32.
Warning I'm not a teacher
thanks for the book.
on the other hand, i would like to continue with this project as it is important for me and the kids in school.
I have done the first attempt to communicate with the sensor but no luck.
Based on the Datasheet MAX30102, device address, or slave id: %1010111, consists of 7 bit, B7-B1,and the MSB-7 is transmitted first followed by the remaining bits. B0 is LSB which can be 0 if we write or 1 if we read.
Then again from the manual explains that for the first write operation, we send the slave id as the first byte!....followed by the register address byte and then one or more data.
From the PBP manual, and from this link http://www.picbasic.co.uk/forum/cont...-EEPROM-Part-1
It is clear that I2CWRITE and I2CREAD command takes care of the write or read bit, also for the ACK.
Now i have tried to send the following:
if PBP and command I2CWRITE takes care of the 8th bit then how could i manage to correspond it in the code.
If i send the above command nothing will happen, and the data line will be offset from the clock.Code:i2cwrite sda,scl,%1010111,$04,error ' this is slave id cosnist of 7 bits.
Now using the following code:
i get this on the scope:Code:i2cwrite sda,scl,%10101110,$04,error
then i tried the following:
and the result on the scope: it looks strange again.Code:i2cwrite sda,scl,%10101110,$04,error pause 100 i2cwrite sda,scl,%10101110,$04,error
![]()
Bookmarks