/[H7]/trunk/PIC/lcd.h
ViewVC logotype

Annotation of /trunk/PIC/lcd.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations) (download)
Mon Jan 29 09:45:25 2007 UTC (17 years, 4 months ago) by torben
File MIME type: text/plain
File size: 1644 byte(s)
Initial import of PIC module
1 torben 2 #ifndef _LCD_H_
2     #define _LCD_H_
3    
4     /*
5     * LCD interface header file
6     */
7    
8     /* Defining CHECKBUSY will check if the LCD is busy. The RW bit of the
9     * LCD must connected to a port of the processor for the check busy
10     * process to work.
11     *
12     * If CHECKBUSY is not defined it will instead use a delay loop.
13     * The RW bit of the LCD does not need to connected in this case.
14     */
15    
16     // #define CHECKBUSY 1
17    
18     #ifdef CHECKBUSY
19     #define LCD_WAIT lcd_check_busy()
20     #else
21     #define LCD_WAIT DelayMs(5)
22    
23     #endif
24    
25     #define MESSAGE_LINE 0x0
26    
27     #define LCD_RS LA3
28     #define LCD_EN LA1
29     #define LCD_RW LA2
30     #define LCD_DATA LATD
31     #define LCD_DATA_PORT PORTD
32     #define LCD_RS_TRIS TRISA3
33     #define LCD_EN_TRIS TRISA1
34     #define LCD_RW_TRIS TRISA2
35     #define LCD_DATA_TRIS TRISD
36    
37     #define FOURBIT_MODE 0x0
38     #define EIGHTBIT_MODE 0x1
39     #define OUTPUT_PIN 0x0
40     #define INPUT_PIN 0x1
41     #define OUTPUT_DATA 0x0
42     #define INPUT_DATA 0x0F
43    
44     #define LCD_STROBE() LCD_EN = 1; asm("nop"); asm("nop"); LCD_EN = 0
45    
46     #define LCD_STROBE_READ(value) LCD_EN = 1; \
47     asm("nop"); asm("nop"); \
48     value=LCD_DATA_PORT; \
49     LCD_EN = 0;
50    
51     #define lcd_cursor(x) lcd_cmd(((x)&0x7F)|0x80)
52     #define lcd_clear() lcd_cmd(0x1)
53     #define lcd_putch(x) lcd_data(x)
54     #define lcd_goto(x) lcd_cmd(0x80+(x));
55     #define lcd_cursor_right() lcd_cmd(0x14)
56     #define lcd_cursor_left() lcd_cmd(0x10)
57     #define lcd_display_shift() lcd_cmd(0x1C)
58     #define lcd_home() lcd_cmd(0x2)
59    
60     extern void lcd_cmd(unsigned char);
61     extern void lcd_data(unsigned char);
62     extern void lcd_puts(const char * s);
63     extern void lcd_init(unsigned char);
64    
65     #endif
66    

  ViewVC Help
Powered by ViewVC 1.1.20