{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture_09 - Introduction to C for programming ATMEL microcontrollers

Lecture_09 - Introduction to C for programming ATMEL microcontrollers

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Faculty of Science and Technology Lecture 9 Introduction to C for programming ATMEL microcontrollers SEE215
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
What’s wrong with assembler? Assembler language programming gives very precise control over code, Such as execution time, program size, data location etc. Assembler programming however, does require a significant amount of discipline The specifics of microcontroller hardware needs to be well understood, hardware registers, as well as instructions, general purpose register allocation, program & data layout etc. Each microcontroller AVR, Microchip , Motorola etc. will have hardware & instruction set differences, making it difficult to re-use code from one microcontroller on another. The compactness of program and speed of operation are beyond question. It is often difficult to re-use code written for one application for another. Often however, we may not need this compactness or operating speed and the convenience of software of development may be more important.
Image of page 2
What’s right with C ? C is a programming language developed by Kernighan & Ritchie. C is a basic Programming language from which most of the modern programming languages have been derived. There are many tasks which are common to all microcontrollers such as mathematics, standard input & output, string handling etc. Standard libraries exist for most functions that you wish to execute. Most microcontrollers can be written in C and the AVR ATMega128 is no exception. By using C, much code can be written, which will potentially run on any microcontroller and hence can be ported from one controller to the next. Code is more easily re-used. Some specific microcontroller knowledge is required, but much of the tedium is obviated. Floating point numbers & mathematical functions are easily Implemented. To write code for the AVR ATmega128, a C complier is required which converts the C instructions into suitable binary code. There are many compilers which will perform this task. These can cost from $0 to $1000
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon