Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the driving principle and routine of STM8L segment code screen?

Shulou Source: shulou.com Published: 2022-06-01 18:29:08 11月14日 Update

This article shows you the STM8L segment code screen driver principle and routines, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article, I hope you can get something.

The driving process of STM8L segment code screen is as follows:

First, check the relevant registers set by DATASHEET according to the hardware connection, that is, determine the COMx.

2. Create the following table for the RAM address of COMx in DATASHEET:

Fill in the form with the information provided by the LCD segment code screen manufacturer and operate LCD RAM.

Third, the following two examples are for reference:

1.

Void LCD_showLevel (U8 Chan, U8 Level)

{

U8 i, adr, mask

BarCH1 = Level2Bar [(Level-1) / 8+LcdFlashCh2]

BarCH2 = Level2Bar [(Level-1) / 8+LcdFlashCh3]

If (Chan = = 0)

{

For (iframe 0; iRAM [LCD _ level 1 [I * 2]] | = LCD_ level 1 [I * 2v 1])

}

For (; iRAM [LCD _ level 1 [I * 2]] & = ~ (LCD_ level 1 [I * 2])

}

} else

{

For (iframe 0; iRAM [LCD _ level 2 [I * 2]] | = (LCD_ level 2 [I * 2v 1])

}

For (; iRAM [LCD _ level 2 [I * 2]] & = ~ (LCD_ level 2 [I * 2 * 1])

}

}

two。

Void LCD_showNum (U8 Minute)

{

If (Minute = = 0)

{

DrawDigit (1Jing 10); / / Draw white space in digit 4

DrawDigit (2Jing 11); / / Draw "C" in digit 5)

}

Else if (Minute

< 10) { //for minute smaller than 10 DrawDigit(1,10); //Draw white space in digit 4 DrawDigit(2,Minute); //Draw Minute in digit 5 } else { //for minute larger than 10 DrawDigit(1,Minute/10); //Draw minute in digit 4,5 DrawDigit(2,Minute); } OFF_TIME; OFF_MIN; } void DrawDigit(u8 loc, u8 value) { u8 v, i; v = DigitSeg[value]; for (i=0;iRAM[Digits[loc][i*2]] |= Digits[loc][i*2+1]; else LCD->

Ram [Digitsloc] [iTun2]] & = ~ Digits [loc] [iDiver2: 1]

V = (v > > 1)

}

}

Const U8 Digits [] [] =

{

{11,64, 8,4, 4,64, 1,4, 1,8, 8,8, 4128}

{10,32, 7,2, 3,32, 0,2, 0,1, 7,1, 3,16}

{10,128, 7,8, 3,128, 0,8, 0,4, 7,4, 3,64}

}

/ / 0 1 2 3 4 5 6 7 8 9 "C"

U8 DigitSeg [] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x00, 0x39}

The odd number of array elements is the address, and the even number is the value, that is, the bit to be displayed.

The above content is the principle and routine of STM8L segment code screen driver. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.

Tags: Drivers principles content addresses skills knowledge conciseness brevity two examples even numbers elements manufacturers odd numbers registers namely arrays articles more hardware Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Apple Linux vpn OPPO Reno