实验结果图,从右到左0-7,从左到右7-0,来回滚动。
硬件接线图:
具体看图,不说了,前面讲过,自己查资料就可以,资料得慢慢查,熟练就好了,不浪费时间和版面了
main.c代码
#include<reg52.h>
typedef unsigned int u16;
typedef unsigned char u8;
#define SMG P0
sbit A=P2^2;
sbit B1=P2^3;
sbit C=P2^4;
u8 gsmg_code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//共阴0-F
void delay_10us(u16 n)
{
while(n--);
}
void main()
{
int i=0; u16 j=0,k=0;
while(1)
{
SMG=gsmg_code[0]