2298 |
jacho |
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 PC3 |
|
|
18 |
#define PORT_D0 PORTC |
|
|
19 |
#define DDR_D0 DDRC |
|
|
20 |
|
|
|
21 |
#define PIN_D1 PB4 |
|
|
22 |
#define PORT_D1 PORTB |
|
|
23 |
#define DDR_D1 DDRB |
|
|
24 |
|
|
|
25 |
#define PIN_D2 PB5 |
|
|
26 |
#define PORT_D2 PORTB |
|
|
27 |
#define DDR_D2 DDRB |
|
|
28 |
|
|
|
29 |
#define PIN_D3 PB3 |
|
|
30 |
#define PORT_D3 PORTB |
|
|
31 |
#define DDR_D3 DDRB |
|
|
32 |
|
|
|
33 |
#define PIN_E PB1 |
|
|
34 |
#define PORT_E PORTB |
|
|
35 |
#define DDR_E DDRB |
|
|
36 |
|
|
|
37 |
#define PIN_RS PB2 |
|
|
38 |
#define PORT_RS PORTB |
|
|
39 |
#define DDR_RS DDRB |
|
|
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 |
|