/*DEMO FILE FOR ALCATEL HT1 LCDmija 7.1.2008 ver.: 1.0*///**************************************************************#ifndef LCD_CS#define LCD_CS PIN_B0#define LCD_DATA PIN_B1#define LCD_CLK PIN_B2#define LCD_A0 PIN_B3#define LCD_RESET PIN_B4#endifBYTE const LCD_INIT_STRING[6] = {0x61,0x3D,0x70,0x42,0x57,0x7B};//datacheet S1D12305//**************************************************************void LCD_init(void);void LCD_putc(int8 data);void LCD_send_command(int8 data);void LCD_send_data(int8 data);void LCD_clear();void LCD_gotoxy(int8 x, int8 y);void LCD_send(int8 data);void LCD_corsor_off(void);void LCD_cursor_on(void);void LCD_contrast(int8 contrast);void LCD_icon(int8 icon,int8 segment);//**************************************************************void LCD_init(void){int8 i;output_low(LCD_RESET);output_high(LCD_CS);delay_ms(5);output_high(LCD_RESET);delay_ms(5);for (i=0;i<6;i++) LCD_send_command(LCD_INIT_STRING[i]);delay_ms(20);LCD_clear();}void LCD_putc(int8 data){if (data == '\n') {LCD_send_command(0xC0);return;}data+=4;LCD_send_data(data);}void LCD_send_command(int8 data){output_low(LCD_A0);LCD_send(data);output_high(LCD_A0);}void LCD_send_data(int8 data){output_high(LCD_A0);LCD_send(data);}void LCD_clear(){int8 a;LCD_send_command(0xB0);for (a=0;a<=11;a++) LCD_putc(0x20);LCD_send_command(0xC0);for (a=0;a<=11;a++) LCD_putc(0x20);LCD_send_command(0xF0);for (a=0;a<=11;a++) LCD_send_data(0x0);LCD_gotoxy(1,1);}void LCD_gotoxy(int8 x, int8 y){x--;y--;if ( x>11 || y>1 ) return;if (y) LCD_send_command(0xC0|x);else LCD_send_command(0xB0|x);}void LCD_send(int8 data){int8 a;output_low(LCD_CS);for (a=0;a<=7;a++){output_low(LCD_CLK);output_low(LCD_DATA);if (data & 0x80) output_high(LCD_DATA);output_high(LCD_CLK);data<<=1;}output_high(LCD_CS);}void LCD_cursor_off(void){LCD_send_command(0x31);}void LCD_cursor_on(void){LCD_send_command(0x3D);}void LCD_contrast(int8 contrast){LCD_send_command(0x70|(0x0F & contrast));}void LCD_icon(int8 znak,int8 segment){LCD_send_command(znak);LCD_send_data(segment);}//**************************************************************//*** defines for segments icons ***#define LCD_SEGMENT_OFF 0x0#define LCD_BATTERIE 0xF0#define SEG_BAT_EMP 0x4#define SEG_BAT_LOW 0xC#define SEG_BAT_FULL 0xE#define LCD_PC 0xF2#define SEG_PC 0x10#define LCD_OFF_RING 0xF3#define SEG_RING 0x8#define LCD_CALL_MISSED 0xF4#define SEG_MISSED 0x10#define LCD_CASSETTE 0xF5#define SEG_CASSETTE 0x8#define LCD_MESSAGE 0xF6#define SEG_MESSAGE 0x10#define SEG_MESS_FULL 0x18#define LCD_CALL_DIVERT 0xF8#define SEG_DIVERT 0x4#define LCD_CLOCK 0xF9#define SEG_CLOCK 0x8#define LCD_SIGNALL 0xFB#define SEG_SIGNALL1 0x2#define SEG_SIGNALL2 0xA#define SEG_SIGNALL3 0xE#define SEG_SIGNALL4 0x1E//**************************************************************//*** ASCII char ***#define ASCII_CLOCK 0xD0#define ASCII_ARROW_UP 0xDA#define ASCII_ARROW_DOWN 0xD7#define ASCII_ARROW_R 0xD8#define ASCII_ARROW_L 0xD9#define ASCII_ARROW_UR 0xE7#define ASCII_ARROW_DR 0xE8