ATtiny2313 Template File


Untuk memudahkan dalam membuat program-program untuk AVR ATtiny2313, berikut adalah contoh file template assembler versi saya yang perlu banyak dikritiki dan disarani.

File template atau skeleton ini saya buat untuk program assembler GAVRASM.
;------------------------------------------------
; ATtiny2313-Skeleton
; File skeleton/template untuk AVR ATtiny2313
; Dibuat oleh Chandra MDE
; Tanggal 5 Januari 2009

;------------------------------------------------

;------------------------------------------------
; DEVICE = ATtiny2313
;------------------------------------------------
.device ATtiny2313

;------------------------------------------------
; Definisi tambahan

;------------------------------------------------
.def TEMP = r16         ; contoh

;------------------------------------------------
; Data-data di SRAM

;------------------------------------------------
.DSEG
data1: .byte 1          ; contoh
data2: .byte 1          ; contoh
data3: .byte 1          ; contoh

;------------------------------------------------
; Data di EEPROM

;------------------------------------------------
.ESEG
edata1: .db 1           ; contoh
edata2: .db 2           ; contoh

;------------------------------------------------
; Program Memory

;------------------------------------------------
.CSEG
.ORG 0x0000

;------------------------------------------------
; Interrupt Vector ATtiny2313

;------------------------------------------------
reset:
rjmp start
; rjmp interrupt0               ; External Interrupt0
; rjmp interrupt1               ; External Interrupt1
; rjmp tim1_capture             ; Timer1 Capture
; rjmp tim1_cmp_matchA          ; Timer1 Compare Match A
; rjmp tim1_overflow            ; Timer1 Overflow
; rjmp tim0_overflow            ; Timer0 Overflow
; rjmp usart0_rxc               ; USART0 RX Complete
; rjmp usart0_dre               ; USART0 UDR Empty
; rjmp usart0_txc               ; USART0 TX Complete
; rjmp analog_comparator        ; Analog Comparator
; rjmp pcint                    ; Pin Change Interrupt
; rjmp tim1_cmp_matchB          ; Timer1 Compare Match B
; rjmp tim0_cmp_matchA          ; Timer0 Compare Match A
; rjmp tim0_cmp_matchB          ; Timer0 Compare Match B
; rjmp usi_start                ; USI Start
; rjmp usi_overflow             ; USI Overflow
; rjmp eeprom_ready             ; EEPROM Ready
; rjmp wdt_overflow             ; Watchdog Overflow

;------------------------------------------------
; Konstanta>/code>
;------------------------------------------------
author:
.db "Chandra MDE",0
.db "https://telinks.wordpress.com", 0, 0

;------------------------------------------------
; Awal program setelah direset

;------------------------------------------------
start:
;-----------------------
; Setting STACK POINTER

;-----------------------
ldi TEMP, RAMEND
out spl, TEMP

;-----------------------------------------
; Inisialisasi I/O Port, Timer, Dll.

;-----------------------------------------
ldi TEMP, 0xff
out DDRB, TEMP  ; PB0-PB7 = output

;------------------------------------------------
; Looping program utama

;------------------------------------------------
forever:

;-----------------------------------------
; Contoh: Output PORTB on-off tanpa delay

;-----------------------------------------
out PORTB, TEMP
com TEMP

rjmp forever

;------------------------------------------------
; End Of File

;------------------------------------------------

Selamat belajar!

Iklan
Perihal

Cek situs kami di http://teknikelektrolinks.com. Blog Raspberry Pi: http://raspi.teknikelektrolinks.com

Tagged with: , , ,
Ditulis dalam AVR, Mikrokontroler

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Blog Stats
  • 1,298,580 hits

Bergabunglah dengan 2.490 pengikut lainnya

NEO STARDUINO
USB Relay USB-2REL
USB Relay USB-4REL
Water Level Control WLC-02
Serial Relay SER-4REL
NEO STARDUINO SMS ALARM

Alarm SMS Berbasis NEO STARDUINO

1 PC – 6 Unit USB-2REL

Testing 6 USB-2REL Pada 1 Komputer

Standard Pengujian USB-2REL

Pengujian USB-2REL Sebelum Dikirim

LPT-4REL on Knoppix 7.0.5

Testing LPT-4REL on Knoppix Linux

T101 Inkubator Telur

T101 Inkubator Penetas Telur

KONTROL PERALATAN LISTRIK VIA PORT LPT KOMPUTER

Demo Kontrol Kontaktor via Port LPT

STARDUINO meets ANDROID

Demo Kontrol Bluetooth Relay Android

STARDUINO SMS RELAY

Kontrol Relay Via SMS Dengan Starduino

STARDUINO WEB RELAY

Demo Kontrol Relay Via Web/Internet

JustBASIC USB-2REL Control

Demo Kontrol USB-2REL + JustBASIC

STARDUINO + GPS + LCD

Demo Starduino GPS Dengan LCD

USB-2REL EXTREME TEST

Demo Kontrol On/Off Lampu USB-2REL

THERMOSTAT T101 IN ACTION

Demo Thermostat T101 Pada SV=37.5°C

WATER LEVEL CONTROL WLC-02

Demo Kontrol Level Air Tandon WLC-02

HUMIDITY CONTROLLER H103

Demo Kontrol Kelembaban H103 (DHT11)

%d blogger menyukai ini: