![]() |
Forum Index : Microcontroller and PC projects : Problem with reading I2C
Author | Message | ||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 938 |
Did anyone tested the I2CRCV command with only on Byte and an "normal" variable? I have to communicate with a ISL29023 light-sensor and want to read only one byte. When I use the example "I2CRCV &h6f, 1, 1, avar" (or when I use my address with my variable) I get an error: "Error: Invalid variable" ??? ...but it works very well when I use an array and read my data in only one cell!!?? Doesn't work: I2CRCV &H44, 0, 1, test Work: DIM test(1) I2CRCV &H44, 0, 1, test(0) What's going wrong? THANKS! Frank |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 3998 |
Maybe it requires an array, no matter what result(s). John |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3271 |
It could be because the variable has not been previously used. Try this: test = 0
I2CRCV &H44, 0, 1, test Did this work? Disclaimer: I did not write the I2C stuff. Geoff Geoff Graham - http://geoffg.net |
||||
Frank N. Furter Guru ![]() Joined: 28/05/2012 Location: GermanyPosts: 938 |
Hi Geoff, very good Idea! ...and it works!!! I get no Errormessage when I use the variable before and my code works, I can read out my sensor! THANKS! Frank |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3271 |
Thanks for the feedback, I will fix it in the next version. Geoff Graham - http://geoffg.net |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |