单片机16*16点阵仿真原理图如下
点阵由于电流比较大不能直接接单片机所以用74hc595驱动串转并芯片,还可以实现用很少的io口来控制.
单片机源程序如下:
#include "reg51.h"
#define uchar unsigned char
#define uint unsigned int
#define Lie P1
sbit SHCP = P2^0;
sbit DS = P2^1;
sbit STCP = P2^2;
uchar code led[ ] ={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x08,0x40,0x08,0x40,0x0A,0x48,0xEA,0x4B,0xAA,0x4A,0xAA,0x4A,0xAA,0x4A,0xFE,0x7F,
0xAA,0x4A,0xAA,0x4A,0xA9,0x4A,0xF9,0x4B,0x29,0x48,0x0C,0x60,0x08,0x40,0x00,0x00, // 重
0x00,0x40,0x00,0x20,0xFC,0x9F,0x44,0x80,0x44,0x40,0x44,0x20,0x44,0x18,0x45,0x06,
0xFE,0x01,0x44,0x06,0x44,0x18,0x44,0x20,0x66,0x40,0x44,0xC0,0x00,0x40,0x00,0x00, //庆
0x80,0x80,0x80,0x40,0xFC,0x3F,0x96,0x02,0xA5,0x44,0x84,0x80,0xFC,0x7F,0x08,0x80,
0x08,0x40,0xC9,0x3F,0x4A,0x00,0x4E,0x00,0xE8,0x3F,0x4C,0x40,0x08,0x70,0x00,0x00, //航
0x40,0x80,0x42,0x80,0x42,0x40,0x42,0x20,0x42,0x10,0x42,0x0C,0x42,0x03,0xFE,0x00,
0x42,0x03,0x42,0x0C,0x42,0x10,0x42,0x20,0x43,0x40,0x62,0xC0,0x40,0x40,0x00,0x00, //天
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
//uchar led[]={}
void shift16bit(uchar dat1,uchar dat2) //595输出16位数据
{
uchar i;
STCP=0;
for(i=0;i<8;i++)
{
SHCP=0;
if(dat1 &0x80) DS=1;
else DS=0;
dat1<<=1;
SHCP=1;
}
for(i=0;i<8;i++)
{
SHCP=0;
if(dat2 &0x80) DS=1;
else DS=0;
dat2<<=1;
SHCP=1;
}
STCP=1;
}
void delay(uint x)
{
uint i;
for(i=0;i void main() { uchar i,x=0; uint n; while(1) { for(n=0;n<10;n++) for(i=0;i<16;i++) { Lie=i; shift16bit(led[2*i+1+2*x],led[2*i+2*x]); delay(100); } x++; if(x==64) x=0; /* for(n=0;n<100;n++) ……………………
上一篇:单片机与PC机的串口通信课程设计
下一篇:51单片机+ULN2003驱动5V减速步进电机程序
推荐阅读最新更新时间:2024-10-23 14:04
设计资源 培训 开发板 精华推荐
- NSI50350AST3G 用于基本交流应用的恒流 LED 驱动器的典型应用
- 使用 Analog Devices 的 LT3091IR 的参考设计
- LT6656BCDC-3、3V 低功率精密高压电源监视器的典型应用
- AIR820_UWB_STM32
- 使用 ON Semiconductor 的 CS-5120 的参考设计
- 使用具有 B 类 EMI 滤波(双输出)的 RP10-1215SA DC/DC 转换器的典型应用
- DC2493A,基于 LTC3892-2、60V 低 IQ 多相同步降压转换器的演示板
- #第五届立创电子设计大赛#MyIE厨房防干烧智能报警器
- C8051F988DK,用于工业应用的 C8051F988 8051 微控制器的开发系统
- 基于 ADXL362 的超低功耗、3 轴、运动激活开关