Exemplo n.º 1
0
	//Point moving
	void lcdMovePoint(uint8_t pos)
	{
		//clear points
		int i;
		for(i = 1; i <= 3; i++)
		{
		 LCD_Goto(1, i);
		 LCD_Putc(' ');
		}
		
		LCD_Goto(1, pos + 1);
		LCD_Putc('>');
	}
Exemplo n.º 2
0
/*******************************************************************************
*  ??????                                                                *
*******************************************************************************/
void main()
{
     OSCCON     = 0b01110010 ;   // ???????8??????
     OPTION_REG = 0b00000000 ;   // ????I/O???????????????
     ANSELA     = 0b00000000 ;   // ??????????????????I/O??????
     TRISA      = 0b00000110 ;   // ???RA1(SCL)/RA2(SDA)????(RA3?????)
     WPUA       = 0b00000000 ;   // RA1/RA2???????????????
     PORTA      = 0b00000000 ;   // ????????(??LOW???)

     RA4 = 0;
     __delay_ms(500);
     RA4 = 1;
     __delay_ms(500);

     int i = 0;
     // ?????????(????100KHz)
     InitI2C_Master(1) ;

     // ??????????????
     // ICON OFF,??????(0-63),VDD=3.3V???,LCD?8???
     LCD_Init(LCD_NOT_ICON,32,LCD_VDD3V,8) ;

     while(1)
     {
         if(RA4 == 0)
             i++;
         LCD_SetCursor(0,0) ;        // ?????????
         LCD_Puts("-JP7FKF-") ;
         LCD_SetCursor(0,1) ;        // ?????????
         LCD_Putc(i+0x30) ;
     }
}
Exemplo n.º 3
0
	inline void inputRepaintF(float value)
	{
		//if need, we clear display
		LCD_Goto(1, 0);//print title
		LCD_Puts(activeItem->Text);
		LCD_Goto(2, 1);
		LCD_Puts("Параметр:");
		LCD_Putc(' ');
		LCD_PutFloat(value);//print value
	}
void timeset(uint8_t *value, uint8_t min_num, uint8_t max_num, uint8_t Reg, uint8_t column, uint8_t row) {
    sw_RA0.flags = 0;
    sw_RA1.flags = 0;
    while (!sw_RA0.flag.press) {
        if (cnt_t1 % 16 >= 8) {
            LCD_SetCursor(column, row); // 表示位置を設定する
            LCD_Puts("  ");
        } else {
            *value = RTC_Read(Reg);
            display();
            LCD_SetCursor(column, row); // 表示位置を設定する
            LCD_Putc(*value / 16 + '0');
            LCD_Putc(*value % 16 + '0');
        }
        if (sw_RA1.flag.press) {
            sw_RA1.flag.press = 0;
            uint8_t t = *value % 16 + (*value / 16)*10;
            if (t >= max_num) {
                t = min_num;
            } else {
                t++;
            }
            *value = t % 10 + (t / 10)* 16;
            RTC_Write(Reg, *value);
        }
        if (sw_RA1.flag.long_holding_1) {
            sw_RA1.flag.long_holding_1 = 0;
            uint8_t t = *value % 16 + (*value / 16)*10;
            if (t + 9 >= max_num) {
                t = t % 10;
            } else {
                t += 10;
            }
            *value = t % 10 + (t / 10)* 16;
            RTC_Write(Reg, *value);
        }
    }
    sw_RA0.flags = 0;
}
Exemplo n.º 5
0
/**
 * Send new text to the LCD
 */
static void LCD_SendTextToDevice(LCD_RowTypeDef LCD_Row) {

	LCD_Position(LCD_Row);
	char* s;
	uint8_t chars=0;
	if (LCD_Row==LCD_ROW1) {
		s=LCD_Data.row1;
		chars=LCD_Data.chars1;
	}
	else {
		s=LCD_Data.row2;
		chars=LCD_Data.chars2;
	}

	uint8_t i;
	for (i=0;i<LCD_CHAR_PER_LINE;i++) {
		if (i<chars)
			LCD_Putc(s[i]);
		else {
			LCD_Putc(' '); // fill in rest of line with blanks
		}

	}
}
void display(uint8_t i, uint8_t co) {
    LCD_Clear();
    LCD_SetCursor(0, 0);
    LCD_Puts("Charge Station 5");
    LCD_SetCursor(0, 1);
    if (auto_cut_ON[print_port]) {
        switch (i) {
            case 0:
                LCD_Puts("Right");
                break;
            case 1:
                LCD_Puts("Center");
                break;
            case 2:
                LCD_Puts("Left");
                break;
        }
    } else {
        switch (i) {
            case 0:
                LCD_Puts("RIGHT");
                break;
            case 1:
                LCD_Puts("CENTER");
                break;
            case 2:
                LCD_Puts("LEFT");
                break;
        }
    }
    switch (co) {
        case 0://Port Name, x.xxxA
            LCD_SetCursor(8, 1);
            LCD_Putc((v[i] % 10000) / 1000 + '0');
            LCD_Putc('.');
            LCD_Putc((v[i] % 1000) / 100 + '0');
            LCD_Putc((v[i] % 100) / 10 + '0');
            LCD_Putc((v[i] % 10) / 1 + '0');
            LCD_Putc('A');
            break;
        case 1://Port Name, xxxxxmAh
            LCD_SetCursor(7, 1);
            LCD_Putc((s[i] % 1000000) / 100000 + '0');
            LCD_Putc((s[i] % 100000) / 10000 + '0');
            LCD_Putc((s[i] % 10000) / 1000 + '0');
            LCD_Putc((s[i] % 1000) / 100 + '0');
            LCD_Putc((s[i] % 100) / 10 + '0');
            LCD_Putc((s[i] % 10) / 1 + '0');
            LCD_Puts("mAh");
            break;
        case 2://Port Name, Reset?
            LCD_SetCursor(8, 1);
            LCD_Puts("Reset?");
            break;
        case 3://Port Name, Reseted
            LCD_SetCursor(8, 1);
            LCD_Puts("Reseted");
            break;
        case 4://Port Name, alwaysON
            LCD_SetCursor(7, 1);
            LCD_Puts("Always ON");
            break;
        case 5://Port Name, alwaysOFF
            LCD_SetCursor(7, 1);
            LCD_Puts("Auto Stop");
            break;
    }
}
void display(void) {
    ss = RTC_Read(0x00);
    mm = RTC_Read(0x01);
    hh = RTC_Read(0x02);
    EE = RTC_Read(0x03);
    DD = RTC_Read(0x04);
    MM = RTC_Read(0x05);
    YY = RTC_Read(0x06);
    LCD_SetCursor(0, 0); // 表示位置を設定する
    LCD_Putc(YY / 16 + '0');
    LCD_Putc(YY % 16 + '0');
    LCD_Putc('/');
    LCD_Putc(MM / 16 + '0');
    LCD_Putc(MM % 16 + '0');
    LCD_Putc('/');
    LCD_Putc(DD / 16 + '0');
    LCD_Putc(DD % 16 + '0');
    LCD_SetCursor(0, 1); // 表示位置を設定する
    LCD_Putc(hh / 16 + '0');
    LCD_Putc(hh % 16 + '0');
    LCD_Putc(':');
    LCD_Putc(mm / 16 + '0');
    LCD_Putc(mm % 16 + '0');
    LCD_Putc('-');
    LCD_Putc(ss / 16 + '0');
    LCD_Putc(ss % 16 + '0');
}