完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
本帖最后由 tjw1102595269 于 2015-12-19 19:24 编辑
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File #include "DSP2833x_Examples.h" // DSP2833x Examples Include File //#include "f2812a.h" #define LED (*(unsigned short int *)0x180000) #define SRAM_Base_Adress 0x100000 #define LCDDELAY 1 #define LCDCMDTURNON 0x3f #define LCDCMDTURNOFF 0x3e #define LCDCMDSTARTLINE 0xc0 #define LCDCMDPAGE 0xb8 #define LCDCMDVERADDRESS 0x40 #define CTRGR *(int *)0x208000 #define CTRLCDCMDR *(int *)0x208001 #define CTRKEY *(int *)0x208001 #define CTRLCDCR *(int *)0x208002 #define CTRCLKEY *(int *)0x208002 #define CTRLCDLCR *(int *)0x208003 #define CTRLCDRCR *(int *)0x208004 #define CTRLA *(int *)0x208005 #define CTRLR *(int *)0x208007 void Delay1(unsigned int ntime); // 延时子程序 void Delay(unsigned int nTime); // 延时子程序 void TurnOnLCD(); // 打开显示 void LCDCLS(); // 清除屏幕显示内容 unsigned char ledkey[12][8]= { {0x00,0x00,0x7C,0x82,0x82,0x82,0x7C,0x00}, //0 {0x00,0x00,0x00,0x84,0xFE,0x80,0x00,0x00}, //1 {0x00,0x00,0x84,0xC2,0xA2,0x92,0x8C,0x00}, //2 {0x00,0x00,0x44,0x92,0x92,0x92,0x6C,0x00}, {0x00,0x00,0x30,0x28,0x24,0xFE,0x20,0x00}, {0x00,0x00,0x4E,0x92,0x92,0x92,0x62,0x00}, {0x00,0x00,0x7C,0x92,0x92,0x92,0x64,0x00}, {0x00,0x00,0x02,0xC2,0x32,0x0A,0x06,0x00}, {0x00,0x00,0x6C,0x92,0x92,0x92,0x6C,0x00}, {0x00,0x00,0x4C,0x92,0x92,0x92,0x7C,0x00} }; void main(void) { int i,nCount=0,nBW=0; long a; InitSysCtrl(); InitXintf16Gpio(); InitPieCtrl(); IER = 0x0000; IFR = 0x0000; CTRGR=0x80; // 初始化ICETEK-CTR Delay(LCDDELAY); CTRGR=0x0; Delay(LCDDELAY); CTRGR=0x80; Delay(LCDDELAY); CTRLR=0; // 关闭东西方向的交通灯 Delay(LCDDELAY); CTRLR=0x40; // 关闭南北方向的交通灯 Delay(LCDDELAY); TurnOnLCD(); // 打开显示 LCDCLS(); // 清除显示内存 CTRLCDCMDR=LCDCMDSTARTLINE; // 设置显示起始行 Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); for (;;) { CTRLCDCMDR=LCDCMDPAGE; // 设置操作页=0 Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); CTRLCDCMDR=LCDCMDVERADDRESS; // 起始列=0 Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); for(a=0;a<=9;a++) { { LED=a;} Delay(3000); } for (i=0;i<8;i=LED ) { CTRLCDLCR=( nBW==0 )?(ledkey[nCount]):(~ledkey[nCount]);// 屏幕左侧第1至8行第i列赋值 port8002=0; // (赋值后当前操作列自动加1,所以不需设置) Delay(LCDDELAY); CTRLCDCR=0; Delay(3000); //延时子程序 nCount++; } if ( nCount==10 ) { nCount=0; nBW=1-nBW; } } void Delay(unsigned int nDelay) { int ii,jj,kk=0; for ( ii=0;ii for ( jj=0;jj<512;jj++ ) { kk++; } } } void Delay1(unsigned int nDelay) { int a,j,k=0; for(a=0;a for(j=0;j<1024;j++) { k++; } } } void TurnOnLCD() { CTRLCDCMDR=LCDCMDTURNON; Delay(LCDDELAY); CTRLCDCR=0; Delay(2048); CTRLCDCMDR=LCDCMDSTARTLINE; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); } void LCDCLS() { int i,j; CTRLCDCMDR=LCDCMDSTARTLINE; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); for ( i=0;i<8;i++ ) { CTRLCDCMDR=LCDCMDPAGE+i; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); CTRLCDCMDR=LCDCMDVERADDRESS; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); for ( j=0;j<64;j++ ) { CTRLCDLCR=0; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); } CTRLCDCMDR=LCDCMDPAGE+i; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); CTRLCDCMDR=LCDCMDVERADDRESS; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); for ( j=0;j<64;j++ ) { CTRLCDRCR=0; Delay(LCDDELAY); CTRLCDCR=0; Delay(LCDDELAY); } } } |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于 DSP5509 进行数字图像处理中 Sobel 算子边缘检测的硬件连接电路图
2426 浏览 0 评论
695 浏览 0 评论
普中科技F28335开发板中,如何使用aic23播放由代码生成的正弦波
2865 浏览 0 评论
3629 浏览 1 评论
1205 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 16:33 , Processed in 0.397183 second(s), Total 41, Slave 35 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号