Beispiel #1
0
void LCD_Write_Char(unsigned char letter, unsigned char fgcolor, unsigned char bgcolor)		//Function that writes one character to display
{
    //TODO: Prevent non-valid characters from crashing program

    //Setup display to write one char:
    LCD_Out(0x2A, 1);
    LCD_Out(cursor_x, 0);
    LCD_Out(cursor_x+5, 0);
    LCD_Out(0x2B, 1);
    LCD_Out(cursor_y, 0);
    LCD_Out(cursor_y+7, 0);
    LCD_Out(0x2C, 1);

    //letters come from font5x8[] in progmem (font5x8.h)
    letter -= 32;						//Adjust char value to match our font array indicies
    unsigned char temp[5];
    for (unsigned char i=0; i<5; i++)				//Read one column of char at a time
    {
        temp[i] = pgm_read_byte((char *)((int)font5x8 + (5 * letter) + i));	//Get column from progmem
    }
    for (unsigned char j=0; j<8; j++)						//Cycle through each bit in column
    {
        LCD_Out(bgcolor, 0);
        for (unsigned char k=0; k<5; k++)
        {
            if (temp[k] & 1<<j) LCD_Out(fgcolor, 0);
            else LCD_Out(bgcolor, 0);
        }
    }
}
Beispiel #2
0
void LCD_StripedScreen(void)
{
    unsigned char color_palate[] = {
        //BBGGGRRR
        0b00000111,	//Red
        0b00111111,	//Yellow
        0b00111100,	//Green
        0b11111000,	//Cyan
        0b11000000,	//Blue
        0b11000111,	//Magenta
        0b11111111,	//White
        0b00000111	//This should be 0x00(black) but for screen wrapping it was changed to Red
    };

    LCD_Out(0x13, 1);
    for (unsigned char i=0; i<8; i++)
    {
        LCD_Out(0x2A, 1);
        LCD_Out(0, 0);
        LCD_Out(97, 0);
        LCD_Out(0x2B, 1);
        LCD_Out(i*9, 0);
        LCD_Out((i*9)+8, 0);
        LCD_Out(0x2C, 1);
        for (int j=0; j<882; j++)
        {
            LCD_Out(color_palate[i], 0);
        }
    }
}
Beispiel #3
0
void LCD_Flash_BW(unsigned int flash_delay_ms)
{
    LCD_Out(0x13, 1);
    //All pixel ON
    LCD_Out(0x23, 1);
    _delay_ms(flash_delay_ms);

    LCD_Out(0x13, 1);
    //All pixel OFF
    LCD_Out(0x22, 1);
    _delay_ms(flash_delay_ms);

    LCD_Out(0x13, 1);
}
Beispiel #4
0
void LCD_Fill_Screen(unsigned char color)
{
    LCD_Out(0x2A, 1); //Set Column location
    LCD_Out(0, 0);
    LCD_Out(97, 0);
    LCD_Out(0x2B, 1); //Set Row location
    LCD_Out(0, 0);
    LCD_Out(66, 0);
    LCD_Out(0x2C, 1); //Write Data
    for (int i=0; i<6566; i++) LCD_Out(color, 0);
}
Beispiel #5
0
void LCD_Write ( unsigned char c ) {

    *(lcd.PORT) &= ~(1 << lcd.RS); // => RS = 0
    LCD_Out(c);

    *(lcd.PORT) |= 1 << lcd.EN;    // => E = 1
    __delay_ms(4);
    *(lcd.PORT) &= ~(1 << lcd.EN); // => E = 0

}
Beispiel #6
0
void main(void)
{
    //variables
    unsigned char i;

    //inputs and outputs
    TRISA = 0;
    TRISB = 0;
    TRISC = 0;
    TRISD = 0;
    TRISE = 0;
    ADCON1 = 0x0F;
    
    LCD_Init();

    LCD_Move(0,0);  for (i=0; i<20; i++) LCD_Write(MSG0[i]);
    Wait_ms(3000);
    LCD_Inst(1);

    // set up Timer0 for PS = 1
    T0CS = 0;
    T0CON = 0x88;
    TMR0ON = 1;
    TMR0IE = 1;
    TMR0IP = 1;
    PEIE = 1;
    
    // set up Timer1 for 1ms
    TMR1CS = 0;
    T1CON = 0x81;
    TMR1ON = 1;
    TMR1IE = 1;
    TMR1IP = 1;
    PEIE = 1;

    // set up Timer3 for 1ms
    TMR3CS = 0;
    T3CON = 0x81;
    TMR3ON = 1;
    TMR3IE = 1;
    TMR3IP = 1;
    PEIE = 1;

    //Turn on all interrupts
    GIE = 1;

    while(1){
        LCD_Move(1,0); LCD_Out(Timer0, 3);
    }
}
Beispiel #7
0
void LCD_putc ( char c ) {

   *(lcd.PORT) |= 1 << lcd.RS;   // => RS = 1
    LCD_Out((c & 0xF0) >> 4);   //Data transfer

    *(lcd.PORT) |= 1 << lcd.EN;
    __delay_us(40);
    *(lcd.PORT) &= ~(1 << lcd.EN);

    LCD_Out(c & 0x0F);

    *(lcd.PORT) |= 1 << lcd.EN;
    __delay_us(40);
    *(lcd.PORT) &= ~(1 << lcd.EN);

}
Beispiel #8
0
void LCD_XorScreen(void)
{
    //Screen is 96x65

    LCD_Out(0x2A, 1); //Set Column location
    LCD_Out(0, 0);
    LCD_Out(97, 0);
    LCD_Out(0x2B, 1); //Set Row location
    LCD_Out(0, 0);
    LCD_Out(66, 0);
    LCD_Out(0x2C, 1); //Write Data
    //Row 0-64
    for (char i=0; i<=66; i++)
    {
        //Column 0-95
        for(char j=0; j<=97; j++)
        {
            LCD_Out(j^i, 0);
        }
    }
}
Beispiel #9
0
//%%%%%%%%%%%%%%%%%%%%%%%% Main %%%%%%%%%%%%%%%%%%%%%%%%
void main(void)
{
// Initialize the SPI port
   SSPIE = 0;
   TRISC5 = 0;
   TRISC4 = 1;
   TRISC3 = 0;
   TRISC6 = 0;
   SSPSTAT = 0x40;
   SSPCON1 = 0x22;
// Turn on Timer0
   T0CON = 0x88;
   TMR0ON = 1;
   TMR0IE = 1;
   TMR0IP = 1;
   TMR0 = -3150;
// Turn on TMR1
   TMR1ON = 1;
// Turn on Timer3
   T3CON = 0x81;
   TMR3ON = 1;
   TMR3IE = 1;
   TMR3IP = 1;
   TMR3 = -2500;
// Capture on RC1 for rising edge
   TRISC1 = 1; 
   CCP2CON = 0x05;
   CCP2IE = 1;
   CCP2IP=1;
 // Capture on RC2 for falling edge
   TRISC2 = 1;
   CCP1CON = 0x04; 
   CCP1IE = 1;
   CCP1IP=1;
// initialize INT0 interrupts
   TRISB0 = 1;
   INT0IE = 1;
   //INT0IP = 1;
   INTEDG0 = 1; // rising edges
// initialize INT0 interrupts
   INT1IE = 1;
   INT1IP = 1;
   TRISB1 = 1;
   INTEDG1 = 1; // rising edges

   PEIE = 1;
   GIE = 1;
   ADCON1 = 0x0F;


// PORTD assignments (not used)
   TRISD=0x00;
// PORTC assignments
   TRISC0 = 0; // RF Signal Output
   TRISC1 = 1; // Capture IR edges
   TRISC2 = 1; // Capture IR edges
   TRISC3 = 0; // EEPROM SCK
   TRISC4 = 1; // EEPROM SO
   TRISC5 = 0; // EEPROM SI
   TRISC6 = 0; // EEPROM CS
   TRISC7 = 0; // LED Program Indicator Light
// PORTB assignments
   TRISB0 = 1; // Right Button (Forward: single press & Enter: double press)
   TRISB1 = 1; // Left Button  (Backward: single press & Cancel: double press)
   TRISB2 = 1; // Program Button (Red)
   TRISB3 = 1; // IR Out Button          !!!!REMOVE LATER
   TRISB4 = 1; // RF Out Button          !!!!REMOVE LATER
   TRISB5 = 0; // Enclosure Red   LED
   TRISB6 = 0; // Enclosure Green LED
   TRISB7 = 0; // Enclosure Blue  LED
// PORTA assignments
   TRISA0 = 0;
   TRISA1 = 0; // IR Singal Output
   TRISA2 = 0; // Voice Chip
   TRISA3 = 0; // Voice Chip
   TRISA4 = 1; // Voice Chip
   TRISA5 = 1; // Voice Chip
// PORTE assignments
   TRISE0 = 1; // Radio
   TRISE1 = 0; // Radio



// Assign values to variables
   Time = 0;
   x = 0;
   Color = 0;
   RED = 1;
   GREEN = 0;
   BLUE = 0;
   Count = 0;
   R=0;
   B=0;
   G=0;
   Dnr=0;
   Dnb=0;
   Dng=0;
   soothing = 0;
   glower = 0;
   z0=0;
   z1=2;
   Move=0;
   Menu=1;
   Sub=0;
   Cat=0;
   Com=0;
   Module = 0x0000;
   LED = 1;
   DO=0;

// Ports
   RA1 = 0;
   RC7 = 0;
   PORTD=0x00;
   RA2=0;
   RC0 = 0;


   LCD_Init();

while(1) {


if      (LED==0){RB7=0; RB6=0; RB5=0;}
else if (LED==1){Soothing();}
else if (LED==2){Glower();} 


//%%%%%%%%%%%%%%%% TEST %%%%%%%%%%%%%%%%
if(RB4) {RF_output(A2, A2_ON[18], A2_OFF[18]); A2=(A2+1)%2;} 	// RF     {IR_output(0);}
if(RB2) {IR_Program(0);}  											// IR Program Button
if(RB3) {IR_output(0);}   											// IR Transmit Button
if(RA5) Set_Play(0x1B, 0x28);
// Radio
if      (RE0==1){RE1=1;} // 
else{RE1=0;}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 



// Control States
if((z0!=0)|(z1!=0)){
Move=1;
if(Menu==1){
	if(z0==1)	  {Module=(Module+0x1000); z0=0;
		switch(Module){
		case 0x7000: Module=0x0000; break;}
	}
	else if(z1==1){Module=(Module-0x1000); z1=0;
		switch(Module){
		case 0xF000: Module=0x6000; break;}
	}	
	else if(z0==2){z0=0; Menu=0; Sub=1;}
	else if(z1==2){z1=0;}
}
else if(Sub==1){
	if(z0==1)	  {Module=(Module+0x0100); z0=0;
		switch(Module){
		case 0x0400: Module=0x0000; break;
		case 0x1500: Module=0x1000; break;
		case 0x2300: Module=0x2000; break;
		case 0x3300: Module=0x3000; break;
		case 0x4200: Module=0x4000; break;
		case 0x5500: Module=0x5000; break;
		case 0x6C00: Module=0x6000; break;}
	}
	else if(z1==1){Module=(Module-0x0100); z1=0;
		switch(Module){
		case 0xFF00: Module=0x0300; break;
		case 0x0F00: Module=0x1400; break;
		case 0x1F00: Module=0x2200; break;
		case 0x2F00: Module=0x3100; break;
		case 0x3F00: Module=0x4100; break;
		case 0x4F00: Module=0x5400; break;
		case 0x5F00: Module=0x6B00; break;}
	}
	else if(z0==2){
		switch(Module){
		case 0x0000: DO=1;
		case 0x0100: DO=1;
		case 0x0400: DO=1;
		case 0x0500: DO=1;
		case 0x1000: DO=0;
		case 0x1100: DO=0;
		case 0x1200: DO=0;
		case 0x1300: DO=0;
		case 0x1400: DO=0;
		case 0x2000: DO=0;
		case 0x2100: DO=0;
		case 0x2200: DO=0;
		case 0x3000: DO=0;
		case 0x3100: DO=0;
		case 0x3200: DO=0;
		case 0x4000: DO=0;
		case 0x4100: DO=0;
		case 0x5000: DO=0;
		case 0x5100: DO=0;
		case 0x5200: DO=0;
		case 0x5300: DO=0;
		case 0x5400: DO=0;
		default: z0=0; Sub=0; Cat=1;
		}
	}
	else if(z1==2){z1=0; Sub=0; Menu=1; Module=(Module & 0xF000);}
}
else if(Cat==1){
	if(z0==1)	  {Module=(Module+0x0010); z0=0;
		switch(Module){
		case 0x0240: Module=0x0200; break;
		case 0x03A0: Module=0x0300; break;}
	}
	else if(z1==1){Module=(Module-0x0010); z1=0;
		switch(Module){
		case 0x01F0: Module=0x0230; break;
		case 0x02F0: Module=0x0390; break;}
	}
	else if(z0==2){
		switch(Module){
		case 0x0300: DO=1;
		case 0x0310: DO=1;
		case 0x0320: DO=1;
		case 0x0330: DO=1;
		case 0x0340: DO=1;
		case 0x0350: DO=1;
		case 0x0360: DO=1;
		case 0x0370: DO=1;
		case 0x0380: DO=1;
		case 0x0390: DO=1;
		default: z0=0; Cat=0; Com=1;
		}
	}
	else if(z1==2){z1=0; Cat=0; Sub=1; Module=(Module & 0xFF00);}
}
else if(Com==1){
	if(z0==1)	  {Module=(Module+0x0001); z0=0;
		switch(Module & 0x020F){
		case 0x0205: Module=Module & 0x02F0; break;}
	}
	else if(z1==1){Module=(Module-0x0001); z1=0;
		switch(Module & 0x000F){
		case 0x000F: Module=((Module+0x0010) & 0x00F0)+0x0204; break;}
	}
	else if(z0==2){z0=0; DO=1;}
	else if(z1==2){z1=0; Com=0; Cat=1; Module=(Module & 0xFFF0);}
}
}



// Output voice and maybe function
if(Move==1){
  Move=0;
         LCD_Move(3,0); LCD_Out(Module); /// REMOVE LATER!!!!!!!!
    if(Menu==1){
	switch(Module){
		case 0x0000: // TV
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG[i]); break;
		case 0x1000: // X-10
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG1[i]); break;
		case 0x2000: // Radio
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG2[i]); break;
		case 0x3000: // LED Control
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG3[i]); break;
		case 0x4000: // Volume
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG4[i]); break;
		case 0x5000: // Comments
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG5[i]); break;
		case 0x6000: // IR Programing
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG49[i]); break;
	}
	}

	else if(Sub==1){
	switch (Module){
// TV
		case 0x0000:													
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG6[i]); 
			if(DO==1){IR_output(0);} 
		break;
		case 0x0100: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG0[i]);
			if(DO==1){IR_output(1);} 
		break;
		case 0x0200:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG7[i]); 
		break;
		case 0x0300: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG8[i]); 
		break;
		case 0x0400: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG50[i]); 
			if(DO==1){IR_output(2);}
		break;
		case 0x0500: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG51[i]); 
			if(DO==1){IR_output(3);}
		break;

// X-10
		case 0x1000: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG9[i]);
			if(DO==1){RF_output(A1, A1_ON[18], A1_OFF[18]); A1=(A1+1)%2;} 
		break;
		case 0x1100: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG10[i]);
			if(DO==1){RF_output(A2, A2_ON[18], A2_OFF[18]); A2=(A2+1)%2;} 
		break;
		case 0x1200:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG11[i]); 			
			if(DO==1){RF_output(A3, A3_ON[18], A3_OFF[18]); A3=(A3+1)%2;}
		break;
		case 0x1300: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG12[i]); 
			if(DO==1){RF_output(A4, A4_ON[18], A4_OFF[18]); A4=(A4+1)%2;}
		break;
		case 0x1400:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG13[i]);
			if(DO==1){RF_output(A5, A5_ON[18], A5_OFF[18]); A5=(A5+1)%2;} 
		break;

// Radio
		case 0x2000:  														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG14[i]); 
			if(DO==1){}
		break;
		case 0x2100:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG15[i]); 
			if(DO==1){}
		break;
		case 0x2200: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG16[i]); 
			if(DO==1){}
		break;

// LED Control
		case 0x3000: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG19[i]); 
			if(DO==1){LED = 0;}
			break;
		case 0x3100:
			if(DO==1){LED = 1;} 
		break;
		case 0x3200:
			if(DO==1){LED = 2;} 
		break;

// Master Volume
		case 0x4000: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG17[i]);
			if(DO==1){} 
		break;
		case 0x4100:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG18[i]); 
			if(DO==1){} 
		break;

// Comments
		case 0x5000: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG20[i]); 
			if(DO==1){} 
		break;
		case 0x5100: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG21[i]);
			if(DO==1){}  
		break;
		case 0x5200:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG22[i]); 
			if(DO==1){} 
		break;
		case 0x5300: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG23[i]);
			if(DO==1){}  
		break;
		case 0x5400:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG24[i]); 
			if(DO==1){} 
		break;
	}
	}

	else if(Cat==1){
	switch (Module){

// Channel Categories
		case 0x0200: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG25[i]); 
		break;
		case 0x0210: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG26[i]); 
		break;
		case 0x0220:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG27[i]); 
		break;
		case 0x0230: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG28[i]); 
		break;

// Channel Numbers
		case 0x0300:  														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG39[i]); 
			if(DO==1){IR_output(4);}
		break;
		case 0x0310:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG40[i]); 
			if(DO==1){IR_output(5);}
		break;
		case 0x0320: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG41[i]); 
			if(DO==1){IR_output(6);}
		break;
		case 0x0330:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG42[i]);
			if(DO==1){IR_output(7);} 
		break;
		case 0x0340: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG43[i]); 
			if(DO==1){IR_output(8);}
		break;
		case 0x0350:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG44[i]);
			if(DO==1){IR_output(9);} 
		break;
		case 0x0360: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG45[i]);
			if(DO==1){IR_output(10);} 
		break;
		case 0x0370:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG46[i]);
			if(DO==1){IR_output(11);} 
		break;
		case 0x0380: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG47[i]); 
			if(DO==1){IR_output(12);}
		break;
		case 0x0390:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG48[i]); 
			if(DO==1){IR_output(13);}
		break;
	}
	}

	else if(Com==1){
	switch (Module){	

// Sports
		case 0x0200: 														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG29[i]);
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			} 
		break;
		case 0x0201: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG30[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0202:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG31[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0203: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG32[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0204:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG33[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;

// Cartoons
		case 0x0210:  														
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG34[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0211:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG35[i]);
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			} 
		break;
		case 0x0212: 
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG36[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0213:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG37[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
		case 0x0214:
			LCD_Move(0,0);for (i=0; i<5; i++) LCD_Write(MSG38[i]); 
			if(DO==1){
				IR_output(10); 
				for(i=0;i<10000;i++); 
				IR_output(9); 
				for(i=0;i<10000;i++); 
				IR_output(13);
			}
		break;
	}
	}
} 



}
}
Beispiel #10
0
void LCD_init(void)
{
    LCD_DDR |= (LCD_CLK | LCD_SIO | LCD_CS | LCD_RST);

    //Hardware Reset
    LCD_PORT &= ~LCD_RST;
    LCD_PORT |= LCD_RST;
    _delay_ms(5);

    LCD_PORT |= (LCD_CLK | LCD_SIO | LCD_CS);

    //Software Reset
    LCD_Out(0x01, 1);
    _delay_ms(10);

    /*
      //Refresh set
      LCD_Out(0xB9, 1);
      LCD_Out(0x00, 0);
    */


    //Display Control
    LCD_Out(0xB6, 0);
    LCD_Out(128, 0);
    LCD_Out(128, 0);
    LCD_Out(129, 0);
    LCD_Out(84, 0);
    LCD_Out(69, 0);
    LCD_Out(82, 0);
    LCD_Out(67, 0);


    /*
      //Temperature gradient set
      LCD_Out(0xB7, 1);
      for(char i=0; i<14; i++)  LCD_Out(0, 0);
    */

    //Booster Voltage On
    LCD_Out(0x03, 1);
    _delay_ms(50);  //NOTE: At least 40ms must pass between voltage on and display on.
    //Other operations may be carried out as long as the display is off
    //for this length of time.

    /*
      //Test Mode
      LCD_Out(0x04, 1);
    */

    /*
      // Power Control
      LCD_Out(0xBE, 1);
      LCD_Out(4, 0);
    */

    //Sleep Out
    LCD_Out(0x11, 1);

    //Display mode Normal
    LCD_Out(0x13, 1);

    //Display On
    LCD_Out(0x29, 1);

    //Set Color Lookup Table
    LCD_Out(0x2D, 1);		//Red and Green (3 bits each)
    char x, y;
    for(y = 0; y < 2; y++) {
        for(x = 0; x <= 14; x+=2) {
            LCD_Out(x, 0);
        }
    }
    //Set Color Lookup Table	//Blue (2 bits)
    LCD_Out(0, 0);
    LCD_Out(4, 0);
    LCD_Out(9, 0);
    LCD_Out(14, 0);

    //Set Pixel format to 8-bit color codes
    LCD_Out(0x3A, 1);
    LCD_Out(0b00000010, 0);

//***************************************
//Initialization sequence from datasheet:

//Power to chip
//RES pin=low
//RES pin=high -- 5ms pause
//Software Reset
//5ms Pause
//INIESC
    //<Display Setup 1>
    //REFSET
    //Display Control
    //Gray Scale position set
    //Gamma Curve Set
    //Common Driver Output Select
    //<Power Supply Setup>
    //Power Control
    //Sleep Out
    //Voltage Control
    //Write Contrast
    //Temperature Gradient
    //Boost Voltage On
    //<Display Setup 2>
    //Inversion On
    //Partial Area
    //Vertical Scroll Definition
    //Vertical Scroll Start Address
    //<Display Setup 3>
    //Interface Pixel Format
    //Colour Set
    //Memory access control
    //Page Address Set
    //Column Address Set
    //Memory Write
    //Display On

//****************************************
}
Beispiel #11
0
void LCD_Hello_World(void)
{
    //Binary representation of "Hello World"
    unsigned char Hello_World[5][5] = {
        { 0b10101110, 0b10001000, 0b01001010, 0b10010011, 0b00100110 },
        { 0b10101000, 0b10001000, 0b10101010, 0b10101010, 0b10100101 },
        { 0b11101100, 0b10001000, 0b10101010, 0b10101011, 0b00100101 },
        { 0b10101000, 0b10001000, 0b10101010, 0b10101010, 0b10100101 },
        { 0b10101110, 0b11101110, 0b01000101, 0b00010010, 0b10110110 }
    };

    LCD_Out(0x2A, 1);
    LCD_Out(8, 0);
    LCD_Out(87, 0);
    LCD_Out(0x2B, 1);
    LCD_Out(23, 0);
    LCD_Out(32, 0);
    LCD_Out(0x2C, 1);
    for (unsigned char i=0; i<5; i++) //Scan Rows
    {
        char h=2;
        while(h)
        {
            for (unsigned char k=0; k<5; k++) //Scan Columns
            {
                for (char j=0; j<8; j++)
                {
                    if (Hello_World[i][k] & 1<<(7-j))	//Should there be a letter pixel here?
                    {
                        LCD_Out(0x00, 0);			//yes - draw it in black
                        LCD_Out(0x00, 0);
                    }
                    else
                    {
                        LCD_Out(0xFF, 0);			//no - draw background in white
                        LCD_Out(0xFF, 0);
                    }
                }
            }
            --h;
        }
    }
}