2019年7月4日 星期四

解決殘影,把p1執行完後再關掉

#include "reg51.h"
main()
{
  void delay(int);
  int i,j;
char seg[10]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90};
while(1)
  {
for(i=0;i<9999;i++)//i不可字元
{
for(j=0;j<25;j++)
{
P2=0x07;
P1=seg[(i/1000)%10];
delay(200);P1=0XFF;
P2=0x0b;
P1=seg[(i/100)%10];
delay(200);P1=0XFF;
P2=0x0d;
P1=seg[(i/10)%10];
delay(100);P1=0XFF;
P2=0x0e;
P1=seg[(i/1)%10];
delay(200);P1=0XFF;
}
}
  }
}
void delay(int count)
{
  int i;
  for(i=0;i<count;i++)
  ;
}

沒有留言:

張貼留言

algorithm

 #include <iostream> #include <string.h> using namespace std; int main(int argc, char** argv)  { for(int j=2;j<=100;j++)//j...