//初始化MAX7219芯片 void MAX7219_Init(void) { MAX7219_Write(0x09, 0x00); MAX7219_Write(0x0A, 0x03); MAX7219_Write(0x0B, 0x07); MAX7219_Write(0x0C, 0x01); MAX7219_Write(0x0F, 0x00); }
int test(void) { unsigned short data[] = {0x0108, 0x0207, 0x0306, 0x0405, 0x0504, 0x0603, 0x0702, 0x0801}; int i,j; int intensity=0x0f; // // Set SysClk 36MHz using Extern 12M oscillator // xSysCtlClockSet(36000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ); MAX7219_Init(); for(i=0;i<8;i++) { MAX7219_Write(data[i]>>8,data[i]); } while(1) { if(intensity>0x0f) intensity = 0; for(i=0;i<300000;i++); MAX7219_Write(MAX7219_INTENSITY_ADDR, intensity); intensity++; } }
//循环执行部分 void loop() { //循环显示数字0-9,字母A-Z for(int j=0;j<36;j++) { for(int i=1;i<=8;i++) MAX7219_Write(i, matrixTable[j][i-1]); delay(500); } }