ja, het zoveelste LCD topique....
ik probeer een SED1330 based LCD aan te sturen met de pic16f877 @ 20MHz.
na het hele internet af gezocht te hebben en de datasheet te hebben gelezen ben ik wat gaan proberen... en heb ik hier en daar wat code gelezen... (is er niet veel alleen in ASM of C voor de PC)
het LCD is voor 99% zeker goed aangesloten... (D0 aan portD0 (toevallig poort D
)) en de andere pinnen aan de ge-definede pinnen.
hij gaat ook aan en als ik hem reset zie ik hem "refreshen".. maar initializeren en text of pixels erop krijgen ho maar.....
wat ik raar vindt is dat de CS niet gebruikt word in de code die ik hier en daar op internet heb gevonden... en waar ik niet zeker van ben is hoe WR getoggled moet worden.
hier is mijn code: (ik gebruik de PICC CCS compiler)
ik hoop dat iemand mij verder kan helpen...
ik probeer een SED1330 based LCD aan te sturen met de pic16f877 @ 20MHz.
na het hele internet af gezocht te hebben en de datasheet te hebben gelezen ben ik wat gaan proberen... en heb ik hier en daar wat code gelezen... (is er niet veel alleen in ASM of C voor de PC)
het LCD is voor 99% zeker goed aangesloten... (D0 aan portD0 (toevallig poort D
hij gaat ook aan en als ik hem reset zie ik hem "refreshen".. maar initializeren en text of pixels erop krijgen ho maar.....
wat ik raar vindt is dat de CS niet gebruikt word in de code die ik hier en daar op internet heb gevonden... en waar ik niet zeker van ben is hoe WR getoggled moet worden.
hier is mijn code: (ik gebruik de PICC CCS compiler)
C:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
| #include <16F877.h> #device adc=8 #use delay(clock=20000000) #fuses NOWDT, XT, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT #define LCD_RST PIN_C4 #define LCD_WR PIN_C5 #define LCD_CS PIN_C6 #define LCD_A0 PIN_C7 /* LCD PINS FUNCTION STAMP PIN LEVEL Description PIN 01 Frame GND - 0V Frame Ground PIN 02 Vss - 0V Ground PIN 03 Vdd - +6V Power Supply Voltage for Logic and LCD (Abs Max 7V) PIN 04 Vo - -9V Operating Voltage for LCD (Connect -9 to -18V) Use Pot. PIN 05 /RES - H Reset Signal PIN 06 /RD - H Read Signal PIN 07 /WR 9 H/L Write Signal PIN 08 /CS - L Chip Select PIN 09 A0 8 H/L Data Type Select Signal PIN 10 DB0 7 H/L Display Bit #0 PIN 11 DB1 6 H/L Display Bit #1 PIN 12 DB2 5 H/L Display Bit #2 PIN 13 DB3 4 H/L Display Bit #3 PIN 14 DB4 3 H/L Display Bit #4 PIN 15 DB5 2 H/L Display Bit #5 PIN 16 DB6 1 H/L Display Bit #6 PIN 17 DB7 0 H/L Display Bit #7 */ LCD_cmd(char command){ output_high(LCD_A0); // set A0 to indicate command output_d(command); // set up data output_high(LCD_WR); // activate ^WR output_low(LCD_WR); // deactivate ^WR again } LCD_write(char command){ output_low(LCD_A0); // set A0 to indicate data output_d(command); // set up data output_high(LCD_WR); // activate ^WR output_low(LCD_WR); // deactivate ^WR again } void LCD_init(){ //////////////RESET/////////////// output_high(LCD_WR); output_low(LCD_RST); delay_us(200); output_high(LCD_RST); delay_us(200); output_low(LCD_RST); delay_us(4000); //////////////////SYSTEMSET/////// lcd_cmd(0x40); lcd_write(0x30); lcd_write(0x85); // 0x80 + cellwidth -1 (cell 6) lcd_write(0x2A); // (graph_width 256 / cellwidth 6 )-1 lcd_write(0x38); // ???????????????????? lcd_write(0x7F); // graphheight -1 (127) lcd_write(0x24); // bytes per line (36) lcd_write(0x00); // 0 //////////////////SCROLL/////// lcd_cmd(0x44); lcd_write(0x00); // scr1_l lcd_write(0x00); // scr1_h lcd_write(0xC7); lcd_write(0x00); // scr2_l lcd_write(0x06); // scr2_h lcd_write(0xC7); ////////////////CURSOR SIZE///////// lcd_cmd(0x5D); // CSR_FORM lcd_write(0x05); //cellwidth -1 lcd_write(0x07); // ///////////////HDOT lcd_cmd(0x5A); //HDOT lcd_write(0x00); ///////////////OVLAY lcd_cmd(0x5B); lcd_write(0x01); ///////////////DISP DISABLE lcd_cmd(0x58); lcd_write(0x14); ///////////////SCR_DIR_R lcd_cmd(0x4C); ///////////////DISP ENABLE lcd_cmd(0x59); /* OUDE CODE delay_ms(500); LCD_cmd(0x40); // system set LCD_write(0x30); LCD_write(0x87); LCD_write(0x07); LCD_write(0x27); LCD_write(0x2F); LCD_write(0xC7); LCD_write(0x28); LCD_write(0x00); LCD_cmd(0x44); //Scroll LCD_write(0x00); LCD_write(0x00); LCD_write(0xC8); LCD_write(0xE8); LCD_write(0x03); LCD_write(0xC8); LCD_write(0x00); LCD_write(0x00); LCD_write(0x00); LCD_write(0x00); LCD_cmd(0x5A); //HDOT SCR LCD_write(0x00); LCD_cmd(0x5B); //OVLAY LCD_write(0x00); LCD_cmd(0x59); //DISP OFF LCD_write(0x016); LCD_cmd(0x46); // LCD_write(0x00); LCD_write(0x00); LCD_cmd(0x4C); LCD_write(0x42); LCD_write(0x00); LCD_cmd(0x57); //CSR FORM LCD_write(0x04); LCD_write(0x86); LCD_cmd(0x59); //DISP ON LCD_write(0x04); LCD_cmd(0x4C); //CSR DIR */ } void main(){ LCD_init(); LCD_cmd(0x42); //write char while(true){ LCD_write(0x44); // IETS schrijven } } |
ik hoop dat iemand mij verder kan helpen...
edit:
bekeken code: http://mikerey35475.tripod.com/jal-lcd.html
ook een init voorbeeld: google cache
bekeken code: http://mikerey35475.tripod.com/jal-lcd.html
ook een init voorbeeld: google cache
[ Voor 5% gewijzigd door technocow op 19-07-2006 17:15 ]