forked from fysteven/LEDDotMatrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDotled.c
133 lines (115 loc) · 3.53 KB
/
Dotled.c
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
/*********************************************************************************************
* File: Dotled.c
* Author: embest
* Desc: DotLed_Test
* History:
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/* include files */
/*------------------------------------------------------------------------------------------*/
#include "2410lib.h"
#include "ziku.h"
#include "fonts.h"
#include "led16x16.h"
/*------------------------------------------------------------------------------------------*/
/* constant define */
/*------------------------------------------------------------------------------------------*/
#define En_Dataout rGPBDAT |= 0x20
#define DisEn_Dataout rGPBDAT &= 0xFFDF
#define CLK_H rGPDDAT |= 0x400
#define CLK_L rGPDDAT &= 0xFBFF
#define Rdata_H rGPCDAT |= 0x1
#define Rdata_L rGPCDAT &= 0xFFFE
#define Ldata_H rGPCDAT |= 0x1
#define Ldata_L rGPCDAT &= 0xFFFE
#define Lstr_H rGPBDAT |= 0x10
#define Lstr_L rGPBDAT &= 0xFFEF
#define Rstr_H rGPGDAT |= 0x100
#define Rstr_L rGPGDAT &= 0xFEFF
/*------------------------------------------------------------------------------------------*/
/* global variables */
/*------------------------------------------------------------------------------------------*/
INT8T cTemp;
INT8T cEnChange0,cEnChange1;
UINT8T dispram[32];
/*********************************************************************************************
* name: write_L4094
* func: write list data
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void write_L4094(UINT16T data)
{
UINT8T i;
Lstr_H;
for(i=0;i<16;i++)
{
CLK_L;
if(data & 0x01==1)
Ldata_H;
else
Ldata_L;
data = data >> 1;
CLK_H;
}
Lstr_L;
}
/*********************************************************************************************
* name: write_R4094
* func: write row data
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void write_R4094(UINT8T data)
{
UINT8T i;
Rstr_H;
for(i = 0; i < 8; i++)
{
CLK_L;
if(data & 0x01==1)
Rdata_H;
else
Rdata_L;
data = data >> 1;
CLK_H;
}
Rstr_L;
}
/*********************************************************************************************
* name: led_char_disp
* func: led char display
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
void led_char_disp(void) //ÔÚLED¾ØÕóÉÏÏÔʾ×Ö·û
{
UINT8T i=0;
UINT8T j=2,k=0;
UINT16T x;
for(i = 0; i < 32; i++)
dispram[i] = ~l_display_array[i];
i=0;
while(i < 16)
{
Rstr_L; // Enable RSTR
Lstr_L; // Enable LSTR
DisEn_Dataout; // lock the data
do { // Write the row data
j--;
write_R4094(dispram[i * 2 + j]);
}while(j);
x=~(0x8000 >> i); // Write one list data
write_L4094(x);
En_Dataout; // Output the data
for(k = 0;k < 250; k++);
i++;
j = 2;
}
}