Esempio n. 1
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]);
		}
	}
		
}
Esempio n. 2
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);
		
}
Esempio n. 3
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);
}
void main() {

    LCD_port_init();
    LCD_init();
    place_lcd_cursor(0,0);
    LCD_writeChar('h');


    //InitTimer0();
   // TRISDbits.RD3 = 1;

    while(1)
    {
        /*
        for(int i = 0; i < 8; i++)
        {
            binaryCount[i] = '0';
            intCount[i] = ' ';
        }

        char temp = display;
        int j = 7;
        while(temp > 0)
        {
            intCount[j] = temp % 10 + 0b00110000;
            temp /= 10;
            j--;
        }

        temp = display;
        j = 7;
        while(temp > 0)
        {
            binaryCount[j] = temp % 2 + 0b00110000;
            temp /= 2;
            j--;
        }


        if(PORTDbits.RD3 == 0)
        {
           display = TMR0;
           Delay100ms();
           while(PORTDbits.RD3 == 0);
           Delay100ms();
        }

           place_lcd_cursor(0,1);
           LCD_write(intCount);
           place_lcd_cursor(0,0);
           LCD_write(binaryCount);

         Delay100ms();
         */
    }
}
Esempio n. 5
0
void clock_draw()
{
	uint16_t prescaled=timer/CLOCK_PRESCALE;

	LCD_writeString_XY(20,2,itoa(prescaled/60,3),OVERWRITE);
	LCD_writeChar(':',OVERWRITE);
	LCD_writeString_XY(0,0,itoa_fill(prescaled%60,2,'0'),OVERWRITE|RELATIVE);
	if(prescaled%60==0 && timer!=0)
		beep(BEEP_CLOCK_MINUTE);
}
Esempio n. 6
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_write(unsigned char data[])
{
    //Create a variable to track the yPos, this only works if we begin on line 0

    for(int i=0; data[i]!='\0'; i++)
    {
        if(data[i] == '\n')
        {
            // if we encounter a new line character, increment display line
            ++yPos;
            place_lcd_cursor(0,yPos);
        }
        else
        {
            // call our character writing function to display the next char
            LCD_writeChar(data[i]);
        }
    }
}
Esempio n. 8
0
void Scrolling_Text(char input[])
{
	int i, j, k, length;
	char message[100], swap;
	sprintf(message, "%s              ",&input[0]);
	length = strlen(message)-1;
	for(i=0;i<19;i++)
	{
		swap = message[0];
		for(k=0;k < length;k++)
		{
			message[k] = message[k+1];
		}
		message[length] = swap;
		LCD_gotoXY(0,2);
		for(j=0;j<12;j++)
		{
			LCD_writeChar(message[j]);
		}
		_delay_ms(500);
		LCD_clear();
	}
}
Esempio n. 9
0
void LCD_writeString(const char *str) {
	while(*str) {
		LCD_writeChar(*str++);
	}
}
Esempio n. 10
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_F ( unsigned char *string )
{
	while ( *string )
		LCD_writeChar( *string++ );
}
Esempio n. 11
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_F ( const char *string )
{
	while ( *string )
		LCD_writeChar( *string++ );
}