Text display

General discussion on Visual GLCD Software.
Post Reply
Author
Message
Vineyards
Posts: 73
Joined: 25 Feb 2008 22:12

Text display

#1 Post by Vineyards » 10 Oct 2010 22:21

I drag two buttons one of which displays a static text and another to display dynamic data such as ADC measurement result.

Should I use the usual T6963C_Write_Text function to display ADC data on the other button or should I use the Caption_Text commands provided with the tool. Can you give an example showing the best method of displaying measurement results on a caption button using your library.

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

Re: Text display

#2 Post by milan » 11 Oct 2010 08:55

Hi,

just load example "EasyPIC6_ADC_Demo.vglcd" and choose your programming language.

Then take a look at the file EasyPIC6_ADC_Demo_events_code, procedure Rectangle1Down and you will see the code for ADC label (Label15).

In mikroBasic it looks like this:

Code: Select all

    adc_value = ADC_Get_Sample(3)    ' read analog value from ADC
    IntToStr(adc_value, txt)
    Rtrim(txt)
    Label15_Caption = txt
    DrawLabel(@Label15)
SmartADAPT2 rules !

Vineyards
Posts: 73
Joined: 25 Feb 2008 22:12

Re: Text display

#3 Post by Vineyards » 11 Oct 2010 14:58

I am trying to get this simple code to work:

Code: Select all

#include "test06_objects.h"

void main() {

  Start_TP();

  while (1) {
    Check_TP();
    Label1_Caption[5]="merha";
    DrawLabel(&label1);
  }

}

I am doing this just to make sure I can display text later on I will add the required ADC code. This however fails. Nothing is displayed.

The compiler is MikroC 4.15 and both programs are registered. What seems to be the problem?

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

Re: Text display

#4 Post by milan » 11 Oct 2010 15:36

Hi,

In C language this line :

Code: Select all

Label1_Caption[5]="merha";
will write to the array element with index 5.




You should include C_String library and try something like this:

Code: Select all

strcpy(Label1_Caption, "merha");
just like in the ADC example project
SmartADAPT2 rules !

Vineyards
Posts: 73
Joined: 25 Feb 2008 22:12

Re: Text display

#5 Post by Vineyards » 11 Oct 2010 20:12

Here is the code:

Code: Select all

#include "test06_objects.h"

void main() {
char txt[7];
int raw;
float ph;
porta=0;
trisa=255;
Start_TP();

  while (1) {
   // Check_TP();
    raw=adc_read(0);
    inttostr(raw,txt);
    Rtrim(txt);
  strcpy(Label1_Caption, txt);
  DrawLabel(&Label1);
  }

}
This works OK but when the line Check_TP(); is enabled, the loop stalls and it only displays the value read in the first pass. Could it be expecting a tap on the screen? There aren't any buttons or touchable objects though.

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

Re: Text display

#6 Post by milan » 12 Oct 2010 08:00

Hi,

Visual Glcd http://www.visualglcd.com is RAD (Rapid Application Development) tool for working with displays and touch panels. Programmer only writes code for Touch Panel events (OnUp, OnDown, OnClick and OnPress).


If you want to use it only for display, then you can/should comment the Touch Panel routines.
SmartADAPT2 rules !

CS
Posts: 357
Joined: 20 Dec 2005 23:30
Location: Germany

Re: Text display

#7 Post by CS » 12 Oct 2010 21:12

Hi milan,

that is the reason, why I made a suggestion in an other thread.

Let us disable the TP-functionality when we don't use a touch panel. I think a checkbox should disable all functions for the TP.

Regards

CS

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

Re: Text display

#8 Post by milan » 13 Oct 2010 07:52

Hi,

your suggestion is already added to the wish list :wink:

Thank you for helping us to improve Visual GLCD tool :D
SmartADAPT2 rules !

Post Reply

Return to “Visual GLCD General”