And do you know how it checks if the I2C bus is available? It uses mutex's.doc-helmut wrote:of course!
But it's not multiple writing what my code does, every i2c function waits until the bus is ready before it sends a new command.
I was actually referring more to your robot program, not the example.doc-helmut wrote:The program is simple and just uses 2 tasks:
One task (main task) does the following in an endless loop:
- it starts the motors, runs them for 2sec by a Wait(2000), then stops them, starts them again reverse, again runs them for 2sec by a Wait(2000), then stops them.
The 2nd task just reads the encoders in an endless loop about every 20 ms and shows them on the screen, nothing else.
I'm curious if your functions have anyhow different internal functionalities and won't crash like mine.
I'm not sure if mine would be any better. I'm having issues with it crashing as well. It seems to only be an issue when I attempt to read and write in the same program. If I only write, it seems to do really well.
Now I'm really curious how ROBOTC FW does it. Maybe I can someday use a logic analyzer on the I2C lines to look for the "magic touch".