Example #1
0
void updateLcd(void){
	char buffer[4];
	int integerPart;
	int decimalPart;
	// RELAY
	LCD_gotoXY(13,0);
	if(currentStatus)LCD_sendString("ON ");
	else LCD_sendString("OFF");
	
	
	// current temp
	LCD_gotoXY(2,0);
	splitDouble(&currentTemp,1,&integerPart,&decimalPart);
	sprintf(buffer,"%3d.%1d",integerPart, decimalPart);
	LCD_sendString(buffer);
	
	// current setpoint
	LCD_gotoXY(2,1);
	splitDouble(&currentTempSetPoint,1,&integerPart,&decimalPart);
	sprintf(buffer,"%3d.%1d",integerPart, decimalPart);
	LCD_sendString(buffer);
	
	// current hist
	LCD_gotoXY(11,1);
	splitDouble(&currentHistSetPoint,1,&integerPart,&decimalPart);
	sprintf(buffer,"%3d.%1d",integerPart, decimalPart);
	LCD_sendString(buffer);
	

}
Example #2
0
File: LCD.c Project: LouizLai/mg
int LCD_putch(char c, FILE *stream)
{
	//recognize \n, \r
	//for \n
		if(c == '\n'){
			LCD_gotoXY(0, ~rowNow);
			return 0;
		}
		
		if(c == '\r'){
			LCD_gotoXY(0, rowNow);
			return 0 ;
		}
		
	
	LCD_Write(Data, c);
	//change line
	colNow++;
	if(colNow>15&&rowNow==0){
		LCD_gotoXY(0,~rowNow);
	}
	//display word by word
	//_delay_ms(100);
	return 0;
}
Example #3
0
File: LCD.c Project: LouizLai/mg
void LCD_moveXY(enum LCD_DirXY dir){
			switch (dir)
			{
				case Left: LCD_gotoXY(abs((--colNow)%16), 1);break;
				case Right: LCD_gotoXY(abs((++colNow)%16), 1); break;
				default: break;
			}
}
Example #4
0
File: LCD.c Project: LouizLai/mg
void LCD_Update(enum Button dir){
	switch (dir)
	{
		case Left: LCD_gotoXY(abs((--colNow)%16), rowNow);break;
		case Right: LCD_gotoXY(abs((++colNow)%16), rowNow); break;
		//case UpDown: LCD_gotoXY(colNow, rowNow==0?1:0); break;
		case Enter: LCD_ShowChar();break;
		default: break;
	}
Example #5
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_writeString_F
  Description  :  Displays a string stored in FLASH, in small fonts (refer to 3310_routines.h)
  Argument(s)  :  string -> Pointer to ASCII string (stored in FLASH)
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_writeString_XY ( uint8_t x, uint8_t y, const char *string, uint8_t flags )
{
	if (flags & RELATIVE)
		LCD_gotoXY(cursor_col+x,cursor_row+y);
	else
		LCD_gotoXY(x,y);

	while ( *string )
		LCD_writeChar( *string++,flags );
}
void LCD_Clear(void)
{
    uint16 index2;
    LCD_gotoXY(COLUMN_BEGINNING, ROW_BEGINNING);
    
	for (index2 = 0 ; index2 < (LCD_X * LCD_Y/FONT_HEIGHT) ; index2++)
    	LCD_Write(LCD_DATA, EMPTY_COLUMN_DATA);
        
  	LCD_gotoXY(COLUMN_BEGINNING, ROW_BEGINNING);
}
Example #7
0
void showLcdSplash(void){
	
	LCD_gotoXY(2,0);
	LCD_sendString("Wine Control");
	LCD_gotoXY(1,1);
	LCD_sendString("Serafim Cunha");
	_delay_ms(2000);
	LCD_clr();
	
	
	
}
Example #8
0
void display_get_armcode(void)
{
	//uint8_t i;
	char message[12] = "Enter Code  ";
	char message_2[12] = "then #      ";
	LCD_clear();
	LCD_gotoXY(0, 2);
	LCD_writeString_F(&message[0]);
	LCD_gotoXY(0, 3);
	LCD_writeString_F(&message_2[0]);
	LCD_clear_row(4);
	LCD_clear_row(5);
}
Example #9
0
void display_last_five_arm(void)
{
	//read onboard eeprom
	LCD_clear();
	LCD_gotoXY(0,0);
	LCD_writeString_F("Select 1    ");
	LCD_gotoXY(0,1);
	LCD_writeString_F("Through 5   ");
	LCD_gotoXY(0,2);
	LCD_writeString_F("To See Last ");
	LCD_gotoXY(0,3);
	LCD_writeString_F("5 Dis/arms  ");
}
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_clear
  Description  :  Clears the display
  Argument(s)  :  None.
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_clear ( void )
{
	int i,j;

	LCD_gotoXY (0,0);  	//start with (0,0) position

	for (i=0; i<8; i++)
		for (j=0; j<90; j++)
			LCD_writeData( 0x00 );

	LCD_gotoXY (0,0);	//bring the XY position back to (0,0)

}
Example #11
0
void display_status(uint8_t status, uint8_t location)
{
	
	int j, i;
	char message[100], state1[] = "ARMED  ", state2[] = "UNARMED", state3[] = "ALARM!!!";
	char place[15];
	if(location == 1) sprintf(place, "    %s      ", "Door");
	else if(location == 2) sprintf(place, "    %s    ", "Window");
	else if(location == 3) sprintf(place, "    %s    ", "Motion");
	else if(location == 4) sprintf(place, "    %s      ", "FIRE");
	if(status == B_ARMED)
	{
		sprintf(message, "%s       ", state1);
		LCD_clear_row(2);
		LCD_gotoXY(0,2);
		for(j=0;j<12;j++)
		{
			LCD_writeChar(message[j]);
		}
	}
	else if(status == B_UNARMED)
	{
		sprintf(message, "%s       ", state2);
		LCD_clear_row(2);
		LCD_gotoXY(0,2);
		for(j=0;j<12;j++)
		{
			LCD_writeChar(message[j]);
		}
	}
	else if(status == B_ALARM)
	{
		sprintf(message, "%s       ", state3);
		LCD_clear_row(2);
		LCD_gotoXY(0,2);
		for(j=0;j<12;j++)
		{
			LCD_writeChar(message[j]);
		}
		LCD_clear_row(3);
		LCD_gotoXY(0,3);
		LCD_writeString_F("Location:");
		LCD_clear_row(4);
		LCD_gotoXY(0,4);
		for(i=0;i<12;i++)
		{
			LCD_writeChar(place[i]);
		}
	}
		
}
Example #12
0
void setLcdInitialFields(void){

	LCD_clr();
	LCD_gotoXY(0,0);
	LCD_sendString("T:");
	LCD_gotoXY(9,0);
	LCD_sendString("ST:");
	
	// sendond filds	
	LCD_gotoXY(0,1);
	LCD_sendString("S:");
	LCD_gotoXY(9,1);
	LCD_sendString("D:");	

}
Example #13
0
void Scrolling_Text_single(char input[], uint8_t position)
{
	int i, j, k, l, length;
	char message[35], swap;
	sprintf(message, "%s ",&input[0]);
	LCD_clear_row(0);
	if(strlen(input) < 23);
	{
		for(l=0;l<(23-strlen(input)-1);l++)
		{
			sprintf(message, "%s ",&message[0]);
		}
	}
	length = strlen(message)-1;
	for(i=0;i<position;i++)
	{
		swap = message[0];
		for(k=0;k < length;k++)
		{
			message[k] = message[k+1];
		}
		message[length] = swap;
	}
		LCD_gotoXY(0,0);
		for(j=0;j<12;j++)
		{
			LCD_writeChar(message[j]);
		}
		//_delay_ms(5);
		
}
Example #14
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_drawBorder
  Description  :  Draws rectangle border on the display
  Argument(s)  :  None
  Return value :  None
--------------------------------------------------------------------------------------------------*/
void LCD_drawBorder (void )
{
	unsigned char i, j;  
	    
	for(i=0; i<7; i++)
	{
		LCD_gotoXY (0,i);
			
		for(j=0; j<84; j++)
		{
			if(j == 0 || j == 83) {
				lcd_buffer[cursor_row][cursor_col + j] |= 0xff;
			} else if(i == 0) {
				lcd_buffer[cursor_row][cursor_col + j] |= 0x08;
				//LCD_writeData (0x08);		// row 0 is having only 5 bits (not 8)
			} else if(i == 6) {
				lcd_buffer[cursor_row][cursor_col + j] |= 0x04;
				//LCD_writeData (0x04);		// row 6 is having only 3 bits (not 8)
			} else {
				lcd_buffer[cursor_row][cursor_col + j] |= 0x00;
				//LCD_writeData (0x00);
			}
		}
	}

	LCD_update();
}	
Example #15
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_clear_row
  Description  :  Clears the display row
  Argument(s)  :  row, 1-6, the row to be cleared
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_clear_row (uint8_t row)
{
	int j;
	
	LCD_gotoXY (0,row);  	//start with (0,row) position

		for(j=0; j<84; j++)
		{
			LCD_writeData( 0x00 );
			if ((row < 6) && (j < 84))
				lcd_buffer[row][j] = 0x00;
		}
   
    LCD_gotoXY (0,0);	//bring the XY position back to (0,0)
      
}
Example #16
0
int
main (void) {
  char msg[30];
  unsigned char c; int i=0;
  int counter[3];
ioinit();
  //initTimer();
  initTimer2();
  initPWM();
  initLCD();
  //initPWM();
  USART_Transmit_String("Restarting..\r\n");
        wait(10);
    //LCD_gotoXY(1,0);
    //LCD_Write("Out-PWM-BC1");
     while (1) {
      unsigned int en, en1;
      asm("nop");
      cli();
       en = topup_timer2;
       en1 = timestamp[0];
      sei();
      sprintf(msg, "%04x,%04x", en, en1);
      USART_Transmit_String(msg);
      LCD_gotoXY(0,0);
      LCD_Write(msg);
    }
    return 0;
}
Example #17
0
int
main (void)
{
  int i;
  char testIntStr[20];

  ioinit ();
//USART_Transmit_String2("This is a test..");

USART_Transmit_String("How are you???");
itoa(0x23,testIntStr,16);
USART_Transmit_String2(testIntStr);
USART_Transmit_String2("Very well, thank you???");
USART_Transmit_String2("Very well, thank you7???");
LCD_gotoXY(0,0);
LCD_Write("hello world");
//USART_Receive_String();
USART_Transmit_String2("This is what is typed in ..");
USART_Transmit_String2(USART_Receive_String());
#if STATS_ENABLED
USART_PrintStats();
#endif
USART_Transmit_String2("Very well, thank you8???");

/* this probably is taken care of by gcc main program exit */
 while(1) {
  asm("nop");
  }
  return (0);
}
Example #18
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_drawBorder
  Description  :  Draws rectangle border on the display
  Argument(s)  :  None
  Return value :  None
--------------------------------------------------------------------------------------------------*/
void LCD_drawBorder (void )
{
	unsigned char i, j;

	for(i=0; i<HW_ROWS; i++)
	{
		LCD_gotoXY (0,i);

		for(j=0; j<HW_COLUMNS; j++)
		{
			if(j == 0 || j == HW_COLUMNS-1)
			{
				lcd_buffer[cursor_row][cursor_col + j] |= 0xff;
			}
			else if(i == 0)
			{
				lcd_buffer[cursor_row][cursor_col + j] |= 0x01;
			}
			else if(i == HW_ROWS-1)
			{
				lcd_buffer[cursor_row][cursor_col + j] |= 0x80;
			}
			// else
			// {
			// 	lcd_buffer[cursor_row][cursor_col + j] |= 0x00;
			// }
		}
	}
	LCD_schedule_update(ALL_ROWS_MODIFIED);
}
Example #19
0
	/*--------------------------------------------------------------------------------------------------
	  Name         :  LCD_writeChar_megaFont
	  Description  :  Displays a character in large fonts, used here for displatying temperature
			  (for displaying '.', '+', '-', and '0' to '9', stored
			  in 3310_routines.h as three dimensional array, number[][][])
	  Argument(s)  :  ch   -> Character to write.
	  Return value :  None.
	--------------------------------------------------------------------------------------------------*/
	void LCD_writeChar_megaFont (unsigned char ch)
	{
		unsigned char i, j;

		if(ch == '.')
			ch = 10;
		else if (ch == '+')
			ch = 11;
		else if (ch == '-')
			ch = 12;
		else
			ch = ch & 0x0f;

		for(i=0;i<3;i++)
		{
			LCD_gotoXY (4 + char_start, i+2);

			for(j=0; j<16; j++) {
				lcd_buffer[cursor_row][cursor_col + j] |=  pgm_read_byte(&(number[ch][i][j]));
				LCD_writeData(lcd_buffer[cursor_row][cursor_col + j]);
			}
		}

		if(ch == '.')
			char_start += 5;
		else
			char_start += 12;
	}
Example #20
0
void LCD_update( void )
{
	int i,j;
	
	LCD_gotoXY (0,0);  	//start with (0,0) position

	for(i=0; i<7; i++)
	{
		LCD_gotoXY (0,i);
		for(j=0; j<84; j++)
		{
			LCD_writeData(lcd_buffer[i][j]);
		}
	}
   
	LCD_gotoXY (0,0);	//bring the XY position back to (0,0)
      
}
Example #21
0
void showLcdSavedMessage(void){
	
	LCD_clr();
	LCD_gotoXY(7,0);
	LCD_sendString(" SAVED");

	_delay_ms(500);
	
}
Example #22
0
void LCD_write_header_text(const char *string)
{
	LCD_clear_header_text();

	LCD_gotoXY(0,0);
	for( uint8_t limiter=0; *string && limiter<MENU_HEADER_LENGTH; limiter++ )
		LCD_writeChar( *string++,0);
	LCD_schedule_update(1<<0);
}
Example #23
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_clear
  Description  :  Clears the display
  Argument(s)  :  None.
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_clear ( void )
{
	int i,j;

	LCD_gotoXY (0,0);  	//start with (0,0) position

	for(i=0; i<HW_ROWS; i++)
	{
		for(j=0; j<HW_COLUMNS; j++)
		{
			if ((i < HW_ROWS) && (j < HW_COLUMNS))
				lcd_buffer[i][j] = 0x00;
		}
	}

	LCD_gotoXY (0,0);	//bring the XY position back to (0,0)
	LCD_schedule_update(ALL_ROWS_MODIFIED);
}
Example #24
0
void display_main_menu_two(void)
{
	LCD_clear();
	LCD_gotoXY(0,0);
	LCD_writeString_F("MENU        ");
	LCD_gotoXY(0,1);
	LCD_writeString_F("6. Lock Door");
	LCD_gotoXY(0,2);
	LCD_writeString_F("7. EXIT");
	/*
	LCD_gotoXY(0,3);
	LCD_writeString_F("3. Last 5 DA");
	LCD_gotoXY(0,4);
	LCD_writeString_F("4. Set Time");
	LCD_gotoXY(0,5);
	LCD_writeString_F("5. More");
	*/
}
Example #25
0
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_clear
  Description  :  Clears the display
  Argument(s)  :  None.
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_clear ( void )
{
	int i,j;
	
	LCD_gotoXY (0,0);  	//start with (0,0) position

	for(i=0; i<8; i++)
	{
		for(j=0; j<90; j++)
		{
			LCD_writeData( 0x00 );
			if ((i < 6) && (j < 84))
				lcd_buffer[i][j] = 0x00;
		}
	}
   
    LCD_gotoXY (0,0);	//bring the XY position back to (0,0)
      
}
Example #26
0
File: LCD.c Project: LouizLai/mg
void LCD_writeString(char *txt){
	
	for (int i=0; txt[i]; i++){
		LCD_Write(Data, txt[i]);
	colNow++;
	if(colNow>15&&rowNow==0){
		LCD_gotoXY(0,~rowNow);
	}
	}
}
Example #27
0
void display_temp(uint8_t int_temp, uint8_t dec_temp)
{
	char message[100];
	if(int_temp <= 9) sprintf(message, "Temp: %u.%u  ", int_temp, dec_temp);
	else if(int_temp <= 99) sprintf(message, "Temp: %u.%u ", int_temp, dec_temp);
	else if(int_temp >99) sprintf(message, "Temp: %u.%u", int_temp, dec_temp);
	LCD_clear_row(1);
	LCD_gotoXY(0,1);
	LCD_writeString_F(message);
}
Example #28
0
	/*--------------------------------------------------------------------------------------------------
	  Name         :  LCD_writeString_megaFont
	  Description  :  Displays a string at current location, in large fonts
	  Argument(s)  :  string -> Pointer to ASCII string (stored in RAM)
	  Return value :  None.
	--------------------------------------------------------------------------------------------------*/
	void LCD_writeString_megaFont ( char *string )
	{
		char_start = 0;

		while ( *string )
			LCD_writeChar_megaFont( *string++ );

		LCD_gotoXY(char_start+6, 3);
		//LCD_writeChar('z'+1); 			  //symbol of Degree
		//LCD_writeChar('F');
	}
Example #29
0
void display_armcode(uint8_t code[])
{
	uint8_t i;
	char codeout[12];
	sprintf(codeout, "%s        ", code);
	for(i=0;i<5;i++)
	{
		if(code[i] == 11) code[i] = 0;
	}
	LCD_clear_row(4);
	LCD_gotoXY(0,4);
	LCD_writeString_F(&codeout[0]);
}
/*--------------------------------------------------------------------------------------------------
  Name         :  LCD_writeChar_megaFont
  Description  :  Displays a character in large fonts, used here for displatying temperature
		  (for displaying '.', '+', '-', and '0' to '9', stored
		  in 3310_routines.h as three dimensional array, number[][][])
  Argument(s)  :  ch   -> Character to write.
  Return value :  None.
--------------------------------------------------------------------------------------------------*/
void LCD_writeChar_megaFont (unsigned char ch)
{
	for (unsigned char i=0;i<2;i++) {
		LCD_gotoXY (char_start, i);

		for (unsigned char j=0; j<14; j++) {
			LCD_writeData( number[ch][i][j]);
        	}
	}

	if (ch == MEGA_FONT_DOT)
		char_start += 5;
	else
		char_start += 14;
}