【Qinheng CH582】3 is equipped with zero power consumption LCD segment code screen
[Copy link]
CH582M itself is a Bluetooth application, and its characteristic is low power consumption. For this reason, I equipped it with an LCD segment code screen with almost zero power consumption.
LCD segment code screens have static drive and dynamic drive .
Static drive : There is only one common terminal COM, and each pixel is led out by a separate electrode. The advantage is that the display effect is better than that of dynamic drive, and the disadvantage is that there are more pins.
Dynamic drive : There are 2 or more common terminals COM, and each electrode controls at least 2 pixels, which requires time division scanning to drive.
I use a statically driven LCD segment code screen. It can display 3 "8" and 2 ".", and a total of 24 IOs are required for control.
For simple display, COM and SEG only need to be at opposite levels, and they do not need to be displayed at the same level.
Use this simple segment screen to display data from subsequent tests.
#include "CH58x_common.h"
__attribute__((aligned(4))) UINT32 CapBuf[100];
UINT8V capFlag = 0;
void main()
{
UINT8 i;
SetSysClock(CLK_SOURCE_PLL_60MHz);
GPIOB_SetBits( GPIO_Pin_20 );
GPIOB_ModeCfg( GPIO_Pin_20, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_22 ); GPIOB_ModeCfg
(
GPIO_Pin_22, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_10 ); GPIOB_ModeCfg( GPIO_Pin_10, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_12 );
GPIOB_ModeCfg( GPIO_Pin_12, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_19 );
GPIOB_ModeCfg( GPIO_Pin_19, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_0 ); GPIOB_ModeCfg(
GPIO_Pin_0, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_2 );
GPIOB_ModeCfg( GPIO_Pin_2, GPIO_ModeOut_PP_5mA ); GPIOB_SetBits
( GPIO_Pin_1 );
GPIOB_ModeCfg( GPIO_Pin_1, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_3 );
GPIOB_ModeCfg( GPIO_Pin_3, GPIO_ModeOut_PP_5mA ) ;
GPIOB_SetBits( GPIO_Pin_5 );
GPIOB_ModeCfg( GPIO_Pin_5, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_7 ); GPIOB_ModeCfg( GPIO_Pin_7, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_11 ); GPIOB_ModeCfg
( GPIO_Pin_11, GPIO_ModeOut_PP_5mA )
;
GPIOB_SetBits( GPIO_Pin_13 );
GPIOB_ModeCfg( GPIO_Pin_13, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_15 );
GPIOB_ModeCfg( GPIO_Pin_15, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_5 );
GPIOA_ModeCfg( GPIO_Pin_5, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_0 ); GPIOA_ModeCfg
( GPIO_Pin_0, GPIO_ModeOut_PP_5mA )
;
GPIOA_SetBits( GPIO_Pin_2 ); ModeOut_PP_5mA ); GPIOA_SetBits( GPIO_Pin_15
);
GPIOA_ModeCfg( GPIO_Pin_15, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_13 );
GPIOA_ModeCfg( GPIO_Pin_13, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_11 );
GPIOA_ModeCfg( GPIO_Pin_11, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_7 );
GPIOA_ModeCfg( GPIO_Pin_7, GPIO_ModeOut_PP_5mA );
GPIOA_SetBits( GPIO_Pin_9 );
GPIOA_ModeCfg( GPIO _Pin_9, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_8 );
GPIOB_ModeCfg( GPIO_Pin_8, GPIO_ModeOut_PP_5mA );
GPIOB_SetBits( GPIO_Pin_16 ) ;
GPIOB_ModeCfg( GPIO_Pin_16, GPIO_ModeOut_PP_5mA );
GPIOB_InverseBits(GPIO_Pin_20);
TMR0_TimerInit( FREQ_SYS / 30 ); // Set the timing time in ms
TMR0_ITCfg( ENABLE, TMR0_3_IT_CYC_END ); // Enable interrupt
PFIC_EnableIRQ( TMR0_IRQn );
while( 1 )
;
}
__INTERRUPT
__HIGH_CODE
void TMR0_IRQHandler( void ) // TMR0 scheduled interrupt
{
if ( TMR0_GetITFlag( TMR0_3_IT_CYC_END ) )
{
TMR0_ClearITFlag( TMR0_3_IT_CYC_END ); // Clear interrupt flag
GPIOB_InverseBits( GPIO_Pin_20 );
GPIOB_InverseBits( GPIO_Pin_ 22 );
GPIOB_InverseBits( GPIO_Pin_10 );
GPIOB_InverseBits( GPIO_Pin_12 ) ;
GPIOB_InverseBits( GPIO_Pin_19 );
GPIOB_InverseBits( GPIO_Pin_0 );
GPIOB_InverseBits( GPIO_Pin_2 );
GPIOB_InverseBits( GPIO_Pin_1 );
GPIOB_InverseBits( GPIO_Pin_3 );
GPIOB_InverseBits( GPIO_Pin_5 );
GPIOB_InverseBits( GPIO_Pin_7
); GPIOB_InverseBits( GPIO_Pin_11 )
; GPIOB_InverseBits
( GPIO_Pin_13 );
IO_Pin_5 );
GPIOA_InverseBits( GPIO_Pin_0 );
GPIOA_InverseBits( GPIO_Pin_2 );
GPIOA_InverseBits( GPIO_Pin_15 );
GPIOA_InverseBits( GPIO_Pin_13 );
GPIOA_InverseBits( GPIO_Pin_11 );
GPIOA_InverseBits( GPIO_Pin_7 );
GPIOA_InverseBits( GPIO_Pin_9 );
GPIOB_InverseBits( GPIO_Pin_8 );
GPIOB_InverseBits( GPIO_Pin_16 );
}
}
|