/* *********************************************************************** ** ** Copyright (C) 2005 Christian Kranz ** ** Siemens S65 Display Control ** *********************************************************************** */ #define __ASSEMBLER__ 1 #define __SFR_OFFSET 0 #include #define LCD_ASM #include "lcd.h" #define __tmp_reg__ r0 #define __zero_reg__ r1 .text #ifndef XTAL #define XTAL 7372800 // must be changed #endif #define DELAY_ONE_MILLISECOND (XTAL / 4 / 1000) // must > 8 // void mswait(uint16_t ms); // wait some milliseconds, XTAL must be correct defined .global glcdWait // used T0,T1 stack 0 mswait: sbiw r24, 1 // 2 brcc mswait1 // 2 ret // 2 -2 = 0 for no branch in both loops mswait1: nop ldi r26, lo8(DELAY_ONE_MILLISECOND -4) // 1 ldi r27, hi8(DELAY_ONE_MILLISECOND -4) // 1 mswait2: sbiw r26, 1 // 2 brne mswait2 // 2 = 4, = 3 for last loop rjmp mswait // 2 = 8 ;void port_init_io(void) .global port_init_io port_init_io: ; setup serial data I/O pins cbi PORTE, LCD_RESET ; display reset sbi DDRE, LCD_RESET ; set reset as output ; sbi DDRB, LCD_MISO ; MISO is always input in SPI sbi DDRB, LCD_MOSI ; MOSI must be set as output for SPI sbi PORTF, LCD_CS ; deselect display sbi DDRF, LCD_CS ; SS must be output for Master mode to work cbi PORTB, LCD_SCK ; set SCK lo sbi DDRB, LCD_SCK ; set SCK as output sbi PORTB, LCD_MISO ; enable pull up of MISO to avoid floating input sbi PORTF, LCD_RS ; start with RS=high sbi DDRF, LCD_RS ; RS signal is output ; setup serial data interface ; select clock phase positive going in middle of data ; master mode ; enable SPI ; speed is CPUclock/2 ldi r24,(1<