Exemplo n.º 1
0
int main(void)
{
  lcd_init();

  lcd_cursor(0,0);
  lcd_printch('K');

  lcd_cursor(1,0);
  lcd_printch('i');

  lcd_cursor(2,0);
  lcd_printch('s');

  lcd_cursor(3,0);
  lcd_printch('a');

  lcd_cursor(4,0);
  lcd_printch('r');


  lcd_cursor(5,0);
  lcd_printch('a');


  lcd_cursor(6,0);
  lcd_printch('z');


  lcd_cursor(7,0);
  lcd_printch('u');

  return 0;
}
Exemplo n.º 2
0
//文字列をスクロール表示、構造体で方向および速度を設定する
void lcd_scroll(SCROLL_FACTORY settings) {
	int i;

	for (;;) {
		//画面を塗りつぶす(残像防止)
		lcd_cursor(0, 0);
		for (i = 0; i < 32; i++) {
			lcd_printch(' ');
			if (i == 15) {
				lcd_cursor(0, 1);
			}
		}

		lcd_print_with_position(settings.string, settings.x, settings.y);

		//方向設定に従って座標を更新
		settings.x += settings.direction;

		//改行の判断、座標の変更
		if (settings.x >= 16 || settings.x < 0) {
			if (settings.y == 0) {
				settings.y = 1;
			} else {
				settings.y = 0;
			}

			if (settings.direction == LEFT) {
				settings.x = 15;
			} else {
				settings.x = 0;
			}
		}
		wait1ms(settings.speed);
	}
}
Exemplo n.º 3
0
void print_zero(unsigned int value)
{
  if(value/10==0)
  {
    lcd_printch('0');
  }
}
Exemplo n.º 4
0
//右に揃えて表示
void draw_num(int num){
	int x;
	int keta;
	//一文字ずつ表示していく
	keta=1, x=15;
	do{
		lcd_cursor(x,0);
		if(keta > 3){
			lcd_printch(',');
			keta=0;
		}else{
			lcd_printch(num%10+'0');
			num /= 10;
		}
		x--,	keta++;
	}while(num != 0);
	
}
Exemplo n.º 5
0
void time_print(TIME time)
{
  char buf[17];

  my_itoa(buf,time.hour);
  print_zero(time.hour);
  lcd_printstr(buf);
  lcd_printch(':');

  my_itoa(buf,time.minute);
  print_zero(time.minute);
  lcd_printstr(buf);
  lcd_printch(':');

  my_itoa(buf,time.second);
  print_zero(time.second);
  lcd_printstr(buf);
}
Exemplo n.º 6
0
//LCDの任意座標に文字列を表示、自動改行
void lcd_print_with_position(char* string, int x, int y) {
	int i;

	//一文字ずつLCDに表示
	for (i = 0; string[i] != '\0' && i < 32; i++) {
		lcd_cursor(x, y);
		lcd_printch(string[i]);
		x++;

		//改行が必要かチェック
		nw_check(&x, &y);
	}
}
Exemplo n.º 7
0
void stop_watch_print(TIME time)
{
  char buf[17];

  my_itoa(buf,time.hour);
  print_zero(time.hour);
  lcd_printstr(buf);
  lcd_printch(':');

  my_itoa(buf,time.minute);
  print_zero(time.minute);
  lcd_printstr(buf);
  lcd_printch(':');

  my_itoa(buf,time.second);
  print_zero(time.second);
  lcd_printstr(buf);

  my_itoa(buf,time.msec/10);
  lcd_printch('.');
  print_zero(time.msec/10);
  lcd_printstr(buf);
}