1384 |
mija |
1 |
/* mija 2008 |
|
|
2 |
|
|
|
3 |
*.h file for defines lcd.c |
|
|
4 |
|
|
|
5 |
data PIN_D0 |
|
|
6 |
PIN_D1 |
|
|
7 |
PIN_D2 |
|
|
8 |
PIN_D3 |
|
|
9 |
write PIN_E |
|
|
10 |
commamnd/data PIN_RS |
|
|
11 |
|
|
|
12 |
!!!!NOTE must be set PIN with PORT and DDR |
|
|
13 |
*/ |
|
|
14 |
|
|
|
15 |
//************************************************************* |
|
|
16 |
|
|
|
17 |
#define PIN_D0 PD1 |
|
|
18 |
#define PORT_D0 PORTD |
|
|
19 |
#define DDR_D0 DDRD |
|
|
20 |
|
|
|
21 |
#define PIN_D1 PD2 |
|
|
22 |
#define PORT_D1 PORTD |
|
|
23 |
#define DDR_D1 DDRD |
|
|
24 |
|
|
|
25 |
#define PIN_D2 PD0 |
|
|
26 |
#define PORT_D2 PORTD |
|
|
27 |
#define DDR_D2 DDRD |
|
|
28 |
|
|
|
29 |
#define PIN_D3 PC5 |
|
|
30 |
#define PORT_D3 PORTC |
|
|
31 |
#define DDR_D3 DDRC |
|
|
32 |
|
|
|
33 |
#define PIN_E PD4 |
|
|
34 |
#define PORT_E PORTD |
|
|
35 |
#define DDR_E DDRD |
|
|
36 |
|
|
|
37 |
#define PIN_RS PD3 |
|
|
38 |
#define PORT_RS PORTD |
|
|
39 |
#define DDR_RS DDRD |
|
|
40 |
|
|
|
41 |
//************************************************************* |
|
|
42 |
|
|
|
43 |
void LCD_init(void); |
|
|
44 |
void LCD_putc(uint8_t data); |
|
|
45 |
void LCD_gotoxy( uint8_t x, uint8_t y); |
|
|
46 |
void LCD_clear(void); |
|
|
47 |
|
|
|
48 |
void LCD_send_data(uint8_t data); |
|
|
49 |
void LCD_send_command(uint8_t data); |
|
|
50 |
void LCD_send(uint8_t data); |
|
|
51 |
void LCD_send_nibble(uint8_t data); |
|
|
52 |
void LCD_init_IO_PIN(void); |
|
|
53 |
|
|
|
54 |
//************************************************************* |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
//********************** example printf *********************** |
|
|
58 |
/* |
|
|
59 |
#inlcude <stdio.h> |
|
|
60 |
|
|
|
61 |
static int put_lcd(char c, FILE *stream); |
|
|
62 |
static FILE mystdout = FDEV_SETUP_STREAM(put_lcd, NULL,_FDEV_SETUP_WRITE); |
|
|
63 |
|
|
|
64 |
static int put_lcd(char c, FILE *stream) |
|
|
65 |
{ |
|
|
66 |
switch (c) |
|
|
67 |
{ |
|
|
68 |
case '\n': LCD_gotoxy(1,2);break; |
|
|
69 |
case '\r': LCD_gotoxy(1,1);break; |
|
|
70 |
default : LCD_putc(c); |
|
|
71 |
} |
|
|
72 |
return 0; |
|
|
73 |
}*/ |
|
|
74 |
//************************************************************* |
|
|
75 |
|