Wednesday 29 July 2009

Testing C code

I was relatively new to C programming, but it is much easier than trying to mess around with the assembly level language. My problem was that I did not always know the right thing to do in C code. Testing using the C compiler and trying it out on the microcontroller was OK but not really suitable for small tests of C code I was not so sure about. my main problem was confusion about pointers - I was using some pointers but not getting the correct information. I needed to try out some simple code to test out what I would do in the main C code.
I needed some program in which to run short snippets of C code. I found a program called code::blocks. This is a free open source cross platform C++ IDE. This runs on Vista. Download the binary release with 'mingw' in the title as this includes a compiler.
One downloaded you can open a new projects and the choice of using C or C++ comes up. I chose C.
I found that it did not run the compiler. To sort this out you must go to 'Settings' then 'Compiler and Debugger...' then click on the 'Toolchain Executables' tab. Ensure that the path for the compiler installation directory is correct (mine was pointing at the wrong place). You would need to search the installation directory to find it. The program should then work.
I will be having a play around with the program, but it does seem very nice and easy to use so far.