示例#1
0
void LCD_test(){
	lcd_set_state(LCD_ENABLE, CURSOR_DISABLE);

	int i=0;
	while(i<0xFF){
		lcd_set_xy(0,0);
		lcd_write_dec_xxx(i);

		lcd_set_xy(0,1);
		lcd_send(i, DATA);
		i++;

		delay_ms(700);
	}

	lcd_set_xy(0, 0);
	//lcd_out("ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏ");
	lcd_set_xy(0, 1);
	//lcd_out("ðñòóôõö÷øùúûüýþÿ");
	//lcd_out("àáâãäå¸æçèéêëìíîï");
	//lcd_out("ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß");


	delay_ms(17000);
}
示例#2
0
int main()
{
	lcd_init();

	while(1)
	{
		if(!OW_reset())
		{
			OW_send_byte(0xCC);
			OW_send_byte(0x44);
			_delay_ms(750);
			if(!OW_reset())
			{
				OW_send_byte(0xCC);
				OW_send_byte(0xBE); //chcemy odczytac zawartosc pamieci
				uint8_t x = OW_read_byte();
				uint8_t y = OW_read_byte();
				//sklejamy x, y
				uint16_t z = (y<<8) | x;
				lcd_set_xy(0, 0);
				fprintf(&lcd_stream, "%d.%04d deg C", z>>4, (z&0x0F)*625);
				lcd_set_xy(0, 1);
				fprintf(&lcd_stream, "dbg %d %d", x, y);


			}
		}
void display_set_chk_interval_draw(){
	if(timeout_menu_count == 0){
		//верхн¤¤ строка на дисплее
		lcd_set_xy(0, 0);
		lcd_out(SET_M4_CHK_INTERVAL);

		//нижн¤¤ строка на дисплее
		lcd_set_xy(0, 1);
		lcd_out(SET_M4_ONE_PER);
		lcd_write_dec_xx(chk_int);
		lcd_out(SET_M4_MINUT);

		lcd_set_xy(cursor_x, cursor_y);
	}
}
示例#4
0
void degreestolcd(const int degrees)
{



    //This function takes degrees and writes out it's 3 digit number( 0 - 359) degrees and then a two letter abreviation for direction
    //This line is printed on the second line of the LCD screen





    code unsigned int asciited[] = { 		   							//table to convert decimal to ascii equivalent
        48,						 										//0
        49,																//1
        50,																//2
        51,																//3
        52,																//4
        53,																//5
        54,																//6
        55,																//7
        56,																//8
        57,																//9

    };


    int x = 0, y = 1;
    int hundreds, tens, ones;
    int aschundreds, asctens, ascones;
    int direction = 0;




    x = 0;
    y = 1;
    lcd_set_xy(x, y);





    hundreds = degrees / 100;
    tens = (degrees - (100*hundreds)) / 10;
    ones = (((degrees - (100*hundreds))) - (10* tens));



    aschundreds = asciited[hundreds];
    asctens = asciited[tens];
    ascones = asciited[ones];



    while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
        ;
    lcd_data_wr = aschundreds;						//write hundreds place of degrees
    x=x+1;
    lcd_set_xy(x, y);

    while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
        ;
    lcd_data_wr = asctens;							//write tens place of degrees
    x=x+1;
    lcd_set_xy(x, y);

    while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
        ;
    lcd_data_wr = ascones;							//write ones place of degrees
    x=x+1;
    lcd_set_xy(x, y);




    while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
        ;


    printf_fast(" degrees");

    while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
        ;

    x=x+9;
    lcd_set_xy(x, y);


    if (degrees >=345 || degrees <= 15)
        direction = 1;

    if (degrees >= 16 && degrees <= 74)
        direction = 2;

    if (degrees >= 75 && degrees <= 105)
        direction = 3;

    if (degrees >= 106 && degrees <= 164)
        direction = 4;

    if (degrees >= 165 && degrees <= 195)
        direction = 5;

    if (degrees >= 196 && degrees <= 254)
        direction = 6;

    if (degrees >= 255 && degrees <= 285)
        direction = 7;

    if (degrees >= 286 && degrees <= 344)
        direction = 8;


    switch (direction)
    {
    case 1:
        printf_fast("NO");
        break;
    case 2:
        printf_fast("NE");
        break;
    case 3:
        printf_fast("EA");
        break;
    case 4:
        printf_fast("SE");
        break;
    case 5:
        printf_fast("SO");
        break;
    case 6:
        printf_fast("SW");
        break;
    case 7:
        printf_fast("WE");
        break;
    case 8:
        printf_fast("NW");
        break;


    }


    lcd_home();









}
示例#5
0
void inchtolcd(unsigned int i)
{
	
			
			
				
			
			
			int tensf, onesf, tensi, onesi;
			int astensf, asonesf, astensi, asonesi;
			int inches = 0, feet = 0;
			int x = 0, y = 0;												//Variables for holding the coordinates for the LCD cursor
																			//in 16 bit mode
																			
			
				
			
			
			code unsigned int asciited[] ={ 		   							//table to convert decimal to ascii equivalent
			48,						 										//0
			49,																//1
			50,																//2
			51,																//3
			52,																//4
			53,																//5
			54,																//6
			55,																//7
			56,																//8
			57,																//9
			
			};
			
	
	
	
			
			//Start of the var value to ascii conversion to print the correct values on the lcd screen	
			inches = i;
			
			i;
			while(inches >= 12)
			{
				feet = feet + 1;
				inches = inches - 12;
			}
			
			  
			
			tensf = feet / 10;
			onesf = feet % 10;

			


			tensi = inches / 10;
			onesi = inches % 10;

		


			astensf = asciited[tensf];
			asonesf = asciited[onesf];
			astensi = asciited[tensi];
			asonesi = asciited[onesi];

			//End of conversion

				


			//Start of the writing to the LCD screen the feet and the inches
			  						
			while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;
			
			lcd_data_wr = astensf;							//write tens place of feet
			x=x+1;
			lcd_set_xy(x, y);

		   	while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;

			lcd_data_wr = asonesf;							//write ones place of feet
			x=x+1;
			lcd_set_xy(x, y);

			while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;


			printf_fast(" Feet - ");

		    
			while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;
			x=x+8;
			lcd_data_wr = astensi;							//write tens place of inches
			x=x+1;
			lcd_set_xy(x, y);

			while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;
			
			lcd_data_wr = asonesi;							//write ones place of inches
			x=x+1;
			lcd_set_xy(x, y);

			
			
			
			while (lcd_status_rd & 0x80)  					//wait foe the lcd to be ready
			;


			printf_fast(" inches");

			//end of writing feet and inches to the lcd screen
			
			lcd_home();

}