[chbot] AVR external interrupt and Makefile example

Richard Jones richard_alan_jones at yahoo.com
Wed Nov 11 10:30:11 GMT 2009


AVR external interrupt and Makefile example

At the Chch Creative Space session last week there were some questions about how to code the external interrupt and Makefiles for the AVR. 

I've collected together some code fragments from my micromouse and placed them in a single 'c' demo file. A simple Makefile collects together the commands to compile the code, generate a hex file and program the device using a serial bootloader. The Arduino makefiles are a fine example of how to obfuscate the process beyond belief. My makefile is a little too simple and would benefit from a few variables like target and cpu_frequency. 
If you are interested have a look at the code and feel free to ask questions or propose improvements. Although the code does execute, printing out the external interrupt count about once per second, I noted 11 improvement opportunities and one bug. 

At the command line type 'make' to build the code, 'make program' to program the avr chip, and 'make clean' to delete all the temporary files. If you want to see what commands the make utility would issue without actually executing commands type 'make -n program' at the command line.

I compile the code using gcc on ubuntu, but it probably works just as well with gcc under windows or OS X.

Richard


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avr_int_demo.c
Type: text/x-csrc
Size: 3350 bytes
Desc: not available
Url : http://lists.ourshack.com/pipermail/chchrobotics/attachments/20091111/61a1d360/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 409 bytes
Desc: not available
Url : http://lists.ourshack.com/pipermail/chchrobotics/attachments/20091111/61a1d360/attachment.obj 


More information about the Chchrobotics mailing list