16扫
void static_16_disp_string(uint8_t ucDispRow,uint8_t ucRefreshCount,uint8_t *pucDispString)
{uint8_t bResultFlag;uint8_t ucZMData;uint8_t uci;uint8_t ucHZDataBuff[32];uint16_t uiIndex;uint16_t uiHZCode;uint8_t *pDispString_Head; //頭指針
uint8_t ucRowLineCount;ucDispRow = ucDispRow;pDispString_Head = pucDispString;memset(ucLEDDisplayMemory,0x00,(c_MaxColByte*4)*4);while(*pDispString_Head != '\0'){ if(LED_OK){ uint8_t ucCharHigh;uint8_t ucCharLow;ucCharHigh = *pDispString_Head++;if(ucCharHigh > 0x80 || ucCharHigh == 0x5E){if(LED_OK){if(ucCharHigh!=0x5E){//中文字符的處理ucCharLow = *pDispString_Head++;uiHZCode =(((uint16_t)ucCharHigh)<<8)+ucCharLow;}else{uiHZCode=0xA3AA;}uiIndex=0;while(1){if(ZK_Data[uiIndex].uiHZcode == 0xFFFF){bResultFlag = 0;break;}if(ZK_Data[uiIndex].uiHZcode == uiHZCode){//-找到bResultFlag = 1;break;}else{uiIndex++;}}if(bResultFlag)memcpy(ucHZDataBuff,ZK_Data[uiIndex].model,32); elseGetHZDot(uiHZCode,ucHZDataBuff);for(uci=1; uci<17; uci++){if(LED_OK){ucZMData = ucHZDataBuff[30-(16-uci)*2];ucLEDDisplayMemory[uci*(c_MaxColByte+1)-1] =ucZMData;}else{goto rexit;}}for(ucRowLineCount=0; ucRowLineCount<16; ucRowLineCount++){if(LED_OK){memcpy(ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1),ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1)+1,c_MaxColByte);}else{goto rexit;}} //處理右半個漢字,卷入屏幕最右端for(uci=1; uci<17; uci++){if(LED_OK){ucZMData = ucHZDataBuff[32-(16-uci)*2-1];ucLEDDisplayMemory[uci*(c_MaxColByte+1)-1] =ucZMData; }else {goto rexit;}}//整屏移動一字節for(ucRowLineCount=0; ucRowLineCount<16; ucRowLineCount++){if(LED_OK){memcpy(ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1),ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1)+1,c_MaxColByte);}else{goto rexit;}} }else{goto rexit;} }else{//西文字符的處理if(LED_OK){for(uci=1; uci<17; uci++){if(LED_OK){ucZMData = ASCII816[ucCharHigh - 0x20][uci-1];ucLEDDisplayMemory[uci*(c_MaxColByte+1)-1] =ucZMData;}else{goto rexit;}}for(ucRowLineCount=0; ucRowLineCount<16; ucRowLineCount++){if(LED_OK){memcpy(ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1),ucLEDDisplayMemory+ucRowLineCount*(c_MaxColByte+1)+1,c_MaxColByte);}else{goto rexit;}} }else{goto rexit;}} }else{goto rexit;}}if(LED_OK){ static_16_refresh_led_screen(ucRefreshCount,0);}else{goto rexit;}rexit:uci=1;
}
void static_16_refresh_led_screen(uint8_t ucLoopCount,uint8_t ucShiftCount) {uint8_t ucRowLineCount;uint16_t uiRefreshCount;//以下用于修正系統連接不同數量的單元板時,顯示時間的差異性,最小列數為64uiRefreshCount = 1;//(ucLoopCount*4)/(c_MaxColNumber/64);//5//64while(uiRefreshCount--){if(LED_OK){ for(ucRowLineCount=0; ucRowLineCount<16; ucRowLineCount++) //16????????0?? {uint8_t ucCount;uint16_t uiStartAddress;uint8_t ucLeftUnit; //顯存中的左單元 uint8_t *pDispBuff; uiStartAddress = ucRowLineCount*(c_MaxColByte+1);pDispBuff = ucLEDDisplayMemory+uiStartAddress;for(ucCount=0; ucCount<c_MaxColByte; ucCount++)//6808505 {if(LED_OK){ucLeftUnit = *pDispBuff++;ucColDataBuff[ucCount] = ucLeftUnit;}else{goto shexit;}} //先將數據列鎖存到HC595if(LED_OK){////ShT_LEDBoard_ColShiftOut(0,c_MaxColByte);for(ucCount=0; ucCount<c_MaxColByte; ucCount++){led_board_16_coldata_out(ucColDataBuff[ucCount]);}}else{goto shexit;} //關閉顯示 Set_Row_Disable();// for(i=0;i<0xff;i++); //換行 if(LED_OK){if(ucRowLineCount!=16){led_board_16_row_number(ucRowLineCount);}}else{goto shexit;}Set_Row_Enable();//將HC595鎖存的數據輸出if(ucRowLineCount!=16){ #if 0c_Col_SOut_High = 0;c_Col_SOut_High = 1;c_Col_SOut_High = 0; #endifGPIO_ResetBits(GPIOC, GPIO_Pin_0); //for(i=0;i<0xf;i++); GPIO_SetBits(GPIOC, GPIO_Pin_0);//for(i=0;i<0xf;i++); GPIO_ResetBits(GPIOC, GPIO_Pin_0); //開啟顯示//Set_Row_Enable(); }// Set_Row_Enable(); //指向下一行 }}else{goto shexit;}} shexit: //顯示完成后,關閉屏幕顯示 Set_Row_Disable(); }
void static_16_refresh_led_screen(uint8_t ucLoopCount,uint8_t ucShiftCount) {uint8_t ucRowLineCount;uint16_t uiRefreshCount;//以下用于修正系統連接不同數量的單元板時,顯示時間的差異性,最小列數為64uiRefreshCount = 1;//(ucLoopCount*4)/(c_MaxColNumber/64);//5//64while(uiRefreshCount--){if(LED_OK){ for(ucRowLineCount=0; ucRowLineCount<16; ucRowLineCount++) //16????????0?? {uint8_t ucCount;uint16_t uiStartAddress;uint8_t ucLeftUnit; //顯存中的左單元 uint8_t *pDispBuff; uiStartAddress = ucRowLineCount*(c_MaxColByte+1);pDispBuff = ucLEDDisplayMemory+uiStartAddress;for(ucCount=0; ucCount<c_MaxColByte; ucCount++)//6808505 {if(LED_OK){ucLeftUnit = *pDispBuff++;ucColDataBuff[ucCount] = ucLeftUnit;}else{goto shexit;}} //先將數據列鎖存到HC595if(LED_OK){////ShT_LEDBoard_ColShiftOut(0,c_MaxColByte);for(ucCount=0; ucCount<c_MaxColByte; ucCount++){led_board_16_coldata_out(ucColDataBuff[ucCount]);}}else{goto shexit;} //關閉顯示 Set_Row_Disable();// for(i=0;i<0xff;i++); //換行 if(LED_OK){if(ucRowLineCount!=16){led_board_16_row_number(ucRowLineCount);}}else{goto shexit;}Set_Row_Enable();//將HC595鎖存的數據輸出if(ucRowLineCount!=16){ #if 0c_Col_SOut_High = 0;c_Col_SOut_High = 1;c_Col_SOut_High = 0; #endifGPIO_ResetBits(GPIOC, GPIO_Pin_0); //for(i=0;i<0xf;i++); GPIO_SetBits(GPIOC, GPIO_Pin_0);//for(i=0;i<0xf;i++); GPIO_ResetBits(GPIOC, GPIO_Pin_0); //開啟顯示//Set_Row_Enable(); }// Set_Row_Enable(); //指向下一行 }}else{goto shexit;}} shexit: //顯示完成后,關閉屏幕顯示 Set_Row_Disable(); }
?
void led_board_16_row_number(uint8_t ucRowNumber) {if((ucRowNumber&0x08)==0x08)GPIO_SetBits(GPIOB, GPIO_Pin_9); elseGPIO_ResetBits(GPIOB, GPIO_Pin_9); if((ucRowNumber&0x04)==0x04)GPIO_SetBits(GPIOB, GPIO_Pin_8); elseGPIO_ResetBits(GPIOB, GPIO_Pin_8); if((ucRowNumber&0x02)==0x02)GPIO_SetBits(GPIOB, GPIO_Pin_7); elseGPIO_ResetBits(GPIOB, GPIO_Pin_7); if((ucRowNumber&0x01)==0x01)GPIO_SetBits(GPIOB, GPIO_Pin_6); elseGPIO_ResetBits(GPIOB, GPIO_Pin_6); }void led_board_16_coldata_out(uint8_t Codata) {uint8_t i=0, byte=Codata;uint8_t j;for (i=0;i<8;i++) {for(j=0;j<2;j++);GPIO_ResetBits(GPIOC, GPIO_Pin_1); if (byte&0x01)GPIO_ResetBits(GPIOC, GPIO_Pin_3); elseGPIO_SetBits(GPIOC, GPIO_Pin_3); for(j=0;j<2;j++);GPIO_ResetBits(GPIOC, GPIO_Pin_1); for(j=0;j<2;j++);GPIO_SetBits(GPIOC, GPIO_Pin_1); //for(j=0;j<10;j++);byte=byte>>1;} }?
轉載于:https://www.cnblogs.com/will-king0308/p/10870805.html
總結
- 上一篇: CDH预警配置QQ邮箱
- 下一篇: centos7+tomcat部署Java