51的代码
#include <reg51.h> #include <intrins.h> #define int8 unsigned char #define int16 unsigned int #define int32 unsigned long int8 code num_tab[10][8]={ {0xFF,0xFF,0xC1,0xBE,0xBE,0xC1,0xFF,0xFF},/*"0",0*/ {0xFF,0xFF,0xDE,0x80,0xFE,0xFF,0xFF,0xFF},/*"1",1*/ {0xFF,0xFF,0xDC,0xBA,0xB6,0xCE,0xFF,0xFF},/*"2",2*/ {0xFF,0xFF,0xDD,0xB6,0xB6,0xC9,0xFF,0xFF},/*"3",3*/ {0xFF,0xFF,0xF1,0xCD,0x80,0xFD,0xFF,0xFF},/*"4",4*/ {0xFF,0xFF,0x86,0xB6,0xB6,0xB9,0xFF,0xFF},/*"5",5*/ {0xFF,0xFF,0xC1,0xB6,0xB6,0xD9,0xFF,0xFF},/*"6",6*/ {0xFF,0xFF,0x9F,0xB8,0xB7,0x8F,0xFF,0xFF},/*"7",7*/ {0xFF,0xFF,0xC9,0xB6,0xB6,0xC9,0xFF,0xFF},/*"8",8*/ {0xFF,0xFF,0xCD,0xB6,0xB6,0xC1,0xFF,0xFF},/*"9",0*/ }; void delay(int x); void main(void) { int8 i; int8 j; int8 k; P3 = 0x80; while(1) { for(j = 0; j < 10; j++) { for(k = 0; k < 20; k++) { for(i = 0; i < 8; i++) { P0 = 0xff; P0 = num_tab[j][i]; P3 = _crol_(P3,1); delay(1); } } } } } void delay(int x) { int16 i,j; for(i=0;i<x;i++) { for(j=0; j < 500; j++); } }
实现的电路原理图
<img src="http://img.blog.csdn.net/20150121122452694?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMTA0NjA0Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
效果显著
<img align="middle" src="http://img.blog.csdn.net/20150121123608718?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdTAxMTA0NjA0Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
时间: 2024-10-10 09:26:37