.include "m8535def.inc" .ORG 0x00 reset: rjmp start ;Programmstart exint0: reti ;nicht genutzt exint1: reti ;nicht genutzt t2comp: reti ;nicht genutzt t2ovfl: reti ;nicht genutzt t1icap: reti ;nicht genutzt t1coma: reti ;nicht genutzt t1comb: reti ;nicht genutzt t1ovfl: reti ;nicht genutzt t0ovfl: reti ;nicht genutzt spiint: reti ;nicht genutzt uartrx: reti ;nicht genutzt uartem: reti ;nicht genutzt uarttx: reti ;nicht genutzt adccom: reti ;nicht genutzt eeprom: reti ;nicht genutzt ancomp: reti ;nicht genutzt ;*** .def temp=r16 .def temp1=r17 .def temp2=r18 .def temp3=r19 .def para1=r20 .def para2=r21 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;LCD Display .equ ChipClock=8000; in kHZ .equ LCD_PORT=PORTC; port where LCD is connected to .equ LCD_SDAT=4; first pin of DATA (0 or 4 allowed!) .equ LCD_RS=0; pin -> RS .equ LCD_RW=1; pin -> RW .equ LCD_E=2; pin -> E ;command flags .equ LCD_CLR=0x01 ; DB0: clear display .equ LCD_HOME=0x02 ; DB1: return to home position .equ LCD_ENTRY_MODE=0x04 ; DB2: set entry mode .equ LCD_ENTRY_INC=0x02 ; DB1: 1=increment, 0=decrement .equ LCD_ENTRY_SHIFT=0x01 ; DB2: 1=display shift on .equ LCD_ON=0x08 ; DB3: turn lcd/cursor on .equ LCD_ON_DISPLAY=0x04 ; DB2: turn display on .equ LCD_ON_CURSOR=0x02 ; DB1: turn cursor on .equ LCD_ON_BLINK=0x01 ; DB0: blinking cursor ? .equ LCD_MOVE=0x10 ; DB4: move cursor/display .equ LCD_MOVE_DISP=0x08 ; DB3: move display (0-> cursor) ? .equ LCD_MOVE_RIGHT=0x04 ; DB2: move right (0-> left) ? .equ LCD_FUNCTION=0x20 ; DB5: function set .equ LCD_FUNCTION_8BIT=0x10 ; DB4: set 8BIT mode (0->4BIT mode) .equ LCD_FUNCTION_2LINES=0x08 ; DB3: two lines (0->one line) .equ LCD_FUNCTION_10DOTS=0x04 ; DB2: 5x10 font (0->5x7 font) .equ LCD_CGRAM=0x40 ; DB6: set CG RAM address .equ LCD_DDRAM=0x80 ; DB7: set DD RAM address .equ LCD_BUSY=0x80 ; DB7: LCD is busy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; start: ;Stackpointer ldi temp, LOW(RAMEND) ; LOW-Byte der obersten RAM-Adresse out SPL, temp ldi temp, HIGH(RAMEND) ; HIGH-Byte der obersten RAM-Adresse out SPH, temp call lcd_init call lcd_clear ldi temp1,0xF call lcd_data halt: rjmp halt ;*** ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; LCD-Routinen ;; ;; ============ ;; ;; (c)andreas-s@web.de ;; ;; modified by wmark@hurrikane.de ;; ;; ;; ;; 4bit-Interface ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;sendet ein Datenbyte an das LCD lcd_data: mov temp2, temp1 ;"Sicherungskopie" für ;die Übertragung des 2.Nibbles ;.if LCD_SDAT swap temp2 ;Vertauschen ;.else ;swap temp1 ;.endif andi temp1, 0x0f<