EmbDev.net

Forum: µC & Digital Electronics Display ( ST7565)


von Jean-pierre K. (jean)


Rate this post
useful
not useful
Help

I am from Belgium, i am a newbie in AVR en C.

I have 2 questions

Whats the difference between #include "font.h" and #include <font.h> ?

The second question is a bit complicated.

How do i display a varible on my grafik display (ST7565R)
The funtions:    lcd_print2_P(60,28, "Text 1", 
&Microsoft_Sans_Serif__13,0); works but only with strings.

Can someone help me.



int main(void)
{
  init();
  lcdInit();
  lcdClear();
  PortLcdCtrl|=0b00100000;  // Licht an
  lcd_print2_P(60,3, "G", &Microsoft_Sans_Serif__13,0);
  lcd_print2_P(60,28, "Text 1", &Microsoft_Sans_Serif__13,0);
  lcd_print2_P(60,48, "Text 2", &Times_New_Roman__8,0);
  //lcd_print2_P(140,28, "Text 3", &Microsoft_Sans_Serif__13,0);
  //lcd_print2_P(140,48, "Text 4", &Microsoft_Sans_Serif__13,0);
  char     texte[10];
  double     komma;
  komma=70;
  komma= komma+1;
  dtostrf (komma, 10, 1, texte);

  lcd_print2_P(40,10,texte, &Times_New_Roman__8,0);//I want to print the 
variable texte on my display, how?
  for(;;)
  {  ;

  }
}

: Moved by Moderator
von JD (Guest)


Rate this post
useful
not useful
"font.h" searches for the file in the current directory, <font.h> 
searches all defined include directories, I think.

If you want to print a variable/number via that function you have to 
convert it to a string first, e.g. using sprintf() or similar.

von Jean-pierre K. (jean)


Rate this post
useful
not useful
Thank you for the respons

My first question is solved with your anwser.


"
I thought dat "dtostrf made from the variable "komma" a string "texte"

Can you write some code how i can print this on my grafik display with 
sprintf()


with

 lcd_print2_P(40,10,"texte", &Times_New_Roman__8,0);

this wil print texte on the display and not 70

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.