1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #include <AT89X52.H> #include "LED44.H" unsigned char db[8] = {0x00, 0x00, 0x14, 0x22, 0x2E, 0x18, 0x00, 0x00}; void main(void) { Matrix_LED(db); } /*---------------------------------------- File: LED44.h Date:Loser007 May 5, 2018 13:03 ----------------------------------------*/ #ifndef __LED44_H__ #define __LED44_H__ #pragma SAVE #pragma REGPARMS extern void Matrix_LED(unsigned char db[]); /*---------------------------------------- Name: Matrix_LED Features: Show in Matrix LED Parameter: No Return: No Instructions: Date:Loser007 May 5, 2018 12:59 ----------------------------------------*/ void Matrix_LED(unsigned char db[]) { unsigned char i = 0, j = 0; P0 = 0xFF; while(1) { P2 = 0xFE; for (i = 0; i < 8; i++) { P0 = db; //delay(); P2 <<= 1; P2 |= 0x01; } } } #endif |
歡迎光臨 (http://www.zg4o1577.cn/bbs/) | Powered by Discuz! X3.1 |