|
上午调了一下,字是左右镜像的,你把它反过来就行。主要是送的数据有点问题。 #include <reg51.h> #include <intrins.h> #define uchar unsigned char sbit sh=P2^0; sbit ds=P2^1; sbit st=P2^2; code TAB[]={0xE9,0x2A,0xEC,0x9F,0xEC,0x2A,0xED,0x00}; code ord[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; void delay(char s) { char i; for(i=0;i<s;i++) { _nop_(); _nop_(); _nop_(); } } void main() { uchar p=0xfe,q; char i,j; while(1) { for(i=0;i<8;i++) { q=ord[i];//q=p; st=0; for(j=0;j<8;j++) { q=q<<1; ds=CY; sh=0; delay(1); sh=1; } st=1; P0=TAB[i]; delay(10); delay(200); } } } |