Kênh Tên Miền chuyên cung cấp tên miền đẹp, giá rẻ! Hãy liên hệ kỹ thuật: 0914205579 - Kinh doanh: 0912191357 để được tư vấn, hướng dẫn miễn phí, Cảm ơn quý khách đã ủng hộ trong thời gian qua!
Wednesday, November 23, 2011


Video



Code
#include <REGX51.H>
#include<stdio.h>
#include<math.h>
#define bat 1
#define tat 0
#define data P2  
/****************http://www.Chipkool.tk*********************/
sbit led1=P3^0;
sbit led2=P3^1;
sbit led3=P3^2;
sbit led4=P3^3;
/************** ma led****************/
int M[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
int num=0,donvi,chuc,tram,nghin;
/******************delay**************/
void delay(int ms)
 {
  int i,j;
  for(i=0;i<ms;i++)
   for(j=0;j<125;j++)
   {
   }
  }
/***************chuyen ma**************/
void seg7(void)
 {
  nghin=num/1000;
  tram=(num%1000)/100;
  chuc=(num%100)/10;
  donvi=num%10;
  }
/**************hienthi*****************/
void hienthi(void)
 {
  data=M[nghin];
  led1=bat;
  delay(10);
  led1=tat;
  data=M[tram];
  led2=bat;
  delay(10);
  led2=tat;
  data=M[chuc];
  led3=bat;
  delay(10);
  led3=tat;
  data=M[donvi];
  led4=bat;
  delay(10);
  led4=tat;
 }
/**************ham chinh****************/
 void main(void)
 {
 while(1)
  {int k;
  for(k=0;k<20;k++)
  {
   seg7();
   hienthi();
  }
  num=num+1;
  if(num==10000)
  num=0;
  }
 }







(Pass:chipkool.tk)

(No pass)

0 comments:

Post a Comment

domain, domain name, premium domain name for sales

Popular Posts