도트매트릭스 초보 질문이요
글쓴이: hhmy95 / 작성시간: 화, 2017/10/17 - 5:10오후
도트매트릭스에 속도, 시간을 출력하는 과정에서 먼저 0~9에 대한 폰트를 원하는 위치에 출력하려고 하는데
이렇게 하면 출력이 이상하게 나오네요,,,,
어느부분이 문제인지 알수 있을까요,,,
오픈소스라 해석하기가 어렵네요ㅜ
unsigned int string_test[10][5] = {
{0x07, 0x05, 0x05, 0x05, 0x07}, // 0
{0x01, 0x01, 0x01, 0x01, 0x01}, // 1
{0x07, 0x01, 0x07, 0x04, 0x07}, // 2
{0x07, 0x01, 0x07, 0x01, 0x07},//3
{0x05, 0x05, 0x07, 0x01, 0x01},//4
{0x07, 0x04, 0x07, 0x01, 0x07},//5
{0x07, 0x04, 0x07, 0x05, 0x07},//6
{0x07, 0x05, 0x05, 0x01, 0x01},//7
{0x07, 0x05, 0x07, 0x05, 0x07},//8
{0x07, 0x05, 0x07, 0x01, 0x07}//9
};
void ActivePulse()
{
LE_ON; delay_us(1); LE_OFF; //래치 출력
OE_ON;
delay_us(100);
OE_OFF;
}
void row_dynamic()
{
static unsigned int str_cnt=0;
switch(str_cnt)//ROW SHIFT!
{
case 0:A0_OFF; A1_OFF; A2_OFF; A3_OFF;break;
case 1:A0_ON; A1_OFF; A2_OFF; A3_OFF; break;
case 2:A0_OFF; A1_ON; A2_OFF; A3_OFF; break;
case 3:A0_ON; A1_ON; A2_OFF; A3_OFF; break;
case 4:A0_OFF; A1_OFF; A2_ON; A3_OFF; break;
case 5:A0_ON; A1_OFF; A2_ON; A3_OFF; break;
case 6:A0_OFF; A1_ON; A2_ON; A3_OFF; break;
case 7:A0_ON; A1_ON; A2_ON; A3_OFF; break;
case 8:A0_OFF; A1_OFF; A2_OFF; A3_ON; break;
case 9:A0_ON; A1_OFF; A2_OFF; A3_ON; break;
case 10:A0_OFF; A1_ON; A2_OFF; A3_ON; break;
case 11:A0_ON; A1_ON; A2_OFF; A3_ON; break;
case 12:A0_OFF; A1_OFF; A2_ON; A3_ON; break;
case 13:A0_ON; A1_OFF; A2_ON; A3_ON; break;
case 14:A0_OFF; A1_ON; A2_ON; A3_ON; break;
case 15:A0_ON; A1_ON; A2_ON; A3_ON; break;
}
++str_cnt;
if(str_cnt==16)
{
str_cnt=0;
}
}
void shift_Register(unsigned char out)
{
unsigned char clk = 0;
for (clk = 0; clk < 8; clk++) {
if (out & (0x80 >> clk))
{
Data_Green_ON;
Data_Red_ON;
}
else
{
Data_Green_OFF;
Data_Red_OFF;
}
Clk_ON;
delay_us(1);
Clk_OFF;
}
}
void dot_display(unsigned char first)
{
unsigned int i = 0;
unsigned int buff[16] = {0};
unsigned char high = 0;
unsigned char low = 0;
for (i = 0; i < 16; i++)
{
buff[i] = string_test[first][i];
}
for (i = 0; i < 16; i++)
{
high=(buff[i]>>8);
low=(buff[i]&0xff);
shift_Register(high);
shift_Register(low);
row_dynamic();
ActivePulse();
}
}Forums:


댓글 달기