(資料圖片僅供參考)
測試下斷碼LCD顯示屏顯示。
一、硬件部分
1.1、LCD相關的硬件部分電路圖:
1.2、斷碼顯示屏的邏輯表
二、驅動代碼
2.1、lcd.c
//lcd.c#include?#include?#include?#include?#include?#include?#include?#include?#include?#include?"iostring.h"#include?"board_config.h"uint8_t?SendData[32]?=?{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};static?uint8_t?s_RtcSec?=?0;void?init_lcd(void){int?iRet?=?0;uint8_t?i;uint8_t?j=0;uint32_t?wSegMsk?=?0x0Cfffffc;//lcd?seg2->26uint8_t??wComMsk?=?0x0f;//lcd?com0->3csi_lcd_config_t?tLcdCfg;csi_lcd_gpio_init(wSegMsk,?wComMsk);//LCD?GPIO???:com0-com3???seg2-seg31???4*30tLcdCfg.byClkSrc?=?LCD_CLKSRC_ISOSC;//LCD?????ISOSCtLcdCfg.byFreq?=?80;//LCD?????=40Hz,????:30~100HztLcdCfg.byVlcd=?LCD_VLCD_IN_3V2;//VLCD????3.2VtLcdCfg.byDutyBias=?LCD_DUTY1_4_BIAS1_3;//LCD?Duty?=?1/4,?Bias?=?1/3tLcdCfg.byDead=?LCD_DEAD_2PHASE;//LCD?????,??3?????,?????????tLcdCfg.byDrvNet=?LCD_DRVNET_PWLEV1;//LCD????(????),???4?,??PWLEV0?>?PWLEV1?>?PWLEV2?>?PWLEV3tLcdCfg.byDpEn=?DISABLE;//????????tLcdCfg.byInt=?LCD_INTSRC_NONE;//?????,??iRet?=?csi_lcd_init(LCD,?&tLcdCfg);if(iRet?==?CSI_OK)csi_lcd_start(LCD);//csi_lcd_set_blink(LCD,?LCD_BLINK_SEG8,?LCD_BLINK_FRE_F2,?2);//LCD??????????LCD_BLINK_FRE_F2,??????????csi_lcd_write_data(LCD,?SendData,?2,?22);for(i?=?2;?i?24;?i++){SendData[i]?=?0x0f;}csi_lcd_write_data(LCD,?SendData,?2,?22);}uint8_t?i=0;uint8_t?j=0;void??lcd_test(void){for(i?=?2;?i?24;?i++){SendData[i]?=?0x0f;}lcd_disprtc(SendData,?2,?j);????lcd_disprtc(SendData,?4,?j);?lcd_disprtc(SendData,?6,?j);????lcd_disprtc(SendData,?8,?j);????lcd_dispthl(SendData,?21,j);??lcd_dispthl(SendData,?18,j);????lcd_disptv(SendData,?16,?j);????lcd_disptv(SendData,?14,?j);????lcd_disptv(SendData,?12,?j);????lcd_disptv(SendData,?10,?j);????SendData[3]=?(SendData[3]&0xf7)?|0x08;??SendData[5]=?(SendData[5]&0xf7)?|0x00;??SendData[7]=?(SendData[7]&0xf7)?|0x00;??SendData[9]=?(SendData[9]&0xf7)?|0x00;??SendData[10]=?(SendData[10]&0xf7)?|0x00;??SendData[14]=?(SendData[14]&0xf7)?|0x00;??SendData[16]=?(SendData[16]&0xf7)?|0x00;??SendData[18]=?(SendData[18]&0xf7)?|0x00;??SendData[21]=?(SendData[21]&0xf7)?|0x00;??csi_lcd_write_data(LCD,?SendData,?2,?24);mdelay(500);j++;if(j>9){j=0;}}2.2、main.c
#include?#include?#include?#include?"demo.h"#include?"led.h"#include?"key.h"#include?"lcd.h"/*?Private?macro-----------------------------------------------------------*//*?externs?function--------------------------------------------------------*/extern?void?system_init(void);extern?void?board_init(void);extern?void?user_demo(void);/*?externs?variablesr------------------------------------------------------*//*?Private?variablesr------------------------------------------------------*/int?main(){uint8_t?key_val;??system_init();board_init();init_led();init_key();init_lcd();my_printf("Hello?World~~~~~~~\n");//print?messagewhile(1){lcd_test();}return?0;}三、顯示效果
關鍵詞:
顯示效果