Recycled Parts Moderator Newsgroup, Discussion Board and Trading Place   >   Sorting Centers   >   Plastic   >   Program atmel atmega microcontroller in c

Program atmel atmega microcontroller in c


Have you tried to develop microcontroller applications, but been frustrated by complicated assembly language programming? Or have you run into limitations found in simple Basic language compilers? Why not step up to C? The new APP-IV is designed from the ground up to run C programs. And not some minimalist toy version of C, but the open source GNU C compiler - a powerful optimizing compiler that is used to build programs as complex as the Linux operating system.
The APP-IV's manual and tutorials explain how to obtain the GNU C compiler and related tools for Windows or Linux. The board uses a special boot loader that can work with most programming software without the need for a special programmer or cable. All programming is done from a standard serial port on your computer using your choice of AVR Prog, UISP, or AVRDude software.
We've made special libraries available for the APP-IV that allow you to handle digital I/O, analog input, serial I/O, programmed delays, and even use a user-supplied LCD! The supplied makefile simplifies C development. For debugging, you can easily use Atmel's AVR Studio to debug your C programs or use GNU's gdb debugger (both in simulation mode).
There's no easier way to start programming microcontrollers in C. If you prefer to use assembler, no problem! Not only can you mix assembly language with your C programs, but the board will work fine with Atmel's AVR Studio and the companion AVR Prog programming software. You can also use it with many other popular development languages (such as BASCOM/AVR).
The APP-IV is based on our popular GPMPU40 board - you can use the edge connector to interface to external circuitry or use the supplied pins to plug the board directly into a solderless breadboard. This makes prototyping simple. All you need is a 9V battery (or other suitable power supply) and a standard serial cable.
Look at the powerful capabilities of this board:
* Atmel AVR ATmega8 processor running at 10MHz
* Real time counter, 1 16-bit timer/counter, and 2 8-bit timer/counters
* UART, I2C, and SPI interfaces
* 4 channels of 10-bit A/D and 2 channels of 8-bit A/D
* Libraries allow you to easily use resources (use printf and gets, for example, with the onboard serial port).
Downloads: Tutorials, Manual, Resources online
Here's an example program from the tutorial:
int main(int argc, char * argv[])
UartInit(BAUD_19200); // 19200 baud, 8 bits, 1 stop, no parity
UartSetStdio(); // Make UART stdin/stdout
printf("\014"); // Clear screen
printf("How high should I count? ");
Wow! That's easy enough. Can you imagine writing this program in assembly language?
Please note that this is a kit and does require soldering and basic electronic tools. This allows you to customize the board to fit your needs. All the parts are through hole, and the solder masked board is very easy to assemble.
Frequently Asked Questions (APP-IV)
Q: What are the differences between the APP-IV and an ordinary ATmega8?
A: The APP-IV doesn't require a programmer or programming cable. However, this also means that there are a few differences. In particular, flash memory above 0x1BFF is not available for user programs. Port B pin 5 is not generally available for your use. You must use a 10MHz clock clock. Your program is free to use the serial port, but you should refrain from using the two serial port pins as general-purpose I/O unless you disconnect them before programming.
Q: Can I program a regular ATmega8 with my APP-IV code?
A: Yes. An APP-IV program will run on any ATmega 8 (or similar processor with suitable recompilation).
Q: Can you supply the APP-IV on other Atmel chips?
A: Yes, by special order. Minimum quantity restrictions may apply.
Q: Do I have to use the APP-IV boot loader?
A: No. The board has provision for a normal AVR programming cable (such as our XCP1). You can either replace the APP-IV chip with a standard ATmega8 and use a normal programmer, or you can use the normal programmer to erase the APP-IV chip (which will permanently remove the APP-IV boot loader from the chip).
Please note that this is a kit and does require soldering and basic electronic tools. This allows you to customize the board to fit your needs. All the parts are through hole, and the solder masked board is very easy to assemble.



Program atmel atmega microcontroller in c