コード例 #1
0
ファイル: easyWEB.c プロジェクト: techniker/easyweb_test
void SEND_CMD (unsigned char e)
{
	Delayx100us(10);                //10ms
	temp = e & 0xf0;		//get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;               //send CMD to LCD
	bitclr(P2OUT,RS);     	        //set LCD to CMD mode
	_E();                           //toggle E for LCD
	temp = e & 0x0f;
	temp = temp << 4;               //get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitclr(P2OUT,RS);   	        //set LCD to CMD mode
	_E();                           //toggle E for LCD
}
コード例 #2
0
ファイル: display.c プロジェクト: ESS-Group/WSim
void InitLCD(void)
{
    bitclr(P2OUT,RS);
    Delayx100us(250);                   //Delay 100ms
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    LCD_Data |= BIT4 | BIT5;            //D7-D4 = 0011
    LCD_Data &= ~BIT6 & ~BIT7;
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    _E();                               //toggle E for LCD
    Delayx100us(100);                   //10ms
    LCD_Data &= ~BIT4;
    _E();                               //toggle E for LCD

    SEND_CMD(DISP_ON);
    SEND_CMD(CLR_DISP);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
}
コード例 #3
0
ファイル: lcd.c プロジェクト: hexanome/setre2013
static void Send_Cmd (unsigned char e)
{
        int temp;
	Delayx100us(10);   // 10ms
	temp = e & 0xf0;   // Get upper nibble	
	LCD_Data &= 0x0f;
	LCD_Data |= temp;  // Send CMD to LCD
	bitclr(P2OUT,RS);  // Set LCD to CMD mode
	_E();              // Toggle E for LCD
	temp = e & 0x0f;
	temp = temp << 4;  // Get down nibble
	LCD_Data &= 0x0f;
	LCD_Data |= temp;
	bitclr(P2OUT,RS);  // Set LCD to CMD mode
	_E();              // Toggle E for LCD
}
コード例 #4
0
ファイル: lcd.c プロジェクト: hexanome/setre2013
void LCD_Init(void)
{
    bitclr(P2OUT,RS);
    Delayx100us(250);             // Delay 100ms
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    LCD_Data |= BIT4 | BIT5;      // D7-D4 = 0011
    LCD_Data &= ~BIT6 & ~BIT7;
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    _E();                         // Toggle E for LCD
    Delayx100us(100);             // 10ms
    LCD_Data &= ~BIT4;
    _E();                         // Toggle E for LCD

    Send_Cmd(DISP_ON);
    Send_Cmd(CLR_DISP);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
    Delayx100us(250);
}
コード例 #5
0
ファイル: buttons.c プロジェクト: bekeband/PD873
char ButtonScan(void) {

	//set COL1 ---------------------------------------------
	PORTB |= 0x07;
	TRISB |= 0x07;
	bitclr(TRISB, 0);
	DelayMs(2);

	//button 1 is pressed
	if((COL2==1)&&(BM.B1==OFF)) { BM.B1=ON; return BUT_UP_ON; }
	if((COL2==0)&&(BM.B1==ON))  { BM.B1=OFF; return BUT_UP_OFF; }

	//button 6 is pressed
	if((COL3==1)&&(BM.B6==OFF)) { BM.B6=ON; return BUT_ES_ON; }
	if((COL3==0)&&(BM.B6==ON))  { BM.B6=OFF; return BUT_ES_OFF; }

	//set COL1 ---------------------------------------------
	PORTB |= 0x07;
	TRISB |= 0x07;
	bitclr(TRISB,1);
	DelayMs(2);

	//button 4 is pressed
	if((COL1==1)&&(BM.B4==OFF)) { BM.B4=ON; return BUT_RG_ON; }
	if((COL1==0)&&(BM.B4==ON))  { BM.B4=OFF; return BUT_RG_OFF; }

	//button 2 is pressed
	if((COL3==1)&&(BM.B2==OFF)) { BM.B2=ON; return BUT_OK_ON; }
	if((COL3==0)&&(BM.B2==ON))  { BM.B2=OFF; return BUT_OK_OFF; }

	//set COL1 ---------------------------------------------
	PORTB |= 0x07;
	TRISB |= 0x03;
	bitclr(TRISB,2);
	DelayMs(2);

	//button 3 is pressed
	if((COL1==1)&&(BM.B3==OFF)) { BM.B3=ON; return BUT_LF_ON; }
	if ((COL1==0)&&(BM.B3==ON)) { BM.B3=OFF; return BUT_LF_OFF; }

	//button 5 is pressed
	if((COL2==1)&&(BM.B5==OFF)) { BM.B5=ON; return BUT_DN_ON; }
	if((COL2==0)&&(BM.B5==ON))  { BM.B5=OFF; return BUT_DN_OFF; }

	return BUTTON_NONE;
}
コード例 #6
0
ファイル: display.c プロジェクト: ESS-Group/WSim
void _E(void)
{
        bitset(P2OUT,E);		//toggle E for LCD
	Delay(_10us);
	bitclr(P2OUT,E);
}