MAX7219測(cè)試程序 說明:MAX7219是美國(guó)MAXIM公司推出的三線串行8位LED顯示驅(qū)動(dòng)器,具有多種顯示(可控)方式。
;Program Test MAX7219 ;This program is used to test whether MAX7219 is Ok and give a demo about ho w to use it. ;Program Writed by Ouyijie, 1998.10 ;Jialijie Computer Studio PCL EQU 2 ;PCL = 2 DCOMMAND EQU 0x0d DDATA EQU 0x0e MCU_Reset ;I/O RB1 is Clock line ;I/O RB2 is LOAD line ;I/O RB3 is DATA line ;I/O RB4 is LED ,show state movlw b''00000000'' ;set first I/O direction tris 6 movlw b''00000000'' ;set first I/O state movwf 0x06 Start call MAX7219_Reset comf 0x06,f call Delay1s goto Start MAX7219_Reset ;reset MAX7219 ;0x0d is display command ;0x0e is display data movlw 0x0c movwf DCOMMAND movlw 0x00 movwf DDATA call Write7219 ;write in 0c00H, shut down MAX7219. call Delay1ms ;wait leaest 250us. movlw 0x09 movwf DCOMMAND movlw 0x3f movwf DDATA call Wr ite7219 ;write in 091fH, digits 0 to 5 are transcode. call Delay1ms movlw 0x0a movwf DCOMMAND movlw 0x0a movwf DDATA call Write7219 ;write in 0a0fH, set MAX7219 is the brightest state. call Delay1ms movlw 0x0b movwf DCOMMAND movlw 0x05 movwf DDATA call Write7219 ;set SCAN LIMIT is digits 0 to 5. call Delay1ms ;movlw 0x0f ;movwf DCOMMAND ;movlw 0x00 ;movwf DDATA ;call Write7219 ;wirte in 0f00H, exit TEST, go into normal state. ;call Delay1ms ;Begin set Digit Datas movlw 0x01 movwf DCOMMAND movlw 0x00 movwf DDATA call Write7219 ;bit0 is 0 call Delay1ms movlw 0x02 movwf DCOMMAND movlw 0x01 movwf DDATA call Write7219 ;bit1 is 1 call Delay1ms movlw 0x03 movwf DCOMMAND movlw 0x02 ;bit2 is 2 movwf DDATA call Write7219 call Delay1ms movlw 0x04 movwf DCOMMAND movlw 0x03 ;bit3 is 3 movwf DDATA call Write7219 call Delay1ms movlw 0x05 movwf DCOMMAND movlw 0x04 ;bit4 is 4 |