Rev Author Line No. Line
1213 mija 1 /* mija 2008
2 defines for LCD NOKIA5110 (instruction set)
3  
4 CPU ATMEGA16
5 fcpu = 1MHz
6  
7 !! define PIN,PORT,DDR for IOpin !!
8  
9 */
10  
11  
12 #define LCD_WIDTH 84
13 #define LCD_HEIGHT 48
14 #define CHAR_WIDTH 6
15  
16 // LCD SW
17 #define nSCLK PA6
18 #define nSCLK_PORT PORTA
19 #define nSCLK_DDR DDRA
20  
21 #define nSDIN PA5
22 #define nSDIN_PORT PORTA
23 #define nSDIN_DDR DDRA
24  
25 #define nDC PA4
26 #define nDC_PORT PORTA
27 #define nDC_DDR DDRA
28  
29 #define nCS PA3
30 #define nCS_PORT PORTA
31 #define nCS_DDR DDRA
32  
33 #define nRESET PA2
34 #define nRESET_PORT PORTA
35 #define nRESET_DDR DDRA
36  
37 //void N5110_send(uint8_t data);
38 //void N5110_send_data(uint8_t data);
39 void N5110_send_command(uint8_t data);
40 void LCD_N5110_INIT(void);
41 int lcd_put(char c, FILE *stream);
42 int lcd_put2(char c, FILE *stream);
43 void gotoxy(uint8_t x,uint8_t y);
44 void lcd_refresh(void);
45 void buffer_clr(void);
46 void lcd_plot(uint8_t x, uint8_t y);
47 void lcd_line(uint8_t x1,uint8_t y1,uint8_t x2, uint8_t y2);
48  
49 //interni
50 #define nSCLK_H nSCLK_PORT |= _BV(nSCLK)
51 #define nSCLK_L nSCLK_PORT &= (~(_BV(nSCLK)))
52 #define nSCLK_INIT nSCLK_DDR |= _BV(nSCLK)
53  
54 #define nSDIN_H nSDIN_PORT |= _BV(nSDIN)
55 #define nSDIN_L nSDIN_PORT &= (~(_BV(nSDIN)))
56 #define nSDIN_INIT nSDIN_DDR |= _BV(nSDIN)
57  
58 #define nDC_H nDC_PORT |= _BV(nDC)
59 #define nDC_L nDC_PORT &= (~(_BV(nDC)))
60 #define nDC_INIT nDC_DDR |= _BV(nDC)
61  
62 #define nCS_H nCS_PORT |= _BV(nCS)
63 #define nCS_L nCS_PORT &= (~(_BV(nCS)))
64 #define nCS_INIT nCS_DDR |= _BV(nCS)
65  
66 #define nRESET_H nRESET_PORT |= _BV(nRESET)
67 #define nRESET_L nRESET_PORT &= (~(_BV(nRESET)))
68 #define nRESET_INIT nRESET_DDR |= _BV(nRESET)
69  
70  
71 // FUNCTION SET
72 #define ACTIVE_CHIP 0x20
73 #define POWER_DOWN 0x24
74 #define H_ADDR 0x20
75 #define V_ADDR 0x22
76 #define BASIC_SET 0x20
77 #define EXTENDED_SET 0x21
78  
79 // BASIC SET
80 #define DISPLAY_BLANK 0x08
81 #define DISPLAY_NORMAL 0x0C
82 #define DISPLAY_ALL_ON 0x09
83 #define DISPLAY_INV 0x0D
84  
85 #define Y_SET 0x40 // | Y2..Y0
86 #define X_SET 0x80 // | X6..X0
87  
88 // EXTENDED SET
89 #define TEMP_COEF 0x04 // | TC1|TC0
90 #define TEMP_COEF_0 0x04
91 #define TEMP_COEF_1 0x05
92 #define TEMP_COEF_2 0x06
93 #define TEMP_COEF_3 0x07
94  
95 #define BIAS_0 0x10
96 #define BIAS_1 0x11
97 #define BIAS_2 0x12
98 #define BIAS_3 0x13
99 #define BIAS_4 0x14
100 #define BIAS_5 0x15
101 #define BIAS_6 0x16
102 #define BIAS_7 0x17
103  
104 #define VOP 0x80 // | Vop6..Vop0