ITDB02 + Shield 2.0 = Touch not working

Hello guys, I need your help:

I just received your ITDB02 Shield 2.0 in combination with the ITDB02-2.4E 2.4" TFT LCD Module on an Iteaduino 2.2.
Screen functions work fine so far. Now i want to show the X and Y positions from the touch controller on the display.
The problem with the new Shield 2.0 is that there is not output for the D_IRQ signal at all. The previous version (1.3) had this output on digital pin 8.
However, the ITDB02_Touch library requires this signal on its initialisation: ITDB02_Touch(TCLK, TCS, TDIN, TDOUT, IRQ);
Can you tell me how I can get touch function to work ?
Datasheet from my Shield: http://www.exp-tech.de/service/pdf/ITDB02%20Arduino%20shield%20v2.0.pdf

My test-code:

#include <UTFT.h>
#include <ITDB02_Touch.h>

extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];

UTFT myGLCD(ITDB24E_8,19,18,17,16); 
ITDB02_Touch  myTouch(15,8,14,9,8);


void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setColor(0, 255, 0);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.setFont(BigFont);
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
}

void loop()
{
   while (myTouch.dataAvailable() == true)
    {
      int x,y;
      x = myTouch.getX();
      y = myTouch.getY();
      myGLCD.printNumI(x, CENTER, 100);
      myGLCD.printNumI(x, CENTER, 120);
    }
}

Thanks for your help !

Alright, solved the problem on my own :slight_smile:
I forget to call " myTouch.read()" before reading the touch-coordinates and I changed the initialisation to "ITDB02_Touch myTouch(15,8,14,9,10)".

@Maxdot,

Glad to learn that you have solved the question by yourself!

Sincerely yours,

Wendy

Having just bought a similar touch screen LCD, how do you stop old number staying on screen when refreshed with a new number.

For example if you are going from a 3 digit number to a 2 digit number, you can still see some of the old number behind.

Hope that makes sense :slight_smile:

I don't know for the ITDB02 library, but with the UTFT library there are the functions:

printNumI(num, x, y [, length [, filler]]);
printNumF(num, dec, x, y [, divider [, length [, filler]]]);

You use like that, for example:

myGLCD.printNumI( myInt, CENTER, 5, 4, ' ');
myGLCD.printNumF( myFloat, 1, CENTER, 5, '.', 4, ' ' );

The filler parameter is the thing you need to erase the previously displayed character :wink:

Many thanks for the reply.

I was using the ITDB02_Graph16 library where I am now using the latest UTFT library.

I do however, seem to be experiencing some artifacts left behind when the numbers shrink from 3 characters to 2 for example.

It can be seen here:

Full code:

#include <UTFT.h>
//#include <ITDB02_Graph16.h>
#include <ITDB02_Touch.h>


// Declare which fonts we will be using
extern uint8_t SmallFont[];
extern uint8_t BigFont[];
extern uint8_t SevenSegNumFont[];


//myGLCD(RS,WR,CS,RST,ALE,mode);
UTFT myGLCD(ITDB32S,A1,A2,A0,A3,A5);    // Remember to change the model parameter to suit your display module!
//ITDB02 myGLCD(A1,A2,A0,A3,A5,ITDB32S);
//myTouch(TCLK,TCS,DIN,DOUT,IRQ);
ITDB02_Touch  myTouch(13,10,11,12,A4);


void setup()
{
  myGLCD.InitLCD();
  myGLCD.clrScr();

  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  
  myGLCD.setFont(SmallFont);
  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 319, 13);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.print("S.TISSEYRE - 2012", CENTER, 1);
  myGLCD.setBackColor(0, 0, 0);

  myGLCD.setColor(0, 255, 0);
  myGLCD.setFont(SevenSegNumFont);
}

void loop()
{
  while (myTouch.dataAvailable() == true)
    {
      int x,y;
      x = myTouch.getX();
      y = myTouch.getY();
      myGLCD.printNumI(x, CENTER, 50, 1, ' ');
      myGLCD.printNumI(y, CENTER, 120, 3);
            myTouch.read();

    }
}

For example if you are going from a 3 digit number to a 2 digit number, you can still see some of the old number behind.

This topic pops up like clockwork with the character mode LCDs!

Check this out to see if you get some ideas that might work in your situation: ==> Arduino Forum

Don

I have same problem with that font! Try another, it's working BUT, in your code there are little mistakes:

myGLCD.printNumI(x, CENTER, 50, 3, ' ');
myGLCD.printNumI(y, CENTER, 120, 3, ' ');

I think it's because there is no character in the sevenseg font.. If you replace ' ' by '0', it will work.

Thanks ever so much Guix, it has been solved by generating an additional character in the font.

To make it easier for others that may come across this, I have linked to the ammended DefaultFonts.c file leaving the original font in tact. Just change the font name in your main code from 'SevenSegNumFont' to 'SevenSegNumFontSpace'.

http://www.networkedsolutions.co.uk/arduino/DefaultFonts.c

Thanks again for your help and guidance :slight_smile:

No problem, I tried your file but couldn't get it to work, still show weird things instead of a space (btw it's SevenSegNumFontPlus) :frowning:

I think it's not the correct way to add a character in a font. I will look into that someday, as I would like a nice numeric font with , and characters, to display floats.

Edit: Ok your file is working, we must just use ':' as filler instead of ' ', because in the ASCII table what is after '9' is ':' :slight_smile:

How do you get the SevenSegNumFont or SevenSegNumFontSpace to display the correct value for the decimal point? It shows up as '8'

There is no decimal point in the SevenSegNumFont. Here is your problem! And you can't just add it like the space character was added. I'm (slowly) working on rewriting the font loading code of the UTFT library.. Hard task, for me anyway :slight_smile:

guix:
There is no decimal point in the SevenSegNumFont. Here is your problem! And you can't just add it like the space character was added. I'm (slowly) working on rewriting the font loading code of the UTFT library.. Hard task, for me anyway :slight_smile:

Why are you doing this??? UTFTs printNumF() already has everything you need. Use the SevenSegNumFontPlus font and add a blank character at the end. Change the ':' to a '.' if you want to. Then simply specify ':' as a divider and ';' as filler. There is no need whatsoever to rewrite the function for this.

Font can he downloaded here: Electronics - Henning Karlsen

/Henning

You could explain better to make example, me not to understand
Thanks

doc_norway:
Why are you doing this??? UTFTs printNumF() already has everything you need. Use the SevenSegNumFontPlus font and add a blank character at the end. Change the ':' to a '.' if you want to. Then simply specify ':' as a divider and ';' as filler. There is no need whatsoever to rewrite the function for this.

Font can he downloaded here: Electronics - Henning Karlsen

/Henning

Hello, I do this for other reasons than just for decimal point, (I hope) my modifications will allow any fonts arrays created by the program "the dot factory", to be loaded with very little modifications needed, also will use a "lookup table" to replace characters by others, this way we can do whatever character sets, in any orders, and it will save a lot of memory usage... When it's ready I will tell you so you could maybe add it to official release if you like :slight_smile: