您的位置 首页 芯闻

MC9S12XS128驱动LEDP10显示屏

includeincludederivativehdefineBPORTA_PA0数据串行输入时钟defineCPORTA_PA2数据输出时钟defineDPORT

#include

#include “derivative.h”
#define B PORTA_PA0 //数据串行输入时钟
#define C PORTA_PA2 //数据输出时钟
#define D PORTA_PA4 //74LS138使能时钟
#define A PORTA_PA1 //行选
#define CP PORTA_PA5 //行选
#define SC PORTA_PA6 //行选
#define RI PORTA_PA3 //串行数据
#define CT PORTA_PA7
#define DIR DDRA //数据方向
#define BUS_CLOCK 32000000 //总线频率
unsigned char ziku[4][32]={
0xFB,0xBF,0xFB,0xBF,0xC0,0x03,0xFB,0xBF,0xFB,0xBF,0x80,0x01,0xFB,0xBF,0xF7,0xDF,
0xEE,0xEF,0xDE,0xF7,0x3E,0xF9,0xEE,0xAF,0xEE,0xD7,0xDE,0xD7,0xFA,0xFF,0xFD,0xFF,
0xFE,0xFF,0x80,0x03,0xFE,0xFF,0xC0,0x07,0xFF,0xFF,0xE0,0x0F,0xEF,0xEF,0xE0,0x0F,
0xFB,0xBF,0x00,0x01,0xFF,0xFF,0xE0,0x0F,0xEF,0xEF,0xEF,0xEF,0xE0,0x0F,0xFF,0xFF,
0xFD,0xFF,0xDD,0xBF,0xDD,0xCF,0xDD,0xEF,0x80,0x01,0xDB,0xFF,0xFB,0xFF,0xF8,0x1F,
0xF3,0xDF,0xF5,0xDF,0xF5,0xDF,0xEE,0xBF,0xDF,0x7F,0xBE,0x9F,0x79,0xE3,0xE7,0xF7,
0xFF,0xF7,0x81,0xF7,0xBD,0xF7,0xB5,0xF7,0xB5,0x01,0xB5,0xE7,0xB5,0xE7,0xB5,0xD7,
0xB5,0xD7,0xB5,0xB7,0xF7,0xB7,0xEB,0x77,0xED,0xF7,0xDC,0xF7,0xBD,0xD7,0x7F,0xEF
};
void init();
void shuru(unsigned char data);
void shuchu();
void delay(unsigned char p);
void hangxuan(unsigned char P);
void timer_init();
void shuru1();
void INIT_PLL(void);
unsigned char hang=0,zi=0,shu=0;
void main(void)
{
init();
INIT_PLL();
timer_init();
while(1)
{
for(hang=0;hang<16;hang++)
{
for(zi=0;zi<4;zi++)
{
shuru(ziku[zi][2*hang]);
shuru(ziku[zi][2*hang+1]);
}
shuru1();
hangxuan(hang);
shuchu();
}
}
}
void shuru(unsigned char data)
{
unsigned char j=0;
for(j=0;j<8;j++)
{
RI=((data<
CP=0;
asm NOP;
CP=1;
asm NOP;
}
}
void shuru1()
{
unsigned char j=0;
for(j=0;j
{
if(j<64)
{
RI=1;
CP=0;
asm NOP;
CP=1;
asm NOP;
}
else
{
RI=((ziku[(j-64)/16][2*hang+((j)>7? 1:0)]<<(j%8))&0x80)==0x80? 1:0;
CP=0;
asm NOP;
CP=1;
asm NOP;
}
}
}
void shuchu()
{
SC=0;
asm NOP;
SC=1;
asm NOP;
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/xinwen/256865.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部