Categories
Mikrokontroler

Animasi LED mikrokontroler ATMega32 dengan Assembly dan C

Artikel ini sengaja saya tulis sebagai awal pembelajaran bagaimana membuat sebuah program aplikasi mikrokontroler AVR (khususnya ATMega32 dengan frekuensi kristal 7,3728MHz) untuk membuat animasi LED berjalan dari pin 0 hingga 7.

Rangkaian yang digunakan ditunjukkan pada Gambar 1, sengaja LED disusun secara CA atau common Anoda, sehingga untuk menyalakan LED harus dikirimkan logika ‘0’.

Untuk kompilasi digunakan AVR Studio versi 4.0 (silahkan unduh GRATIS dari http://www.atmel.com). Program kita awali dengan beberapa macam deklarasi, keterangan sengaja saya masukkan dalam listing program untuk memudahkan pembelajaran langsung dari listingnya, perhatikan instruksi yang diawali dengan ‘.’ merupakan directive dari AVR Studio, bukan instruksi assembly mikrokontroler AVR:

Categories
Mikrokontroler

Migrating from Assembly to C for 8-bit Microcontrollers

Taylor Cox

Atmel

Assembly language has typically been the programming language of choice for embedded system programmers. Looking into the 8-bit microcontroller offerings from different vendors, one finds that these microcontrollers can be programmed using the high-level C programming language as well as assembly. Some microcontrollers have even been designed with high-level languages in mind as a means of programming, thus alleviating common high-level language bottlenecks. The embedded source code examples found in this paper will be based on ATMEL Corporation’s 8-bit AVR microcontroller, which was designed for programming using the high-level C language. In order to program microcontrollers using the C language a compiler is required to translate the high-level language in to low-level machine instructions the microcontroller can execute. Utilizing a high-level language when programming microcontrollers offers key advantages over low-level languages while introducing a single ‘gotcha’ that can be overcome with careful attention and planning.

Download full explanation here.