0
Offline
Jr. Member
Karma: 1
Posts: 73
Arduino rocks
|
 |
« on: August 17, 2012, 01:02:37 pm » |
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.pdfMy 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 !
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 73
Arduino rocks
|
 |
« Reply #1 on: August 17, 2012, 07:30:45 pm » |
Alright, solved the problem on my own  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
Newbie
Karma: 0
Posts: 17
|
 |
« Reply #2 on: September 17, 2012, 04:32:51 am » |
@Maxdot,
Glad to learn that you have solved the question by yourself!
Sincerely yours,
Wendy
|
|
|
|
|
Logged
|
|
|
|
|
Harlow, Essex, UK
Offline
Jr. Member
Karma: 1
Posts: 67
|
 |
« Reply #3 on: October 17, 2012, 01:09:37 pm » |
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 
|
|
|
|
|
Logged
|
|
|
|
|
France
Offline
God Member
Karma: 19
Posts: 618
Scientia potentia est.
|
 |
« Reply #4 on: October 17, 2012, 02:07:37 pm » |
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 
|
|
|
|
|
Logged
|
|
|
|
|
Harlow, Essex, UK
Offline
Jr. Member
Karma: 1
Posts: 67
|
 |
« Reply #5 on: October 17, 2012, 03:57:09 pm » |
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();
} }
|
|
|
|
|
Logged
|
|
|
|
|
Western New York, USA
Offline
Faraday Member
Karma: 17
Posts: 3461
|
 |
« Reply #6 on: October 17, 2012, 04:08:14 pm » |
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.0Don
|
|
|
|
|
Logged
|
|
|
|
|
France
Offline
God Member
Karma: 19
Posts: 618
Scientia potentia est.
|
 |
« Reply #7 on: October 17, 2012, 05:11:03 pm » |
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
Jr. Member
Karma: 1
Posts: 67
|
 |
« Reply #8 on: October 17, 2012, 07:09:06 pm » |
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.cThanks again for your help and guidance 
|
|
|
|
|
Logged
|
|
|
|
|
France
Offline
God Member
Karma: 19
Posts: 618
Scientia potentia est.
|
 |
« Reply #9 on: October 17, 2012, 07:35:06 pm » |
No problem, I tried your file but couldn't get it to work, still show weird things instead of a space (btw it's SevenSegNumFont Plus)  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 ':' 
|
|
|
|
« Last Edit: October 17, 2012, 07:51:53 pm by guix »
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 30
|
 |
« Reply #10 on: November 12, 2012, 10:38:07 am » |
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
God Member
Karma: 19
Posts: 618
Scientia potentia est.
|
 |
« Reply #11 on: November 12, 2012, 01:01:19 pm » |
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 
|
|
|
|
|
Logged
|
|
|
|
|
Oslo, Norway
Offline
Full Member
Karma: 5
Posts: 104
|
 |
« Reply #12 on: November 15, 2012, 07:44:18 pm » |
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  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
Newbie
Karma: 0
Posts: 1
|
 |
« Reply #13 on: November 19, 2012, 08:43:07 pm » |
You could explain better to make example, me not to understand Thanks
|
|
|
|
|
Logged
|
|
|
|
|
France
Offline
God Member
Karma: 19
Posts: 618
Scientia potentia est.
|
 |
« Reply #14 on: November 19, 2012, 09:21:29 pm » |
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 
|
|
|
|
|
Logged
|
|
|
|
|
|