Check out the new projects site for A-i-S

Sunday, July 13, 2008

The machinations of thought

Well my machine can think.....sort of.....

I got the re-worked code to operate satisfactorily.

Using FreeRTOS tasks I've created a modular set of code for my bot. Every 300ms the sensors are checked, every 400 the motor driver board is updated and every 300 ms the main "thought" logic is applied.

Yes so far I have 3 FreeRTOS tasks running, the maximum for a Mega32 is said to be around ten.

I do have an issue with portTICK_RATE_MS which is only kludged at this stage. I still don't quite get where this MACRO is set and how. I am using it to convert from CPU ticks to millieseconds and from what is coming out on UART I'm guess the MS calculation is about 50% slow. I changed configTICK_RATE_HZ to 1000 from 200 but I'm still unsure exactly what this effects. (Note I have set the correct clock rate of 16Mhz so no errors should be coming from there).

Oh well, time to put it to one side and do something else this evening, I've cleaned up the code, documented it, extended it to about 600 lines in the main program (up by 200), ironed out some logic bugs and ensured the glue logic to motors and IR sensors works as expected.

All in all quite a good effort, accelerometer to be next or maybe just proper collision avoidance and handling.

No comments: