- 註冊時間
- 2006-1-29
- 最後登錄
- 2022-8-18
- 主題
- 查看
- 積分
- 72
- 閱讀權限
- 30
- 文章
- 35
- 相冊
- 0
- 日誌
- 0
狀態︰
離線
|
#include "reg51.h"
#define COLS 16
#define ROWS 2
char ScanLine=0;
char i=0;
char j;
char ucDelay = 0x00;
sbit P1_4=0x94;
sbit P1_5=0x95;
const unsigned char pattern[COLS][ROWS]=
{{0xdf,0xff},{0xdf,0xdf},
{0xdf,0xef},{0xdd,0xf7},
{0xd3,0xf9},{0x1f,0xfe},
{0xdf,0xff},{0xc0,0xff},
{0xdf,0xff},{0x1f,0xe0},
{0xd7,0xdf},{0xdb,0xdf},
{0xdd,0xdf},{0xcd,0xdf},
{0xdf,0xc3},{0xff,0xff}};
main()
{
IE=0x82;
TMOD=0x01;
TH0=(65536-100)/256;
TL0=(65536-100)%256;
TR0=1;
P1_4=0;
P1_5=0;
while(1)
{
Clock_Delay(); /////此有問題 要怎追加功能?
P1=ScanLine;
P2=pattern[j++];
P1_4=1; /* latch pulse */
P1_4=0;
P2 = 0xff;
//
P2=pattern[i++][j];
P1_5=1; /* latch pulse */
P1_5=0;
P2 = 0xff;
//
ucDelay = 1;
while(ucDelay!=0x00);
//
P1=0xff;
//
j = 0;
ScanLine++;
if(ScanLine==COLS)
{
ScanLine=0;
i=0;
}
}
}
/* main */
void T0_int(void) interrupt 1 /* matrix led scan : T0=2ms */
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
//
if(ucDelay != 0x00)
{
ucDelay --;
}
}
|
|