To achieve efficient control of the 16x2 dot matrix character liquid crystal module , the relevant subroutine must be established according to the module design method. The function subroutines for driving the 16x2 dot matrix character liquid crystal module are described in detail below.
vOid LCDWriteCommand(uchar CMD, uchar Attribc)
The /* function writes a command called WriteCommandLCM to the LCM subfunction.
Define CMD and Attribc as unsigned character variables. */
{
If(Attribc)WaitForEnable();
/* If Arrribc is "true", call the WaitForEnable subfunction to perform busy detection*/
LCM_RS_0; LCM_RW_0; _NOP0;
/*Select the instruction register, write mode*/
DataPort=CMD;_NOP();
/* Transfer the command in the variable WCLCM to the data port
LCM_EN_1;_NOP0;_NOP(); LCM_EN_O:
The /*LCM_EN terminal generates a falling edge of the pulse. */
}
The /*WriteCommandLCM subfunction ends. */
2, write data to the LCM subfunctionVoid LcdWritEDAta(dchar dataW)
The /* function writes data named WriteDataLCM to the LCM subfunction. definition
dataW is an unsigned char type variable. */
{
The /*WriteDataLCM subfunction starts. */
WaitForEnable(); */
LCM_RS_1; LCM_RW_0; _NOP0;
/* Select the data register, write mode. */
DataPort=dataW;_NOP();
/* Transfer the data in the variable dataQW to the data port. */
LCM_EN_1;_NOP();_NOP0;LCM_EN_O:
The /*LCM_EN terminal generates a falling edge of the pulse. WriteDataLCM subfunction
End*/
3. Detect LCD busy signal subfunctionVoid WaitForEnable(void)
The /* function is called WaitForEnable to detect the busy signal subroutine subfunction.
The /*WaitForEnable subfunction starts. */
Uchar val;
/* defines the local variable val. */
DataPOrt=Oxff;
/ * Set the data port to all ones. */
LCM_RS_0;LCM_RW_1;_NOP();
/* Select the instruction register, read mode. */
LCM_EN_1;_NOP();_NOP();
/* Set the LCM_EN terminal to high level and read enable. */
DDRA=0x00;
/ * Data port is set to input * /
Val=PINA:
/*Read data*/
While(val&Busy)val=PINA:
/*Detects busy signals. When the data port content is not zero after 0x80,
The program continues to read data and detect busy signals. */
LCM_EN_O:
/* Set the LCM_EN terminal to low level. */
DDRA=0xff;
/ * Data port is set to output * /
}
The /*WaitForEnable subfunction ends. */
4. Display cursor positioning subfunctionVoid LOCateXY(char posx.char posy)
/*Shows the cursor positioning subfunction, the function name is LocareXY, defines posx,
Posxxy is a character variable. */
{
The /*LocateXY subfunction starts. */
Uchar temp;
/* Defines temp as an unsigned char type variable. */
Temp&=0x7f;
/*temp varies from 0-15. */
Temp=posx&0xof;
/ * Shield high 4 digits. */
Posy&=0x01;
/*posy has a range of 0-1. */
If(posy)tempã„§=0x40;
/* If posy is 1 (display the second line), address code +0x40*/
Tempã„§=0x80;
The /* instruction code is the address code +0x80. */
WriteCommandLCM(temp,0);
/* Writes the instruction temp to the LCM, ignoring the busy signal detection. */
}
The /*LocateXY subfunction ends. */
5. Display one character (x=0~15, y=0~1) subfunction of the specified coordinatesVoid DisplayOneChar(uchar x,uchar y,uchar Wdata)
/* displays a character (x=0-15.y=0-1) subfunction of the specified coordinates,
The number is called DispOneChar, which defines x, y, and Wdata as unsigned character variables.
*/
{
/*DispOneChar function starts*/
LocateXY(x,y):
/* Call the LocateXY function to locate the display address. */
WriteDataLCM(Wdata);
/* Write data Wdata to LCM. */
}
The /*DispONeChar function ends. */
6. Demonstrate the second line of moving string subfunctionsVoid Display(uchar dd)
/* demonstrates the second line of moving string subfunctions, the function name is Dispiay, defined
Dd is an unsigned character variable. */
{
The /*Display subfunction starts. */
Uchari:
/* definition; is an unsigned character variable. */
E-cig as a substitute of tobacco mainly reminds people of its potential benefits for health. Four ingredients contain in the e-liquid : propylene glycol, glycerin vegetable, nicotine and food grade essence. Nevertheless, smoke from cigarette contains carbon monoxide, tar, arsenic, ammonia, and many other cyanide and acetone.
Advantage
- New ceramic self heating element, Uniform heating
- High reduction, Temperaturecan be accurately controlled
- Safety and Health, Worth a product,Natural and realistic taste,Factory Direct Sale
- Using proprietary technology,Quality assurance, trustworthy
- Oil leakage free, compact, pocket-sized, portable and easy to transport
-
So that smokers can smoke addiction, refreshing, to meet the psychological and physiological needs of smokers, and in line with the habit of smokers for many years.
-
Compared with rechargeable e-cigarettes and mechanical e-cigarettes, the price of disposable e-cigarettes is much lower, which is applicable to a wider range of customers than the first two. It is also the absolute truth for ordinary consumer groups to be cheap.
Wax Device Oem,Thc Wax Device Oem,Marijuana Wax Device Oem,High Cost Performance Wax Device
Shenzhen MASON VAP Technology Co., Ltd. , https://www.disposablevapepenfactory.com