int main() { int distance_inches=0; lcd_init(0); pause(100); lcd_clear(); while(1) { pause(30); lcd_clear(); distance_inches=ping_inches(8); if (distance_inches < 10) { lcd_print_number(distance_inches); lcd_write_char(':'); lcd_write_char('('); pause(100); drive_speed(27,-27); lcd_clear(); } else drive_speed(0,0); } }
uint16 lcd_write_string(uint16 x, uint16 y, char *str) { if(*str==0) { // if string has zero length return 0; // abort } /* if ( x<0 ) { // if special alignment required if(x==LCD_LEFT) { // if aligned left x = 0; } else if(x==LCD_CENTER) { // if centered x = (LCD_WIDTH_X-lcd_get_string_width(str))/2; } else if(x==LCD_RIGHT) { // if aligned right x = LCD_WIDTH_X-lcd_get_string_width(str); } else { return -3; // illegal value, abort } }*/ while(*str >= d_font->first_char) { // while end of string not reached and printable char x += lcd_write_char(x,y,*str++); // write next character } return 0; }
void lcd_writeLine1 ( char *str ) { // eerst de eerste 8 karakters = regel 1 // eerste pos regel 1 for(;*str; str++){ lcd_write_char(*str); } }
int putchar(int c) { uart1_writeb((char)c); lcd_write_char((char)c); return c; }
void lcd_write_str(char* str) { uint8_t index=0; while(str[index]!=0 && index<8) { lcd_write_char(str[index]); index++; } }
void int_timer0(void){ TCCR0=0x00; if(t0_flag==0){ waitflag--; lcd_write_char(10,0,0x30+(waitflag/100)); lcd_write_char(11,0,'s'); if(waitflag>1){ TCNT0=0x00; TCCR0=0x07; } }else{ waitflag--; if(waitflag==1){ waitflag=32; tempcontrol();//执行温度调节 } TCNT0=0x00; TCCR0=0x07; } return; }
/** * [lcd_write_string LCDд�����ַ���] * @param row [������] * @param col [������] * @param ptr [��д����ַ���] */ void lcd_write_string(u8 row,u8 col,char* ptr){ while(*ptr != NULL){ if(col > 15){ row+=2; col = 0; if(row > 7){ row = 0; } } lcd_write_char(row,col++,*ptr); ++ptr; } }
uint8_t lcd_generatechar(uint8_t code, const uint8_t *data) { uint8_t i = 0; // Startposition des Zeichens einstellen lcd_command(LCD_SET_CGADR|(code<<3)); // Bitmuster übertragen for (i = 0; i < 8; i++) { lcd_write_char(data[i]); } return 0; }
void lcd_display_string(char* line1, char* line2) { int i; int l1Length = strlen(line1); int l2Length = strlen(line2); l1Length = (l1Length < LINE_LENGTH)? l1Length : LINE_LENGTH; l2Length = (l2Length < LINE_LENGTH)? l2Length : LINE_LENGTH; lcd_clear_command(); //print the first line for (i = 0; i < l1Length; i++) { lcd_write_char(line1[i]); } //move to second line for (i = 0; i < VIRTUAL_LINE_LENGTH - strlen(line1); i++) { lcd_write_char(' '); } //print the second line for (i = 0; i < strlen(line2); i++) { lcd_write_char(line2[i]); } }
/* // writes a string to the lcd */ void lcd_write_string(LCD_CONFIG* lcd, unsigned char* str) { while (*str) lcd_write_char(lcd, *str++); }