컨텐츠 바로가기


board


현재 위치

  1. 게시판
  2. 기타Q&A

기타Q&A

기타 문의 게시판입니다.

그래픽lcd질문있습니다
제목 그래픽lcd질문있습니다
작성자 이길준 (ip:)
  • 작성일 2015-08-12 18:25:44
  • 추천 추천 하기
  • 조회수 1880
  • 평점 0점

 

http://jkelec.cafe24.com/ 

안녕하세요 위 링크에 들어가서 다운받은 예제 파일로 소스 코딩했는데 에러가 납니다

헤더파일 hw_config.h 와 lcd12864.h 그리고 until.h까지 추가시켰습니다

근데 안됩니다. 에러창은 아래처럼뜨네요 그리고 저는 소스인사이트 사용해서 avr스튜디오4로

아트메가 128에 코딩합니다

소스코드는 추가했습니다

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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
 
#include "hw_config.h"
#include "lcd12864.h"
    
    
    void LCD_Init0(void)
    {
        byte cmd;
        cmd=0x30;    // function set 8-bit data, the basic instructions
        W_1byte(0,0,cmd);    // write command
        Delay(2);
        cmd=0x0C;    // display status ON, cursor OFF, highlight OFF
        W_1byte(0,0,cmd); 
        Delay(2);
        cmd=0x01;    // clear display
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x02;    // address of homing
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x80;    // Set DDRAM address
        W_1byte(0,0,cmd);
        Delay(2);
        // Char_Set_XY(0,1,"LCD initializing");
        // Char_Set_XY(0,2,"Please wait a moment.");
        Delay(200); 
        //Delay(2500); 
    }
    
    void LCD_Init1(void)
    {
        byte cmd;
        cmd=0x30;    //    function set 8-bit data, the basic instructions
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x0C;    // display status ON, cursor OFF, highlight OFF
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x01;    // clear display
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x02;    // address of homing
        W_1byte(0,0,cmd);
        Delay(2);
        cmd=0x80;    // Set DDRAM address
        W_1byte(0,0,cmd);
        Delay(2);
    }
    
    
    void W_1byte(byte RW, byte RS, byte W_data)
    {
        u16 H_data,L_data,S_ID = 0xf8;    //11111RWRS0
        if(RW == 0)
        {
            S_ID &=0x04;
        }
        else     //if(RW==1)
        {
            S_ID |= 0X04;
        }
        
        if(RS == 0)
        {
            S_ID &=0x02;
        }
        else     //if(RS==1)
        {
            S_ID |= 0X02;
        }
        
        H_data = W_data;
        H_data &= 0xf0;   // lower 4 bits of data mask
        L_data = W_data;     // xxxx0000 format
        L_data &= 0x0f;   // 4 bits of data mask
        L_data <<= 4;    // xxxx0000 format
        Set_CS();
        
        Write_8bits(S_ID);     // send S_ID
        Write_8bits(H_data); // send H_data
        Write_8bits(L_data); // send L_data
        Clr_CS(); 
    }
    
    
    void Write_8bits(u16 W_bits)
    {
        u16 i,Temp_data;
        for(i=0; i<8; i++)
        {
            Temp_data = W_bits;
            Temp_data <<= i;
            if((Temp_data&0x80)==0)
            {
                Clr_SID();
            }
            else
            {
                Set_SID();
            } 
            nop();
            Set_SCLK();
            
            nop();
            nop();
            
            Clr_SCLK();
            nop();
            
            Clr_SID();
        }
    }
    
    
    void Delay(u16 ms) 
    { 
        u16 i; 
        while(ms--)    
       { 
         for(i=1;i<(u16)(xtal*143-2);i++
             ; 
       }   
    }
    
    
    void LCD12864_Char_Set(byte y, byte x, byte *p) 
    { 
        if(y == 0)
        {
            W_1byte(0,0,(0x80+x)); 
        }
        
        if(y == 1)
        {
            W_1byte(0,0,(0x90+x));
        }
        
        if(y == 2)
        {
            W_1byte(0,0,(0x88+x));
        }
        
        if(y == 3)
        {
            W_1byte(0,0,(0x98+x));
        }
        
        while(*!= 0)
        {
            W_1byte(0,1,*p++);
        }
    }
    
    
    void Set_Draw(void)
    {
        W_1byte(0,0,0x01);     // clear the screen
        Delay(20);       //儺珂
        W_1byte(0,0,0x34);     // 8BIT control interface, expanded instruction set, graphics OFF
        Delay(20);       //儺珂
    }
    
    
    void Draw_Pic(byte x, byte y, const byte *Draw)
    {
        byte i, j, temp_x, temp_y;
        temp_x = x;
        temp_y = y;
        temp_x |= 0x80;
        temp_y |= 0x80;
        
        for(i=0;i<32;i++ )
        {
            W_1byte(0,0,temp_y++);    // set the drawing area of ??the Y address coordinates
            W_1byte(0,0,temp_x);  // set the drawing area coordinates of the X address
            for(j=0;j<16;j++)
            {
                W_1byte(0,1,*Draw);
                Draw++;
            }
        }
    
        temp_x = 0x88;
        temp_y = 0x80;
        j = 0;
    
        for(;i<64;i++ )
        {
            W_1byte(0,0,temp_y++);    // set the drawing area of ??the Y address coordinates
            W_1byte(0,0,temp_x);   // set the drawing area coordinates of the X address
            for(j=0;j<16;j++)
            {
                W_1byte(0,1,*Draw);
                Draw++;
            }
        }
     
    }
    
    
    void Lcd_flash(u16 delay_t, byte times)
    {
        byte j;
        
        for(j=0;j<times;j++)
        {
            W_1byte(0,0,0x08);    // turn off the display
            Delay(delay_t);
            
            W_1byte(0,0,0x0c);    // open display
            Delay(delay_t);
        }
    }
    
        
    void Move(byte step,byte dirction,u16 time)
    {
        byte i;
        for(i=0;i<step;i++)       // move steps
        {
             W_1byte(0,0,dirction);      // Text direction of movement
             Delay(time);              // move time control
        }
    }
    
    void bsp_lcd12864_gpio_init(void)
    {
    
        sbi(LCD12864_DDR, LCD12864_RS_PIN_NO);
        sbi(LCD12864_DDR, LCD12864_RW_PIN_NO);
        sbi(LCD12864_DDR, LCD12864_EN_PIN_NO);
        sbi(LCD12864_DDR, LCD12864_PSB_PIN_NO);
    
        sbi(LCD12864_PORT, LCD12864_RS_PIN_NO);
        sbi(LCD12864_PORT, LCD12864_RW_PIN_NO);
        sbi(LCD12864_PORT, LCD12864_EN_PIN_NO);
        
        cbi(LCD12864_PORT, LCD12864_PSB_PIN_NO);    
    
        LCD12864_DATA_DDR |= 0xFF;
    
     }
    
    void bsp_lcd12864_init(void)
    {
        //LCD12864_DDR |= _BV(LCD12864_PSB_PIN_NO);
        //LCD12864_PORT &= ~(_BV(LCD12864_PSB_PIN_NO));
        
        Clr_CS();
        Clr_SID();
        Clr_SCLK();
        
        //W_1byte(0,0,0x01);   // clear the screen
        
        LCD_Init0();
        Delay(1000);
        LCD_Init1();  // key, otherwise the LCD power-on re-starting will not be displayed
        
        //Delay(2000);
    }
    void service_lcd_12864_start(void)
 {
     // usart_puts("\r\nservice_lcd_12864_start()\r\n");
 
     bsp_lcd12864_gpio_init();
     bsp_lcd12864_init();
 
     // usart_puts("\r\nlcd12864 initialized.\r\n");
 
     LCD12864_Char_Set(1,0, (byte*)"test");
     LCD12864_Char_Set(2,0, (byte*)"LCD12864.");
     LCD12864_Char_Set(3,0, (byte*)"lee");
 
     // s_current_service = lcd12864StartService;
 }
        
    
cs

 

첨부파일 gggg.PNG
비밀번호 삭제하려면 비밀번호를 입력하세요.

목록

삭제 수정 답변

댓글 수정

비밀번호

수정 취소

/ byte

댓글 입력

이름 비밀번호 관리자답변보기

확인

/ byte


* 왼쪽의 문자를 공백없이 입력하세요.(대소문자구분)

회원에게만 댓글 작성 권한이 있습니다.

관련 글 보기

관련글 모음
번호 상품명 제목 작성자 작성일 조회
495 12864 그래픽 LCD for Rabbit 개발보드 그래픽lcd질문있습니다 HIT파일첨부 이길준 2015-08-12 1880
471 12864 그래픽 LCD for Rabbit 개발보드 그래픽lcd 문의 HIT 박준서 2015-03-30 1857
146 12864 그래픽 LCD for Rabbit 개발보드 12864 그래픽 LCD for Rabbit 개발보드 문의드립니다. HIT 안인규 2012-08-25 1814
148 12864 그래픽 LCD for Rabbit 개발보드    답변 12864 그래픽 LCD for Rabbit 개발보드 문의드립니다. HIT파일첨부 관리자 2012-08-27 1884
101 12864 그래픽 LCD for Rabbit 개발보드 비밀글 LCD12864 연결문제 박철순 2012-05-29 1