74ls164单片机编程汇总(跑马灯/驱动数码管)-本文主要介绍了74ls164单片机编程汇总(跑马灯/驱动数码管)。用单片机驱动LED数码管有很多方法,按显示方式分,有静态显示和动态(扫描)显示,按译码方式可分硬件译码和软件译码之分。使用数码管时,要注意区分这两种不同的接法:共阴极和共阳极。共阴极时,为1则亮;共阳极时,为0则亮。比如共阴极的方式接数码管,显示“1”,则编码为0x3f,即00111111(dp g f e d c b a )。
基于51单片机对自动打铃系统的设计-#include “reg51.h”
#include “intrins.h” #define uchar unsigned char #define uint unsigned int
uchar code DSY_CODE[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};//共阴极总段//
uchar DSY_BUFFER[]={0,0,0xBF,0,0,0xff,0,0};//时间显示时-分 模式
51单片机对8位数码管依次显示0-7的设计-共阳极数组0~9:display[]={0xC0,0xF9,0xA4,0xB0,0x91,0xA2,0x82,0xF8,0x80,0x90}
共阳极数组A~F:display[]={0x88,0x83,0xA6,0xC1,0x86,0x8E}
共阴极数组0~9:display[]={0x3F,0x06,0x5B,0x4F,0x6E,0x6D,0x7D,0x07,0x7F,0x6F}
共阴极数组A~F:display[]={0x77,0x7C,0x59,0x3E,0x79,0x71}
共阴、两组四位一体数码管,位选接74LS138译码器,输入(位选)CBA接P20,P21,P22。段选通过74573后接P1口。
如何利用51单片机实现自动打铃-#include “intrins.h” #define uchar unsigned char #define uint unsigned int
uchar code DSY_CODE[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};//共阴极总段//
uchar DSY_BUFFER[]={0,0,0xBF,0,0,0xff,0,0};//时间显示时-分 模式
uchar DSY_BUFFER1[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}; //模式显示段//
LED(LightEmittingDiode)又称为发光二极管,它的主体是一块电致发光的半导体材料,在它两端加上正向电压,电流会从LED阳极流向阴极,半导体晶体就发出从紫外到红外不同颜色的光线,电流越