¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Has anyone successfully used the I2C bus from a u4b BASIC program? #u4b #Balloon


 

Hi All:

I'm trying to use a pressure sensor, the MEAS MS5607-02BA with a U4B board - presently in the middle of troubleshooting - right now I'm not seeing any of the contents for the internal ROM calibration coefficients. But - at the same time, I've yet to see that anyone has tried an external sensor connected by I2C to the U4B.

I understand that Hans is already using the I2C bus for the synth and temp sensors. What I am interested in knowing, is if anyone has been able to use I2C for an external sensor from the QDOS BASIC environment and its instruction set. It's very likely I'm making a mistake with my programming. But it would be reassuring to know that at least one person has been able to communicate with an external sensor (especially a pressure sensor) using the I2CW and I2CR commands.

For the MS5607 and at least one other pressure sensor I've looked at, there may be an additional issue in the U4B BASIC environment. The computation of pressure using the calibration data in the sensor ROM, includes some variables which might need to be signed 32 and 64 bit integer. Variables in the U4B environment are unsigned 32 bit.

Here's the code snippet I used to try to read one calibration register in the MS5607:

I2CW 238 0 30????????? (reset the sensor)
I2CW 238 0 160??????? (cmd to access the PROM contents)
LET Z = I2CR 239 0?? (lower 8 bits of cal constant #1)
LET Y = I2CR 239 1?? (upper 8 bits of cal constant #1)
LET A = 256 * Y + Z?? (calc C1 value into variable A)
PRINT "C1 = #VA"

Result was that Z=Y=A=0, which suggests that the read failed.

Steve NU7B

?

Join [email protected] to automatically receive all group messages.