Pfad: Home => AVR-Übersicht

Assembler-Quellcode der LCD-Include-Demonstration für das STK200

; *****************************************************
; * Demonstrates the use of the Include routines *
; * LCD_INC.ASM for use with the LCD on board of the *
; * ATMEL STK200 (C) 1999 Gerhard Schmidt *
; * Report bugs to info!at!avr-asm-tutorial.net *
; *****************************************************
;

.NOLIST
.INCLUDE "8515def.inc"
.LIST

.def   mpr=R16 ; My multipurpose register, required

; Reset-/Interrupt-Vectors

   RJMP   main

; Includes the LCD-routines, file must be in the same path

.INCLUDE "LCD_INC.ASM"

; Main program

main:   LDI   mpr,LOW(RAMEND) ; Set up stack
   OUT   SPL,mpr
   LDI   mpr,HIGH(RAMEND)
   OUT   SPH,mpr
   LDI   mpr,0xC0 ; Switch on external SRAM and WAIT
   OUT   MCUCR,mpr
   RCALL   lcd_cl ; Clears display
   RCALL   lcd_st ; Standard display mode
   LDI   mpr,0x05; Cursor position to line 1, col 5
   RCALL   lcd_sc
   LDI   mpr,'H' ; Output Hello World
   RCALL   lcd_ch
   LDI   mpr,'e'
   RCALL   lcd_ch
   LDI   mpr,'l'
   RCALL   lcd_ch
   RCALL   lcd_ch
   LDI   mpr,'o'
   RCALL   lcd_ch
   LDI   mpr,0x45 ; Cursor position to line 2, col 5
   RCALL   lcd_sc
   LDI   mpr,'W'
   RCALL   lcd_ch
   LDI   mpr,'o'
   RCALL   lcd_ch
   LDI   mpr,'r'
   RCALL   lcd_ch
   LDI   mpr,'d'
   RCALL   lcd_ch
   LDI   mpr,'!'
   RCALL   lcd_ch
   RCALL   lcd_on
loop:   RJMP   loop ; Uff! Next week we learn how to create and read a table
©2002 by http://www.avr-asm-tutorial.net