LED单元板列驱动使用了数据线,时钟线,只有二级锁存器的锁存信号是分开的,HC595的OE合用的。
//LED屏驱动 ; ; #pragma src (LED_ShiftRegistControl.a51) small ; ; ; #include "..incincludes.h" ; ; extern uchar ucColDataBuff_High[16]; ; extern uchar ucColDataBuff_Low[16]; ; ; ; sbit c_Col_SData = P1^5; ; sbit c_Col_SClk = P1^7; ; sbit c_Col_SOut_High = P1^0; ; sbit c_Col_SOut_Low = P1^1; ; ; sbit c_Col_SOE = P1^2; ; ; /* ; void ShT_LEDBoard_ColShiftOut(void) ; { ; uchar ucByteCount; ; uchar ucBitCount; ; uchar ucTemp; ; ; c_Col_SOE = 0; ; c_Col_SClk = 0; ; c_Col_SOut_High = 0; ; ; for(ucByteCount=0; ucByteCount<16; ucByteCount++) ; { ; ucTemp = ucColDataBuff_High[ucByteCount]; ; ; for(ucBitCount=0; ucBitCount<8; ucBitCount++) ; { ; if(ucTemp & 0x80) ; { ; c_Col_SData = 0; //When Shift Register Latch Out Value is Zero,the Led is Light ; } ; else ; { ; c_Col_SData = 1; ; } ; ; c_Col_SClk = 1; ; ucTemp <<= 1; ; c_Col_SClk = 0; ; } ; } ; ; c_Col_SOut_High = 1; ; c_Col_SOut_High = 0; ; ; ; for(ucByteCount=0; ucByteCount<16; ucByteCount++) ; { ; ucTemp = ucColDataBuff_Low[ucByteCount]; ; ; for(ucBitCount=0; ucBitCount<8; ucBitCount++) ; { ; if(ucTemp & 0x80) ; { ; c_Col_SData = 0; //When Shift Register Latch Out Value is Zero,the Led is Light ; } ; else ; { ; c_Col_SData = 1; ; } ; ; c_Col_SClk = 1; ; ucTemp <<= 1; ; c_Col_SClk = 0; ; } ; } ; c_Col_SOut_Low = 1; ; c_Col_SOut_Low = 0; ; ; c_Col_SOE = 0; ; } ; */ ; ; void ShT_LEDBoard_ColShiftOut(void)
RSEG ?PR?ShT_LEDBoard_ColShiftOut?LEDSHIFTREGISTERCONTROL ShT_LEDBoard_ColShiftOut: USING 0 ; SOURCE LINE # 82 ; { ; SOURCE LINE # 83 ; uchar ucByteCount; ; uchar ucBitCount; ; uchar ucTemp; ; ; Clr Col_SOE ; ; c_Col_SClk = 0; Clr Col_SClk ; c_Col_SOut_High = 0; Clr Col_SOut_High ; ; for(ucByteCount=0; ucByteCount<16; ucByteCount++) MOV A,#LOW (ucColDataBuff_High) MOV R0,A
Mov R2,#16 ShiftOutByte_HighScreen: Mov R3,#8 Mov A,@R0 CPL A ShiftOutBit_HighScreen: Rlc A Mov Col_SData,c SetB Col_SClk Clr Col_SClk
DJNZ R3,ShiftOutBit_HighScreen
Inc R0 DJNZ R2,ShiftOutByte_HighScreen
SetB Col_SOut_High Clr Col_Sout_High
MOV A,#LOW (ucColDataBuff_Low) MOV R0,A
Mov R2,#16 ShiftOutByte_LowScreen: Mov R3,#8 Mov A,@R0 CPL A ShiftOutBit_LowScreen: Rlc A Mov Col_SData,c SetB Col_SClk Clr Col_SClk
DJNZ R3,ShiftOutBit_LowScreen
Inc R0 DJNZ R2,ShiftOutByte_LowScreen
SetB Col_SOut_Low Clr Col_Sout_Low Clr Col_SOE ; { ; ucTemp = ucColDataBuff_High[ucByteCount]; ; ; for(ucBitCount=0; ucBitCount<8; ucBitCount++) ; { ; if(ucTemp & 0x80) ; { ; c_Col_SData = 0; //When Shift Register Latch Out Value is Zero,the Led is Light ; } ; else ; { ; c_Col_SData = 1; ; } ; ; c_Col_SClk = 1; ; ucTemp <<= 1; ; c_Col_SClk = 0; ; } ; } ; ; c_Col_SOut_High = 1; ; c_Col_SOut_High = 0; ; ; ; for(ucByteCount=0; ucByteCount<16; ucByteCount++) ; { ; ucTemp = ucColDataBuff_Low[ucByteCount]; ; ; for(ucBitCount=0; ucBitCount<8; ucBitCount++) ; { ; if(ucTemp & 0x80) ; { ; c_Col_SData = 0; //When Shift Register Latch Out Value is Zero,the Led is Light ; } ; else ; { ; c_Col_SData = 1; ; } ; ; c_Col_SClk = 1; ; ucTemp <<= 1; ; c_Col_SClk = 0; ; } ; } ; c_Col_SOut_Low = 1; ; c_Col_SOut_Low = 0; ; ; c_Col_SOE = 0;
; ucTemp = ucColDataBuff_High[ucByteCount]; ; SOURCE LINE # 89 ; MOV R7,ucByteCount?040 ; MOV A,#LOW (ucColDataBuff_High); ; ADD A,R7 ; MOV R0,A ; MOV A,@R0 ; MOV R7,A ; MOV ucTemp?042,R7 ; ; ucTemp = ucColDataBuff_Low[ucByteCount]; ; SOURCE LINE # 91 ; MOV R7,ucByteCount?040 ; MOV A,#LOW (ucColDataBuff_Low) ; ADD A,R7 ; MOV R0,A ; MOV A,@R0 ; MOV R7,A ; MOV ucTemp?042,R7 ; } ; SOURCE LINE # 92 RET ; END OF ShT_LEDBoard_ColShiftOut
END |