16*96点阵仿真原理图如下
单片机源码如下:
#include #define uchar unsigned char #define uint unsigned int #define ulong unsigned long #define CTRL_PORT P2 #define DATA_PORT P0 #define ADDR_PORT P1 uchar code *p; uchar code zifu[12][32]={ {0x00,0x01,0x00,0x01,0x3F,0x01,0xA0,0x7F,0xA1,0x20,0x52,0x12,0x14,0x02,0x08,0x02, 0x18,0x02,0x18,0x06,0x24,0x05,0x24,0x09,0x82,0x18,0x61,0x70,0x1C,0x20,0x00,0x00}, {0x02,0x00,0x84,0x01,0x6C,0x3E,0x24,0x22,0x20,0x22,0x20,0x22,0x27,0x22,0x24,0x22, 0xA4,0x22,0x64,0x2A,0x24,0x12,0x04,0x02,0x04,0x02,0x0A,0x00,0xF1,0x7F,0x00,0x00}, {0x80,0x00,0x80,0x00,0xFC,0x3F,0x80,0x00,0x90,0x0C,0xA0,0x04,0xC0,0x02,0xFE,0x7F, 0x80,0x01,0xC0,0x02,0xA0,0x04,0x90,0x18,0x8C,0x70,0x83,0x20,0x80,0x00,0x80,0x00}, {0x60,0x02,0x1C,0x0A,0x10,0x12,0x10,0x12,0x10,0x02,0xFF,0x7F,0x10,0x02,0x10,0x12, 0x70,0x14,0x1C,0x0C,0x13,0x04,0x10,0x0A,0x90,0x49,0x10,0x50,0x14,0x60,0x08,0x40}, {0x40,0x00,0x80,0x00,0xFE,0x7F,0x02,0x40,0x21,0x22,0x10,0x04,0x08,0x08,0x04,0x10, 0xF8,0x0F,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xFE,0x3F,0x00,0x00}, {0x04,0x00,0xC8,0x3F,0x08,0x20,0x02,0x20,0xE2,0x27,0x22,0x24,0x22,0x24,0xE2,0x27, 0x22,0x24,0x22,0x24,0xE2,0x27,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x28,0x02,0x10} }; uchar select_hc138[][4]= { {0x20,0x21,0x22,0x23}, {0x24,0x25,0x26,0x27}, {0x10,0x11,0x12,0x13}, {0x14,0x15,0x16,0x17}, {0x18,0x19,0x1a,0x1b}, {0x1c,0x1d,0x1e,0x1f} }; void delay(void) { uchar i; for(i=0;i<20;i++); } void plany(void) { uchar i,j,k; for(k=0;k<6;k++) { for(j=0;j<1;j++) { for(i=0;i<8;i++) { CTRL_PORT=select_hc138[k][0]; DATA_PORT=zifu[k][2*i]; ADDR_PORT=i; delay(); CTRL_PORT=select_hc138[k][1]; DATA_PORT=zifu[k][2*i+1]; ADDR_PORT=i; delay(); } for(i=8;i<16;i++) { CTRL_PORT=select_hc138[k][2]; DATA_PORT=zifu[k][2*i]; ADDR_PORT=i-8; delay(); CTRL_PORT=select_hc138[k][3]; DATA_PORT=zifu[k][2*i+1]; ADDR_PORT=i-8; delay(); } } } } void PORT_init()//可放main中,初始化分开放main看起来简节一些 { TMOD=0x01; TH0=0xb1; TL0=0xe0; ET0=1; EA=1; } void main() { PORT_init(); while(1) { p=zifu; plany();//此处加一定的延时,让P=另外一个定义数组,就能达到换内容的效果 } } void timer0() interrupt 1 using 3 { TF0=0; TH0=0xb1; TL0=0xe0; }
上一篇:51单片机按键控制舵机
下一篇:单片机16层可剪裁电梯源码+Proteus仿真设计
推荐阅读
史海拾趣
人机界面(HMI)是近年来自动化和控制领域发展与变化的亮点。软硬件技术的进步大大推动了人机界面显示器与所控制系统的复杂性与精确度不断提高。图像和动画功能日益丰富,能够处理更复杂的任务,无线连接功能不断提高,这都有助于推动本领域的应用 ...… 查看全部问答∨ |
|
中文版LPC1114内存映射文件,代替NXP提供的LPC11XX.H文件和core_m0.h文件,只需在主程序中先执行SysCLK_config();函数,就可以开始其它语句了。SysCLK_config();函数的功能是把外部的12M晶振倍频到48M赫兹,使得LPC1114工作在48M赫兹下。SysCLK_con ...… 查看全部问答∨ |
|
看论坛正在做低功耗时钟,我刚好手头有个东西也需要低功耗显示,向大家推荐北京青云的LCM061A段式模块,主要是3.3V下可以工作,典型工作电流看厂家资料说是50ua(无背光),省电模式下《1ua。因为最近正在调试别的部分,实际的功耗还没有实际测试, ...… 查看全部问答∨ |
使用stm32仿真器在iar编译环境下调试出现stm32:failed to verify @ address 0x08000000...,看了很久,想问一下,有没有朋友遇到过这种情况… 查看全部问答∨ |