6b595.c

来自「6b595 24co2 12887应用程序(c源程序)」· C语言 代码 · 共 23 行

C
23
字号
#include <reg51.h>
#define uchar unsigned char

uchar code DAT[18]={ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0xbf,0x86,0xdb,0xcf,0xe6,0xed,0x00,0x40 };
uchar DispDat[6]={ 1,2,3,4,5,6 };

sbit ENABLE=P3^3;
sbit SERIALIN=P3^2;
sbit CLOCK=P3^4;
sbit LATCH=P3^5;

void DispGroup(void)  //6B595或74HC595显示123456
{
   uchar i,j,temp;
   for (i=0; i<6; i++) {
      temp=DAT[DispDat[i]];
      for (j=0;j<8;j++){
         temp=temp<<1; SERIALIN=CY; CLOCK=1; CLOCK=0;
      }
   }
   LATCH=0; LATCH=1;
}
//在程序初始化时  CLOCK=0; LATCH=1; ENABLE=0;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?