| Advanced Topics | ||
| Links Mentioned APP-IV resources AVRLIB |
![]() NOTICE: THIS IS AN ARCHIVAL COPY OF THIS COURSE. For the latest version, please visit our interactive classroom. The APP-IV libraries are made to be easy to understand, use, and modify. However, sometimes you want more library code. In that case, be sure to check out the open source AVRLIB. This powerful library can handle buffered serial I/O, fixed point math, and I2C. It even has modules that can handle GPS and IDE hard drives! It is easy to use AVRLIB with the APP-IV: 1. Copy the library's conf/global.h file to your project directory. You may need other conf/*.h files, depending on what modules you are using (refer to the library documentation). 2. Edit the conf/global.h file. Set F_CPU to 10000000 (since the APP-IV uses a 10MHz clock). 3. Copy the APP-IV makefile to your project directory and modify it in the usual way. 4. In the makefile, find these lines (or add them near the top if you have an early version of the makefile): ### If you are using AVRLIB ### Set these two variables correctly ### 1) Path to gcc stuff AVR = c:\\avr\\WinAVR ### 2) Path to AVRLIB AVRLIB = c:\\avr\\avrlib Change the paths to match your operating system and the file locations, of course. 5. Add any AVRLIB modules you are using to your project: # If there is more than one source file, append them above, or modify and # uncomment the following: SRC += $(AVRLIB)/uart.c $(AVRLIB)/buffer.c That's it! If you work on many projects, and they are important to you, you may want to "freeze" the library source code by copying all the files you need from the library directory into your project directory. Then you don't need to do anything special to use the files. You just add them to your project as in step 5. This concludes this tutorial. But there's much more to learn. If you already know C, be sure to carefully review the library documentation. It has valuable information about platform-specific tricks and problems. Once you get used to programming your embedded systems in C, you'll wonder why you ever used anything else.
|