void lcdDemoAnimatedChar(void)
{
	char mario[][8]={{0x06, 0x09, 0x09, 0x06, 0x03, 0x1a, 0x05, 0x08},
					 {0x09, 0x09, 0x06, 0x03, 0x1a, 0x05, 0x08, 0x06},
					 {0x09, 0x06, 0x03, 0x1a, 0x05, 0x08, 0x06, 0x09},
					 {0x06, 0x03, 0x1a, 0x05, 0x08, 0x06, 0x09, 0x09},
					 {0x03, 0x1a, 0x05, 0x08, 0x06, 0x09, 0x09, 0x06},
					 {0x1a, 0x05, 0x08, 0x06, 0x09, 0x09, 0x06, 0x03},
					 {0x05, 0x08, 0x06, 0x09, 0x09, 0x06, 0x03, 0x1a},
					 {0x08, 0x06, 0x09, 0x09, 0x06, 0x03, 0x1a, 0x05}};

	char msgA[]="Wow8051";
	char msgB[]="Wow is Great!!!";

	unsigned char n;

	lcdInit();				// Set 2 lines, font:5x7

	lcdSetDisplay(LCD_DISPLAY_ON);

//	lcdMakeRawFont(0, 0x01, 0x02, 0x04, 0x08, 0x10, 0x11, 0x0a, 0x11);
//	lcdMakeRawFont(0, 0x04, 0x0b, 0x04, 0x07, 0x1a, 0x04, 0x08, 0x10);
//	lcdMakeRawFont(1, 0x06, 0x09, 0x09, 0x06, 0x03, 0x1a, 0x05, 0x08);

	/* Setup all 8 self-made special characters */
	for (n=0; n<8; n++)
	{
		lcdMakeFont(n, mario[n]);
	}

	lcdClearScreen();
	lcdSetInput(LCD_INPUT_INC);

#ifdef	DEBUG_USRCHAR
	/* try to show all 8 pre-programmed special characters */
	for (n=0; n<8; n++)
	{
		lcdWriteData(n);
	}
#endif

#ifndef	DEBUG_USRCHAR
	lcdWriteData(' ');
	lcdWriteData(' ');
	lcdWriteString(msgA);

	lcdSelectRow(1);
	lcdWriteString(msgB);
	
	for (n=0; n<8; n++)
	{
		lcdSelectRow(0);
		lcdWriteData(n);
		delay(DELAYLONG);
	}
#endif
} /* lcdDemoAnimatedChar */
Exemple #2
0
void lcdSetAddr(unsigned int x1,unsigned int x2,unsigned int y1,unsigned int y2)
{
	lcdWriteCommand(0x2A); 	//column address set
	lcdWriteData(x1>>8);
	lcdWriteData(x1);
	lcdWriteData(x2>>8);
	lcdWriteData(x2);
	lcdWriteCommand(0x2B); 	//page(row) address set  
	lcdWriteData(y1>>8);
	lcdWriteData(y1);
	lcdWriteData(y2>>8);
	lcdWriteData(y2);
	lcdWriteCommand(0x2C); // RAM Write
}
Exemple #3
0
/*
 * Write a char to the LCD at the cursor
 */
void lcdWriteChar(char cChar) {
	GPIOPinWrite(LCD_GPIO_CTL_BASE, E_PIN, ~E_PIN);
	//GPIOPinWrite(LCD_GPIO_CTL_BASE, RW_PIN, ~RW_PIN);
	GPIOPinWrite(LCD_GPIO_CTL_BASE, RS_PIN, RS_PIN);
	lcdWriteData(cChar);
	delayUs(100);
}
Exemple #4
0
void main(void)
{
	char msg[] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!', 0 };

	unsigned char	n;

	lcdCleanScreen();
	
	lcdWriteCmd(0x38);
	lcdWriteCmd(0x0F);	
	lcdWriteCmd(0x06);

	for (n=0; msg[n]!=0; n++)
	{
		lcdWriteData( msg[n] );
	}
	

//	lcdWriteData('H');
//	lcdWriteData('e');
//	lcdWriteData('l');
//	lcdWriteData('l');
//	lcdWriteData('o');
//	lcdWriteData(' ');
//	lcdWriteData('W');
//	lcdWriteData('o');
//	lcdWriteData('r');
//	lcdWriteData('l');
//	lcdWriteData('d');
//	lcdWriteData('!');

	for (;;);

}/* main */
Exemple #5
0
void lcdCmd(unsigned char cmd)
{
    wait_ready();
    CMD_RS0(); // controll command
    lcdWriteData(cmd);
    pulse_e();
}
Exemple #6
0
void lcdData(unsigned char cmd)
{
    wait_ready();
    CMD_RS1(); // data
    lcdWriteData(cmd);
    pulse_e();
}
Exemple #7
0
/*
 * Send command to the LCD
 */
void lcdWriteCommand(uint8_t ui8Com) {
	GPIOPinWrite(LCD_GPIO_CTL_BASE, E_PIN, ~E_PIN);
	//GPIOPinWrite(LCD_GPIO_CTL_BASE, RW_PIN, ~RW_PIN);
	GPIOPinWrite(LCD_GPIO_CTL_BASE, RS_PIN, ~RS_PIN);
	lcdWriteData(ui8Com);
	delayMs(5);
}
Exemple #8
0
// index max 7
static void lcdSetCGRAM(uint8_t index,char letter[8])
{

  lcdWriteCommand((index<<3)|(1<<6));
  for(uint8_t i=0; i<8; i++)
    {
      lcdWriteData(letter[i]);
    }
}
Exemple #9
0
void lcdWriteString(char *str)
{
	unsigned int n;
	
	for (n=0; *(str+n)!=0; n++)
	{
		lcdWriteData(*(str+n));
	}
} /* lcdWriteString */
Exemple #10
0
void lcdClearRow(void)
{
	unsigned char m;
	for (m=0;m<40;m++)
	{
	lcdWriteData(' ');
	}

}
void lcdWriteString(char *str)
{
	char *s;

	for(s=str; *s!= 0; s++)
	{
		lcdWriteData(*s);
	}
} /* lcdWriteString */
Exemple #12
0
void main(void)
{
	char msgA[]={0x49, 0x20, 0x4c, 0x6f, 0x76, 0x65, 0x20, 0x38, 0x30, 0x35, 0x31, 0};
	char msgB[]={'I', ' ', 'L', 'o', 'v', 'e', ' ', '8', '0', '5', '1', 0};
	char msgC[]="I love 8051";
	char msgD[]="My name carol";		
	
	unsigned int n;
	
	lcdClear();
	lcdWriteCmd(0x0F);
	lcdWriteCmd(0x38);			 //8 bit,2 lines, 5x7 font;
	lcdWriteCmd(0x06);

	for (n=0; *(msgD+n)!=0; n++)
	{
		lcdWriteData(*(msgD+n));
	}

//	for (n=0; msgD[n]!=0; n++)
//	{
//		lcdWriteData(msgD[n]);
//	}

//	lcdWriteData('I');
//	lcdWriteData(' ');
//	lcdWriteData('L');
//	lcdWriteData('o');
//	lcdWriteData('v');
//	lcdWriteData('e');
//	lcdWriteData(' ');
//	lcdWriteData('8');
//	lcdWriteData('0');
//	lcdWriteData('5');
//	lcdWriteData('1');
//	
//	lcdWriteData(0x7E);
//	lcdWriteData(0xF6);
//	lcdWriteData(0x33);
//	lcdWriteData(0xFA);
//	lcdWriteData(0xFB);
//	
//	lcdWriteData(0x49);
//	lcdWriteData(0x4c);
//	lcdWriteData(0x6f);
//	lcdWriteData(0x76);
//	lcdWriteData(0x65);
//	lcdWriteData(0x20);
//	lcdWriteData(0x38);
//	lcdWriteData(0x30);
//	lcdWriteData(0x35);
//	lcdWriteData(0x31);

	for (;;);

} /* main */
Exemple #13
0
 void main(void)
 {
	 lcdClear();
	 lcdWriteCmd(0x0F);
	 lcdWriteCmd(0x38);			 //8 bit,2 lines, 5x7 font;
	 lcdWriteCmd(0x06);
	 lcdWriteData(0x46);
	 lcdWriteData(0x4c);
	 lcdWriteData(0x6f);
	 lcdWriteData(0x76);
	 lcdWriteData(0x65);
	 lcdWriteData(0x20);
	 lcdWriteData(0x38);
	 lcdWriteData(0x30);
	 lcdWriteData(0x35);
	 lcdWriteData(0x31);

	 for (;;);
 }
Exemple #14
0
void lcdWriteScreenBuffer( void )
{
    u16 i, ii;

    for( i = 0; i < 6; i++ ){
        lcdWriteCommand( LCD_SETY | i );
        lcdWriteCommand( LCD_SETX );
        for( ii = 0; ii < 84; ii++ ){
            lcdWriteData( globalScreenBuffer[ ( ( ii ) * 6 ) + i ] );
        } // for
    } // for

}
Exemple #15
0
void lcdClearRow(unsigned char row)
{
	unsigned char n;

	lcdSelectRow(row);

	for (n=0; n<40; n++)
	{
		lcdWriteData(' ');
	}

	lcdSelectRow(row);

} /* lcdClearRow */
/*****************************************************
 lcdMakeFont() - Use this to create a new font
 Input:
	c: character code (0 - 7)
	*row: dotmatrix rows (8 rows) from top to bottom
		  valid bits b0 - b4 from right to left
 Output: N/A
 *****************************************************/
void lcdMakeFont(unsigned char c, char *row)
{
	unsigned char	cgAddr;
	unsigned char	n;

	cgAddr = 8*c;

	for (n=0; n<8; n++)
	{
		lcdWriteCmd(0x40 | cgAddr + n);
		lcdWriteData(row[n]);
	}
	
} /* lcdMakeFont */																 
void lcdClearRow(unsigned char row)		// row:0, 1
{	
	unsigned int n;

	lcdSelectRow(row);

	for (n=0; n<40; n++) 					// Fill row with SPACEs
	{
		lcdWriteCmd(0x80 | (row*0x40+n));	// Use fill memory is better than auto INC/DEC input mode
		lcdWriteData(' ');
	}

	lcdSelectRow(row);						// CR: Move cursor to beginning of line [Carriage Return]					

} /* lcdClearRow */
Exemple #18
0
void lcdInit(void)
{
    _lcd_init();

    lcdPrepareWrite();
    CMD_SLEEP_MS(16); // 16 ms

    lcdWriteData(3); // 8bit mode
    pulse_e();
    CMD_SLEEP_MS(5); // 4992 us

    pulse_e(); // Repeat 8bit mode
    CMD_SLEEP_MS(1); // 64 us

    pulse_e(); // Third repeat
    CMD_SLEEP_MS(1); // 64 us

    // lcdWriteData(2); // Change to 4bit mode (0x20)
    // pulse_e();

    lcdCmd(LCD_CMD_INIT8);
    /*
    lcdCmd(0x24);
    lcdCmd(0x09);
    lcdCmd(0x20);
    */

    lcdCmd(0x08);
    lcdCmd(0x01);
    lcdCmd(0x06);
    lcdCmd(0x0C);

    lcdCmd(0x80);
    /*
    lcdCmd(0x02);
    */
    /*
    lcdCmd(LCD_SET_DM | LCD_DM_DISPLAY_ON);
    lcdCmd(LCD_SET_INCREMENT_MODE);
    */

#ifdef WRAPEN
    cur_col = 0;
    cur_row = 0;
#endif
}
Exemple #19
0
void welcomeScreen(){
  drawFill(drawRGB24toRGB565(nwazetYellowRed, nwazetYellowGreen, nwazetYellowBlue));
  lcdSetWindow(
    49, 49 + (142 - 1),
    82, 82 + (156 - 1));
  unsigned short imageSize = 44304;
  unsigned short* imagePixel = (unsigned short*) &nwazetLogo[0];
  while(imageSize){
    lcdWriteData(*imagePixel);
    imagePixel++;
    imageSize -= 2;
  }
  unsigned short y = 10;
  unsigned short spaceBetweenLines = 2;
  printString("Touch Display", y);
  y+=verdanabold14ptFontInfo.height+spaceBetweenLines;
  printString("By [nwazet", y);
  y = 295;
  printString("Raspberry Pi v0.1", y);
}
void lcdClearRow(unsigned char row)
{
	unsigned char n;
	unsigned char currentModeInput;
	
	currentModeInput = lcdCurrentModeInput;

	lcdSetInput(LCD_INPUT_INC);

	lcdSelectRow(row);

	for (n=0; n<40; n++)
	{
		lcdWriteData(' ');
	}

	lcdSetInput(currentModeInput);

	lcdSelectRow(row);

} /* lcdClearRow */
Exemple #21
0
//-----------------------------------------------------------------
// lcdCheck() - Loads the pipeline into the LCD
//-----------------------------------------------------------------
void lcdCheck(void)
{
    uint16_t pipelineValue;

    if(_T4IF && lcdGetPipeSize())
    {
        pipelineValue = lcdPipePop();

        if(pipelineValue & LCD_PIPE_CMD)
        {   // Command
            lcdWriteCommand((uint8_t)pipelineValue);
        }
        else
        {   // Data
            lcdWriteData((uint8_t)pipelineValue);
        }

        TMR4  = 0;
        _T4IF = 0;
    }
}
/***************************************************
 lcdMakeRawFont() - Use this to create a new font
 Input:
	c: character code (0 - 7)
	row0-row7: dotmatrix rows from top to bottom
			   valid bits b0 - b4 from right to left
 Output: N/A
 ***************************************************/
void lcdMakeRawFont(unsigned char c, unsigned char row0,
									 unsigned char row1, 
									 unsigned char row2, 
									 unsigned char row3, 
									 unsigned char row4,
									 unsigned char row5,
									 unsigned char row6,
									 unsigned char row7)
{																 
	unsigned char	cgAddr = 8*c;							   

	lcdWriteCmd(0x40 |  cgAddr);
	lcdWriteData(row0);

	lcdWriteCmd(0x40 | (cgAddr+1));
	lcdWriteData(row1);

	lcdWriteCmd(0x40 | (cgAddr+2));
	lcdWriteData(row2);

	lcdWriteCmd(0x40 | (cgAddr+3));
	lcdWriteData(row3);

	lcdWriteCmd(0x40 | (cgAddr+4));
	lcdWriteData(row4);

	lcdWriteCmd(0x40 | (cgAddr+5));
	lcdWriteData(row5);

	lcdWriteCmd(0x40 | (cgAddr+6));
	lcdWriteData(row6);

	lcdWriteCmd(0x40 | (cgAddr+7));
	lcdWriteData(row7);

} /* lcdMakeRawFont */
Exemple #23
0
void main(void)
{
	lcdClearScreen();
	
	lcdWriteCmd(0x06);
	lcdWriteCmd(0x0f);
	lcdWriteCmd(0x38);

	lcdWriteData('L');
	lcdWriteData('e');
	lcdWriteData('o');
	lcdWriteData(' ');
	lcdWriteData('H');
	lcdWriteData('a');

	for (;;);

}
Exemple #24
0
void main(void)
{
	char font0[]={0x06, 0x09, 0x09, 0x06, 0x03, 0x1a, 0x05, 0x08};

	char msgA[]="Wow8051";
	char msgB[]="Wow is Great!!!";

	lcdInit();				// Set 2 lines, font:5x7

	lcdSetDisplayMode(LCD_DMODE_DISPLAY_ON | 
					  LCD_DMODE_CURSOR_ON  |
					  LCD_DMODE_CURSOR_BLINK_ON);

//	lcdMakeRawFont(0, 0x01, 0x02, 0x04, 0x08, 0x10, 0x11, 0x0a, 0x11);

//	lcdMakeRawFont(0, 0x04, 0x0b, 0x04, 0x07, 0x1a, 0x04, 0x08, 0x10);
//	lcdMakeRawFont(1, 0x06, 0x09, 0x09, 0x06, 0x03, 0x1a, 0x05, 0x08);

	lcdMakeFont(0, font0);

	lcdClearScreen();
	lcdSetInputMode(LCD_INPUT_INC, LCD_INPUT_SHIFT_OFF);

	lcdWriteData(0);
	lcdWriteData(1);
	lcdWriteData(' ');
	lcdWriteString(msgA);
	lcdWriteData(' ');
	lcdWriteData(1);
	lcdWriteData(0);

	lcdSelectRow(1);
	lcdWriteString(msgB);

	for (;;);

} /* main */
u8 putcLCD( u8 c )
{
    lcdWriteData( c );
}
u8 putsLCD( u8 *Buffer )
{
    for( ; *Buffer; ) {
        lcdWriteData( *(Buffer++) );
    } // for
}
Exemple #27
0
void main(void)
{
	lcdClear();
	lcdWriteCmd(0x0f);		// Display:On, Cursor:On, Blink:On
	lcdWriteCmd(0x38);		// 8-bit, 2 lines, 5x7 font
	lcdWriteCmd(0x06);		// Input mode: Increment, Non-shift
	lcdWriteData(0x49);		// 'I'
	lcdWriteData(0x20);		// ' '
	lcdWriteData(0x4c);		// 'L'
	lcdWriteData(0x6f);		// 'o'
	lcdWriteData(0x76);		// 'v'
	lcdWriteData(0x65);		// 'e'
	lcdWriteData(0x20);		// ' '
	lcdWriteData(0x38);		// '8'
	lcdWriteData(0x30);		// '0'
	lcdWriteData(0x35);		// '5'
	lcdWriteData(0x31);		// '1'

	for (;;);

} /* main */
Exemple #28
0
void lcdWriteChar(char c)
{
  lcdWriteData(c);
}