单片机源程序如下:
#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,
0x00,0x00,0xFE,0xFF,0x22,0x04,0x5A,0x08,0x86,0x07,0x08,0x20,0x88,0x11,0x68,0x0D,
0x18,0x41,0x0F,0x81,0xE8,0x7F,0x08,0x01,0x08,0x05,0x08,0x09,0x08,0x30,0x00,0x00, // 陈
0x00,0x40,0x00,0x38,0xFC,0x00,0x44,0x00,0x44,0x3C,0x44,0x40,0x44,0x40,0xFF,0x43,
0x44,0x4C,0x44,0x40,0x44,0x40,0x44,0x70,0xFC,0x04,0x00,0x08,0x00,0x30,0x00,0x00, //忠
0x20,0x04,0x10,0x04,0x08,0x04,0xFC,0x05,0x03,0x04,0x20,0x04,0x20,0x04,0x10,0xFF,
0x7F,0x04,0x88,0x04,0x88,0x04,0x84,0x04,0x82,0x04,0xE0,0x04,0x00,0x04,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(10); } x++; if(x==48) x=0; /* for(n=0;n<100;n++) for(i=0;i<16;i++) { Lie= i; shift16bit(led[x][2*i+1],led[x][2*i]); delay(100); } x++; if(x==4) x=0; */ } }
上一篇:51单片机驱动OLED
下一篇:STC12C5A60S2双串口通讯基础程序
推荐阅读最新更新时间:2024-11-11 13:04
设计资源 培训 开发板 精华推荐
- 基于涂鸦智能的温湿度传感器
- DC1111,演示电路采用 LTC2753 16 位、2 通道 DAC
- #第七届立创电赛#基于n32g430的机械臂控制装置
- IS31FL3726-QFLS2-EB,基于具有 PWM 控制的 IS31FL3726 16 位彩色 LED 驱动器的评估板
- LT3091HR 浮动 3 端可调稳压器的典型应用
- LT6654BMPS6-3.3 升压输出电流电压基准的典型应用
- 使用 Adafruit Industries 的 ATMEGA48V-10PU 的参考设计
- 使用 Analog Devices 的 LT3467AES67 的参考设计
- 【涂鸦智能】物联网温度计
- DER-578 - 2.5W, 通用输入,非隔离反激式转换器