Experimentalist
Well-known member
Anyway, here's the latest library
Thanks for posting the library it sounds like you and Dawnmist will save me a lot of work.
It's looking good in the pics !
Ex.
Anyway, here's the latest library
not sure why you then?
I only used 1-15 for simplicity's sake to get the display working. When I actually start my project, they won't be using those particular pins.
Also, do you think there are any performance improvements to be had in converting to direct register addressing instead of digitalWriteFast() for each pin?
I've got wires soldered to those pads underneath and brought out to pins that I've then breadboarded
It really shouldn't matter for the lengths involved. Wire size should only matter in two situations. Long wiring runs, or dealing with significant amounts of current. The latter is mostly irrelevant, since the teensy itself isn't capable of sourcing significant amounts of current, and shouldn't be used as such. For most projects, wire length isn't going to be an issue either, since most sensors, displays, etc, are going to be within six inches of the teensy anyway. For general purpose use, I probably wouldn't go below 26 gauge, but like I said, it's not that critical and most likely anything you have laying round will be larger than that, which is fine.
#include <UTFT.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];
//UTFT myGLCD(ITDB24E_16,38,39,40,41); // Remember to change the model parameter to suit your display module!
// Parameters:
// Model
// RS (register Select)
// WR (Write)
// CS (Chip Select)
// RST (Reset)
UTFT myGLCD(ITDB32S, 20, 21, 22, 23); // Remember to change the model parameter to suit your display module!
//UTFT myGLCD(TFT01_32, 20, 21, 22, 23); // Remember to change the model parameter to suit your display module!
//UTFT myGLCD(INFINIT32, 20, 21, 22, 23); // Remember to change the model parameter to suit your display module!
//UTFT myGLCD(GEEE32, 20, 21, 22, 23); // Remember to change the model parameter to suit your display module!
void setup()
{
// Setup the LCD
myGLCD.InitLCD();
delay(2000);
myGLCD.setFont(SmallFont);
// Clear the screen and draw the frame
myGLCD.clrScr();
myGLCD.setColor(255, 0, 0);
myGLCD.fillRect(0, 0, 319, 13);
}
void loop()
{
}
/* Set your pins here
* For 8-bit data bus, pins DB_8 to DB_15 are used.
*
* To use pins 0-7 and the pads underneath the Teensy 25-32, change the
* "if 0" below to "if 1".
*/
#if 0
#pragma message("Using pins 0-7 and 25-32")
#define DB_0 25
#define DB_1 26
#define DB_2 27
#define DB_3 28
#define DB_4 29
#define DB_5 30
#define DB_6 31
#define DB_7 32
#define DB_8 0
#define DB_9 1
#define DB_10 2
#define DB_11 3
#define DB_12 4
#define DB_13 5
#define DB_14 6
#define DB_15 7
#else
#pragma message("Using pins 0-15")
#define DB_0 0
#define DB_1 1
#define DB_2 2
#define DB_3 3
#define DB_4 4
#define DB_5 5
#define DB_6 6
#define DB_7 7
#define DB_8 8
#define DB_9 9
#define DB_10 10
#define DB_11 11
#define DB_12 12
#define DB_13 13
#define DB_14 14
#define DB_15 15
#endif
uint8_t lcdRS = 19; // Register Select
uint8_t lcdWR = 18; // Write
//uint8_t lcdRD; // Read - Unused
uint8_t lcdCS = 17; // Chip Select
uint8_t lcdReset = 24; // Reset
UTFT screen(SSD1289, lcdRS, lcdWR, lcdCS, lcdReset);
while(1){
readB(r, b);
if (hDir == 0){
hCount+=10;
setColor(0, hCount, 0);
if (hCount == 250)
hDir = 1;
}
else if(hDir == 1){
hCount-=10;
setColor(0, hCount, 0);
if (hCount == 0)
hDir = 0;
}
print("Begin", CENTER, 120);
if(rState == LOW || bState == LOW){
setColor(0, 0, 0);
print("Begin", CENTER, 120);
break;
}
}
Now to my current question. Received my TFT displays and I am now trying to get them going with little success in the first couple of hours. This is a question for Dawnmist and Qumefiox really, what model are you using in UTFT for the TFT display with the SSD1289?
As far as I can see there are 4 options:
ITDB32S
TFT01_32
INFINIT32
GEE32
Anyone having issues using setColor(?, 0, 0); ?? it seems red is having issues at least on my 32WD tft. I can fade in blue and yellow no problem, but when I try red.... it seems the values are not working correctly on red.
the above works fine for fading yellow on and off on text, however the second I try to use red I get erratic on and offs. Example would be (60,0,0) is moderately on however (130,0,0) is damn near off on my screen.
There is a model name "SSD1289" (as per page 3 of the supported displays pdf included in the library's files).
My initialization is:
and then everything else matches what you've got above.Code:uint8_t lcdRS = 19; // Register Select uint8_t lcdWR = 18; // Write //uint8_t lcdRD; // Read - Unused uint8_t lcdCS = 17; // Chip Select uint8_t lcdReset = 24; // Reset UTFT screen(SSD1289, lcdRS, lcdWR, lcdCS, lcdReset);
Other things to check:
1. Is the screen's backlight connected to power? I've usually had it connected to an analogue pin on the teensy so I could control it, but it needs to be given ~3.3v power for full brightness.
2. Check the data pin connection order carefully - make sure you haven't reversed/inverted it by mistake.
Which particular screen did you get? Any links to the screen's specs? Photo of the wiring connections?
int pins[34];
void setup()
{
for(int i = 0; i < 34; i++)
{
pins[i] = i;
pinMode(pins[i], OUTPUT);
}
}
void loop()
{
// Normal Pins, set HIGH
for(int i = 0; i < 2; i++)
{
digitalWrite(pins[i], HIGH);
}
for(int i = 7; i < 9; i++)
{
digitalWrite(pins[i], HIGH);
}
for(int i = 11; i < 20; i++)
{
digitalWrite(pins[i], HIGH);
}
for(int i = 24; i < 34; i++)
{
digitalWrite(pins[i], HIGH);
}
// PWM Pins, ramp up
for(int i = 0; i < 256; i++)
{
analogWrite(pins[3], i);
analogWrite(pins[4], i);
analogWrite(pins[5], i);
analogWrite(pins[6], i);
analogWrite(pins[9], i);
analogWrite(pins[10], i);
analogWrite(pins[20], i);
analogWrite(pins[21], i);
analogWrite(pins[22], i);
analogWrite(pins[23], i);
delay(2);
}
// Normal Pins, set LOW
for(int i = 0; i < 2; i++)
{
digitalWrite(pins[i], LOW);
}
for(int i = 7; i < 9; i++)
{
digitalWrite(pins[i], LOW);
}
for(int i = 11; i < 20; i++)
{
digitalWrite(pins[i], LOW);
}
for(int i = 24; i < 34; i++)
{
digitalWrite(pins[i], LOW);
}
// PWM Pins, ramp down
for(int i = 255; i >= 0; i--)
{
analogWrite(pins[3], i);
analogWrite(pins[4], i);
analogWrite(pins[5], i);
analogWrite(pins[6], i);
analogWrite(pins[9], i);
analogWrite(pins[10], i);
analogWrite(pins[20], i);
analogWrite(pins[21], i);
analogWrite(pins[22], i);
analogWrite(pins[23], i);
delay(2);
}
}
Anyone having issues using setColor(?, 0, 0); ?? it seems red is having issues at least on my 32WD tft. I can fade in blue and yellow no problem, but when I try red.... it seems the values are not working correctly on red.
#include <UTFT.h>
extern uint8_t SevenSegNumFont[];
UTFT myGLCD(SSD1289,20,21,22,23);
int red=0;
void setup()
{
myGLCD.InitLCD();
myGLCD.setFont(SevenSegNumFont);
myGLCD.clrScr();
}
void loop()
{
myGLCD.setColor(red,0,0);
myGLCD.print(red,CENTER,100);
if(red==255)
{
delay(2000);
myGLCD.clrScr();
red = 0;
}
else
{
red = red + 1;
}
delay(100);
}