Display ( ST7565)

OP #1853432
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(;;)
  {  ;

  }
}
Guest #1854305
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.
OP #1854753
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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.