https://www.bilibili.com/video/BV11f4y1m7TK/
<iframe src="//player.bilibili.com/player.html?aid=285601335&bvid=BV11f4y1m7TK&cid=189563419&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
#include "extern.h"
led_zuo bit pa.6;
led_you bit pa.5;
led_a bit pa.0;
led_b bit pa.7;
led_c bit pa.4;
led_d bit pa.3;
led_e bit pb.3;
led_f bit pb.1;
led_g bit pb.0;
void FPPA0 (void)
{
.ADJUST_IC SYSCLK=IHRC/4 // SYSCLK=IHRC/4
byte led_a1;
byte b1;
byte led_zu[11]; //数码管编码
led_zu[0] =0xfc; //0
led_zu[1] =0x60; //1
led_zu[2] =0xda; //2
led_zu[3] =0xf2; //3
led_zu[4] =0x66; //4
led_zu[5] =0xb6; //5
led_zu[6] =0xbe; //6
led_zu[7] =0xe0; //7
led_zu[8] =0xfe; //8
led_zu[9] =0xf6; //9
$ led_zuo out,high; //设置为输出,输出为1
$ led_you out,high;
$ led_a out,high;
$ led_b out,high;
$ led_c out,high;
$ led_d out,high;
$ led_e out,high;
$ led_f out,high;
$ led_g out,high;
b1=0;
/*
if(b1==0) led_a1 =led_zu[0];
if(b1==1) led_a1 =led_zu[1];
if(b1==2) led_a1 =led_zu[2];
if(b1==3) led_a1 =led_zu[3];
if(b1==4) led_a1 =led_zu[4];
if(b1==5) led_a1 =led_zu[5];
if(b1==6) led_a1 =led_zu[6];
if(b1==7) led_a1 =led_zu[7];*/
while (1)
{
if(b1==0) led_a1 =led_zu[0];
if(b1==1) led_a1 =led_zu[1];
if(b1==2) led_a1 =led_zu[2];
if(b1==3) led_a1 =led_zu[3];
if(b1==4) led_a1 =led_zu[4];
if(b1==5) led_a1 =led_zu[5];
if(b1==6) led_a1 =led_zu[6];
if(b1==7) led_a1 =led_zu[7];
if(b1==8) led_a1 =led_zu[8];
if(b1==9) led_a1 =led_zu[9];
if(led_a1.7) led_a=0; else led_a=1;
if(led_a1.6) led_b=0; else led_b=1;
if(led_a1.5) led_c=0; else led_c=1;
if(led_a1.4) led_d=0; else led_d=1;
if(led_a1.3) led_e=0; else led_e=1;
if(led_a1.2) led_f=0; else led_f=1;
if(led_a1.1) led_g=0; else led_g=1;
b1++;
if(b1>9) b1=0;
.delay 2000000;
}
} |