DSP技术课程设计Word格式文档下载.docx
- 文档编号:18141979
- 上传时间:2022-12-13
- 格式:DOCX
- 页数:19
- 大小:19.37KB
DSP技术课程设计Word格式文档下载.docx
《DSP技术课程设计Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《DSP技术课程设计Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。
/*DSP的IO空间,扩展发光二极管、键盘、液晶等外围设备*/
ioportunsignedport0800;
//lcddataio
ioportunsignedport1000;
//lcdreset
ioportunsignedport0c00;
//lcddi
ioportunsignedport1400;
//lcdcs1
ioportunsignedport1800;
//lcdcs2
//对端口的定义
ioportunsignedport2C00;
//faguang
charpast=254;
charkeyvalue1;
inti=0;
/*ToDecideTheAICSampleFrequency*/
/*DSP的IO空间,扩展发光二极管、数码管、键盘、液晶等外围设备*/
ioportunsignedport1C00;
//键盘行列线
charnum26[]={0,0x7F,0x49,0x49,0x49,0x49,0x00,0x00};
//"
E"
=26H
charnum2d[]={0,0x7F,0x40,0x40,0x40,0x40,0x00,0x00};
L"
=2DH
charnum30[]={0,0x3E,0x41,0x41,0x41,0x3E,0x00,0x00};
O"
=30H
charnum37[]={0,0x1F,0x20,0x40,0x20,0x1F,0x00,0x00};
V"
=37H
charnum10[]={0,0x32,0x49,0x79,0x41,0x3E,0x00,0x00};
@"
=10H
charnum0[]={0,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00};
0"
=00H
charnum1[]={0,0x00,0x42,0x7F,0x40,0x00,0x00,0x00};
1"
=01H
charnum2[]={0,0x42,0x61,0x51,0x49,0x46,0x00,0x00};
2"
=02H
charnum3[]={0,0x21,0x41,0x45,0x4B,0x31,0x00,0x00};
3"
=03H
charnum4[]={0,0x18,0x14,0x12,0x7F,0x10,0x00,0x00};
4"
=04H
charnum5[]={0,0x27,0x45,0x45,0x45,0x39,0x00,0x00};
5"
=05H
charnum6[]={0,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00};
6"
=06H
charnuml1[]={0x44,0x44,0xFC,0x44,0x44,0x10,0xD0,0xFF};
charnuml2[]={0x90,0x00,0xD0,0xFF,0xD0,0x10,0x10,0x00};
charnuml3[]={0x08,0x08,0x07,0x14,0x08,0x06,0x01,0xFF};
charnuml4[]={0x04,0x03,0x00,0xFF,0x01,0x0E,0x08,0x00};
charnumj1[]={0x00,0x08,0x08,0x08,0x88,0x48,0x38,0xFF};
charnumj2[]={0x18,0x28,0x48,0x88,0x88,0x08,0x00,0x00};
charnumj3[]={0x40,0x32,0x02,0x01,0x10,0x60,0x00,0x07};
charnumj4[]={0x10,0x60,0x00,0x00,0x11,0x63,0x01,0x00};
//所需要的汉字、数字和字符的显示代码
charrdkey();
charscan_key();
voidmmm();
voidmain()
{
charkeyvalue=255;
c54_init();
for(;
;
){
keyvalue=scan_key();
if(keyvalue!
=255)
past=keyvalue;
if(past==0)
{
port2C00=0xfd;
loop0();
port2C00=0xfb;
port2C00=0xf7;
port2C00=0xef;
port2C00=0xdf;
port2C00=0xbf;
port2C00=0x7f;
i=i+1;
mmm();
i=0;
}
elseif(past==1)
port2C00=0x7f;
port2C00=0xfe;
elseif(past==2)
port2C00=0xe7;
port2C00=0xdb;
port2C00=0xbd;
port2C00=0x7e;
port2C00=0xe7;
port2C00=0xff;
elseif(past==3)
port2C00=0x7e;
port2C00=0x3c;
port2C00=0x18;
port2C00=0x00;
elseif(past==4)
port2C00=0xaa;
loop0();
port2C00=0x55;
loop0();
}
}
//循环和流水灯花样的控制
charrdkey(){
charkeyin;
port1C00=0x0;
keyin=port1C00;
keyin=keyin&
0xF;
if(keyin==0xF)
return0;
else
return1;
charscan_key(){
charkeyornot;
intkeyin;
intkeyvalue;
keyornot=rdkey();
if(!
keyornot){
return255;
}
delay3();
if(keyornot){//某个键按下!
port1C00=0xe;
keyin=port1C00&
if(keyin!
=0xF){
keyvalue=0;
keyin=keyin;
keyvalue=keyin+keyvalue-7;
while(keyornot=rdkey())//等键松下
delay3();
port1C00=0xd;
keyvalue=1;
keyvalue=keyin+keyvalue;
while(keyornot=rdkey())
port1C00=0xb;
keyvalue=9;
port1C00=0x7;
keyvalue=17;
if(keyvalue==0x7){
keyvalue=0;
lcd_dsp(0,8,1,num1);
gotoproecess;
}
if(keyvalue==0x6){
keyvalue=1;
lcd_dsp(0,8,1,num2);
//调用显示语句,显示数字
if(keyvalue==0x4){
keyvalue=2;
lcd_dsp(0,8,1,num3);
//调用显示语句,显示数字
if(keyvalue==0x0){
keyvalue=3;
lcd_dsp(0,8,1,num4);
if(keyvalue==0xf){
keyvalue=4;
lcd_dsp(0,8,1,num5);
if(keyvalue==0xe){
keyvalue=5;
lcd_dsp(0,8,1,num6);
if(keyvalue==0xc){
keyvalue=6;
if(keyvalue==0x8){
keyvalue=7;
if(keyvalue==0x17){
keyvalue=8;
if(keyvalue==0x16){
keyvalue=9;
if(keyvalue==0x14){
keyvalue=10;
if(keyvalue==0x10){
keyvalue=11;
if(keyvalue==0x1f){
keyvalue=12;
if(keyvalue==0x1e){
keyvalue=13;
if(keyvalue==0x1c){
keyvalue=14;
if(keyvalue==0x18){
keyvalue=15;
proecess:
returnkeyvalue;
voidmmm()
temp=port1000;
///RES=0,resetlcd
delay2();
port1000=temp;
///RES=1,enablelcd
Init_Lcd();
//initializelcd
Cls_Lcd();
//清屏
lcd_dsp(0,1,1,numl1);
//显示文字的初始位置
lcd_dsp(0,1,2,numl2);
lcd_dsp(0,2,1,numl3);
lcd_dsp(0,2,2,numl4);
lcd_dsp(0,7,1,numj1);
lcd_dsp(0,7,2,numj2);
lcd_dsp(0,8,1,numj3);
lcd_dsp(0,8,2,numj4);
//延时
//清屏
lcd_dsp(0,1,1+i,numl1);
//使每次显示的文字的位置发生变化达到动起来的效果lcd_dsp(0,1,2+i,numl2);
lcd_dsp(0,2,1+i,numl3);
lcd_dsp(0,2,2+i,numl4);
lcd_dsp(0,7,i+1,numj1);
lcd_dsp(0,7,i+2,numj2);
lcd_dsp(0,8,i+1,numj3);
lcd_dsp(0,8,i+2,numj4);
lcd_dsp(1,1,1,numl1);
//(哪半屏,第几页,第几个字,字符数据)
lcd_dsp(1,1,2,numl2);
lcd_dsp(1,2,1,numl3);
lcd_dsp(1,2,2,numl4);
lcd_dsp(1,7,1,numj1);
lcd_dsp(1,7,2,numj2);
lcd_dsp(1,8,1,numj3);
lcd_dsp(1,8,2,numj4);
lcd_dsp(1,1,1+i,numl1);
//在右半屏的初始位置
lcd_dsp(1,1,2+i,numl2);
lcd_dsp(1,2,1+i,numl3);
lcd_dsp(1,2,2+i,numl4);
lcd_dsp(1,7,i+1,numj1);
lcd_dsp(1,7,i+2,numj2);
lcd_dsp(1,8,i+1,numj3);
lcd_dsp(1,8,i+2,numj4);
lcd_dsp(1,1,2+i,numl1);
lcd_dsp(1,1,3+i,numl2);
lcd_dsp(1,2,2+i,numl3);
lcd_dsp(1,2,3+i,numl4);
lcd_dsp(1,7,i+2,numj1);
lcd_dsp(1,7,i+3,numj2);
lcd_dsp(1,8,i+2,numj3);
lcd_dsp(1,8,i+3,numj4);
lcd_dsp(0,4,1,num2d);
//L
lcd_dsp(0,4,2,num30);
//O
lcd_dsp(0,4,3,num37);
//V
lcd_dsp(0,4,4,num26);
//E
lcd_dsp(1,4,1,num2d);
//?
lcd_dsp(1,4,2,num30);
lcd_dsp(1,4,3,num37);
lcd_dsp(1,4,4,num26);
//最终定位不在清屏
voidlcd_dsp(charlorr,charpage_cnt,charline,charnumx[]){//写入一个8*8的字符
charclr_byte_cnt;
page_cnt=(page_cnt-1)|0xb8;
//设置页号
line=(line-1)*8+0x40;
//改字符的起始列
if(lorr==0){//写-l块(左半屏)
Wr_c_l(page_cnt);
Wr_c_l(line);
for(clr_byte_cnt=1;
clr_byte_cnt<
=8;
clr_byte_cnt++){//将numx[]写入
Wr_d_l(numx[clr_byte_cnt-1]);
//在对应列写入一字节数据
else{//写-r块(右半屏)
Wr_c_r(page_cnt);
Wr_c_r(line);
clr_byte_cnt++){
Wr_d_r(numx[clr_byte_cnt-1]);
voidWr_c_r(charcom){//向块1写指令(右半屏)
chartemp;
temp=port1400;
//cs1=0
delay1();
port1800=temp;
//cs2=1,选中块1
temp=port0c00;
//di=0
temp=port0800&
0x80;
//E=1,读状态字,判忙
while(temp==0x80){
temp=port0800&
delay1();
port0800=com;
//E=1,将com作为指令写入
voidWr_c_l(charcom){//向块2写指令(左半屏)
//chartemp;
port1400=temp;
//cs1=1
temp=port1800;
//cs2=0,选中块2
//di=0
//读状态字,判忙
del
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- DSP 技术 课程设计