Just thought a few people might be interested that in response to a bug report I submitted, Dick Swan has advised me that "between 1.02 and 1.05 (RobotC) true "byte" / "char" variable support was added. Previously variables declared as "byte" were allocated 16-bits".

and that

"In preparation for the move to byte variables, the I2C support functions
were designed with parameters that was a 'byte' array (of the 16-bit
kind). With 1.05 release, the allocation is truly 8-bit values".

The implication for some i2c code is that sometimes successive returned byte values are added or shifted to arrive at the final "sensor" value. If the returned value is between 128-255, it will be considered as a negative value of up to -128. To overcome this sort of issue, Dick has suggested the solution to my problem was to: AND a byte variable with 0x00FF.

To give a practical example of what I mean, Scott (starwarslegokid) asked me about a issue between v1.02 qnd v1.05 with the code he was using for mindsensors compass.

What I have suggested is shown as follows: (changes to the original code is shown with comment // change here)

You just helped allot of people out. Iv been stumped about this too lol, it didn't occur to me to change the heading to and int as well. The code works just like it used to. Ill add your name to my code file and make sure that mindsensors is notified of the change needed for the code.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum