OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [rtl/] [src_peripheral/] [display/] [lcd_2x16/] [lcd_2x16] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
#ifndef ${IP}_H
2
        #define         ${IP}_H
3
 
4
 
5
        #define         ${IP}_WAIT_CNT          (${IP}_CLK_MHZ*100)
6
        #define         ${IP}_COLUMN_NUM                16
7
        #define         ${IP}_ROW_NUM           2
8
 
9
        const char base_y[4]={0x80,0xc0,${IP}_COLUMN_NUM+0x80,${IP}_COLUMN_NUM+0xc0};
10
 
11
        #define         ${IP}_set_8_bit_1_line()                ${IP}_wr_cmd_func(0x30)
12
        #define         ${IP}_set_8_bit_2_line()                ${IP}_wr_cmd_func(0x38)
13
        #define         ${IP}_set_4_bit_1_line()                ${IP}_wr_cmd_func(0x20)
14
        #define         ${IP}_set_4_bit_3_line()                ${IP}_wr_cmd_func(0x28)
15
        #define         ${IP}_entry_mode()              ${IP}_wr_cmd_func(0x06)
16
//(clearing display without clearing ddram content)
17
        #define         ${IP}_dsply_off_cursor_off()    ${IP}_wr_cmd_func(0x08)
18
        #define         ${IP}_dsply_on_cursor_on()      ${IP}_wr_cmd_func(0x0e)
19
        #define         ${IP}_dsply_on_cursor_off()     ${IP}_wr_cmd_func(0x0c)
20
        #define         ${IP}_dsply_on_cursor_blink()   ${IP}_wr_cmd_func(0x0f)
21
        #define         ${IP}_shift_dsply_left()                ${IP}_wr_cmd_func(0x18)
22
        #define         ${IP}_shift_dsply_right()               ${IP}_wr_cmd_func(0x1c)
23
        #define         ${IP}_shift_cursor_left()       ${IP}_wr_cmd_func(0x10)
24
        #define         ${IP}_shift_cursor_right()      ${IP}_wr_cmd_func(0x14)
25
//(also clear ddram content)
26
        #define         ${IP}_clr_dsply()                       ${IP}_wr_cmd_func(0x01)
27
        #define         ${IP}_goto_line(line_num)               ${IP}_wr_cmd_func(base_y[line_num-1])    // 1<= lines num <= ${IP}_ROW_NUM
28
        #define         ${IP}_gotoxy(x,y)               ${IP}_wr_cmd_func(base_y[y]+x)// 0<= x< ${IP}_COLUMN_NUM;   0<= y < ${IP}_ROW_NUM
29
        #define         ${IP}_show_character(c)         ${IP}_wr_data_func(c);
30
 
31
 
32
 
33
inline void ${IP}_wait(unsigned int volatile num){
34
        while (num>0){
35
                num--;
36
                asm volatile ("nop");
37
        }
38
        return;
39
}
40
 
41
 
42
inline void ${IP}_wr_cmd_func( char data){
43
        ${IP}_WR_CMD= data;
44
        ${IP}_wait(${IP}_WAIT_CNT);
45
}
46
 
47
inline void ${IP}_wr_data_func( char data){
48
        ${IP}_WR_DATA=data;
49
        ${IP}_wait(${IP}_WAIT_CNT);
50
}
51
 
52
 
53
 
54
 
55
 
56
 
57
void ${IP}_init()
58
{
59
  ${IP}_set_8_bit_2_line();
60
  ${IP}_dsply_on_cursor_off();
61
  ${IP}_clr_dsply();
62
  ${IP}_entry_mode();
63
  ${IP}_goto_line(1);
64
}
65
 
66
//-------------------------------------------------------------------------
67
void ${IP}_show_text(char* Text, unsigned char length)
68
{
69
  int i;
70
  for(i=0;i
71
}
72
 
73
 
74
 
75
 
76
 
77
 
78
#ifdef ${IP}_TEST_ENABLE
79
 
80
 
81
 
82
//-------------------------------------------------------------------------
83
 
84
const char test_text[4][17]= {"${IP} 2x16 test   ", "  ProNoC SoC    ","Test Line 3     ","Test Line 4     "};
85
 
86
 
87
void ${IP}_test()
88
{
89
  unsigned int x,y;
90
 
91
  //  Initial ${IP}
92
  ${IP}_init();
93
  //  Show Text to ${IP}
94
  for(y=1;y<=${IP}_ROW_NUM;y++)  {
95
        ${IP}_goto_line(y);
96
        ${IP}_show_text((char*)test_text[y-1],16);
97
  }
98
 
99
  ${IP}_wait(1000*${IP}_WAIT_CNT);
100
  ${IP}_clr_dsply();
101
 
102
  for(y=0;y<${IP}_ROW_NUM;y++){
103
         for(x=0;x<${IP}_COLUMN_NUM;x++){
104
 
105
                ${IP}_gotoxy(x,y);
106
                ${IP}_show_character(test_text[y][x]);
107
                ${IP}_wait(500*${IP}_WAIT_CNT);
108
        }
109
  }
110
 
111
 
112
}
113
//-------------------------------------------------------------------------
114
 
115
#endif
116
 
117
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.