HMC6352 and PROPBASIC
denno
Posts: 223
in Propeller 1
Has anyone written a PROPBASIC program to run the HMC6352 compass module...?
DennO
DennO
Comments
1. what is the ACKBITVALUE
2. what is the ACKBITVAR
3. and, I cannot seem to put more then "one" GOSUB in a DO/LOOP, with getting the error MESSAGE of "SUN OR FUNCTION CANNOT BE NESTED". In other words, one GOSUB in a loop will work, but two or more GOSUB's will not....
4. Where should I put the I2SPEED command to slow down the PROP...
Do you have any examples of code..
Thank you...DennO
2. ACKBITVAR is a variable that receives the ack bit from the slave (0 or 1). Again normally it is 0.
3. You do not need GOSUB, just put the subroutine name. You are probably using SUB when you are calling. Don't do that...
4. If you use the built-in I2C commands they will run at the proper speed.
Looking at the datasheet you just send a "A" then wait a bit and read back two bytes.
I2CStart
I2CWrite $42
I2CWrite 65
I2CStop
PAUSE 10
I2CStart
I2CWrite $43
I2CRead
I2CRead
I2CStop
Bean
I would like to add that I do know that the MC6352 that I am using is good, as it runs perfect on the BS2. The above code loads with no errors, and the "screen output" only shows a "2" and then a "208", with no change when the HMC6352 is rotated.
ANybody, any thoughts...DennO
Bean