Pages: [1]   Go Down
Author Topic: ITDB02 + Shield 2.0 = Touch not working  (Read 4773 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 80
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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 !
Logged

0
Offline Offline
Jr. Member
**
Karma: 2
Posts: 80
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright, solved the problem on my own smiley
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)".
Logged

China
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@Maxdot,

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

Sincerely yours,

Wendy
Logged

Make innovation easier!
http://imall.iteadstudio.com/

Harlow, Essex, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know for the ITDB02 library, but with the UTFT library there are the functions:
Code:
printNumI(num, x, y [, length [, filler]]);
printNumF(num, dec, x, y [, divider [, length [, filler]]]);

You use like that, for example:
Code:
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 smiley-wink
Logged

Harlow, Essex, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:

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();

    }
}
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4261
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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:  ==> http://arduino.cc/forum/index.php?topic=94633.0


Don
Logged

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 <space> character in the sevenseg font.. If you replace ' ' by '0', it will work.
« Last Edit: October 17, 2012, 05:18:35 pm by guix » Logged

Harlow, Essex, UK
Offline Offline
Jr. Member
**
Karma: 1
Posts: 67
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

Logged

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) smiley-sad

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 <space>, <dot> and <minus> 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 ':' smiley
« Last Edit: October 17, 2012, 07:51:53 pm by guix » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 30
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
Logged

Oslo, Norway
Offline Offline
Full Member
***
Karma: 6
Posts: 126
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

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: http://www.henningkarlsen.com/electronics/r_fonts.php

/Henning
Logged

Torino (Italy)
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

France
Offline Offline
God Member
*****
Karma: 34
Posts: 987
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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: http://www.henningkarlsen.com/electronics/r_fonts.php

/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 smiley
Logged

Pages: [1]   Go Up
Jump to: