Go Down

Topic: 4D systems 3.2" TFT display SGC ( serial controlled ) (Read 3494 times) previous topic - next topic

transam

Hello everybody!

I bought this display and thought that it would be easier to control than other displays on the market. Oh boy was i wrong...
I am a novice with arduino but damn this thing makes me wanna cry :D

My problem is that i can't really do anything with the display since it doesn't respond to my programming..

Get touch screen status for example:

Code: [Select]
int incomingByte;
int lcdResetpin = 2;
int ledPin = 13;

void setup() {
 
  pinMode(ledPin, OUTPUT);
  pinMode(lcdResetpin, OUTPUT);
  digitalWrite(lcdResetpin, LOW); //reset lcd screen.
  delay(30);
  digitalWrite(lcdResetpin, HIGH);
  delay(1000);
  Serial1.begin(9600); // initialize serial 1 communication:
  Serial.begin(9600);  // initialize serial communication:
  delay(2000);
 
  Serial1.print(0x55, BYTE); //Autobaud command
  Serial1.print(0x59, BYTE); //Enable touch screen command
  Serial1.print(0x05, BYTE);
  Serial1.print(0x00, BYTE);
  Serial1.print(0x56, BYTE); //version request command
  Serial1.print(0x01, BYTE);
  delay(2000);
}

void loop() {

Serial1.print(0x6F, BYTE); //Get touch screen status
Serial1.print(0x04, BYTE);

if (Serial1.available() > 0) {
  incomingByte = Serial1.read();
Serial.println(incomingByte);
  delay(100);
if (incomingByte == '2') {
    digitalWrite(ledPin, HIGH);}
 
  else{ digitalWrite(ledPin, LOW);
}}}


That just starts to throw weird characters to the serial monitor and the screen does not give any feedback = byte 2.

I know there are some libraries for different 4D Systems displays but i would like to learn to do something without using libraries that aren't really for this particular display.

- Timo

Graynomad

There is a library for this exact display IIRC, one of the guys here wrote it and there's a thread about it.

Try

Serial.println(incomingByte, HEX);

so you can see exactly what's being returned.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

avenue33

Hi!

I wrote a library to manage the ?LCD-32PT(SGC) 3.2" Serial LCD Display Module by 4D LABS.



To draw a triangle, instead of sending something like
Code: [Select]
G 0, 200, 0, 160, 0, 160, 0, 80, 100, 60, 0xff, 0xff
just ask
Code: [Select]
myLCD.triangle(200, 160, 160, 80, 100, 60, 0xffff)

The library includes touch button management, data logging on SD card, and sound playing. It relies on an abstraction layer so it could be used with Arduino and chipKIT.

Devoted thread is here.

Enjoy ;)

Razorblade

I'm receiving my LCD on friday, so I've never worked with it. But here are my recommendations:


Code: [Select]
digitalWrite(lcdResetpin, LOW); //reset lcd screen.
delay(30);
digitalWrite(lcdResetpin, HIGH);

I wouldn't reset the LCD with Arduino that way. Datasheet says:
Quote
If the module needs to be reset externally, only use open collector type circuits.

So that HIGH value (5 V) could damage LCD circuitry.


Code: [Select]
Serial1.print(0x55, BYTE); //Autobaud command
Serial1.print(0x59, BYTE); //Enable touch screen command

Datasheet also says:
Quote
The host must send the Auto-Baud command, capital 'U' (55hex), at 9600 baud and wait for an ACK (06hex). Once the host receives the ACK, is now ready to accept commands from the host.

Maybe you should wait for that ACK byte.

Anyway, what happens if your loop() is empty? (while(1); for instance). Does the LCD screen show the device info?
Arduino Uno (R2fix) / Duemilanove (328p)
Ethernet Shield SD (v5)

extent

There's no point in hammering the screen over and over again for data.  Almost every single command will return an ACK when the command is completed.  Send a command, then wait for the response (and check to make sure it's not a NAK)  If the previous command has not yet returned there's no point in sending another, this goes for all your initialization code as well.

If his loop() was empty it still shouldn't show the device info because the 4D chip will blank the display as soon as it gets an autobaud command.

Razorblade

If his loop() was empty it still shouldn't show the device info because the 4D chip will blank the display as soon as it gets an autobaud command.

?¿ Have you looked at his setup() code? I don't think so.
Or try to explain better why it wouldn't show the device info, please.
Arduino Uno (R2fix) / Duemilanove (328p)
Ethernet Shield SD (v5)

extent


If his loop() was empty it still shouldn't show the device info because the 4D chip will blank the display as soon as it gets an autobaud command.

?¿ Have you looked at his setup() code? I don't think so.
Or try to explain better why it wouldn't show the device info, please.


His setup() issues the autobaud command, the 4d displays will go into their show info screensaver mode only if they receive no autobaud for 5 or so seconds after startup.  If you mean the device capabilities screen His CMD_VERSION call is likely being eaten up because he's sending smashing it into the display when it's not ready, so waiting longer after you've issued the (now lost) command isn't going to make any difference either.

On that point as well just calling CMD_VERSION will put at least 5 bytes of data into your serial input buffer (on the GOLDELOX chip, probably more on the one in the 3.2") which OFC he's not clearing out before going into his loop.  Every time through the loop he's only taking 1 byte off the input buffer and making a new call to touch status.

Razorblade

#7
Sep 18, 2011, 01:38 pm Last Edit: Sep 18, 2011, 03:31 pm by Razorblade Reason: 1
Ok extent, so the problem is that you name things wrong. Your "device info screen" is the "Splash Screen on Power Up", and the "Version-Device Info Request - 56hex" is your "device capabilities screen". :smiley-roll:

"His CMD_VERSION call is likely being eaten up because he's sending smashing it into the display when it's not ready,"
That's not true. The display is ready, because it was reset 3 seconds ago. He's just sending Autobaud and Touch enable before Device Info Request, and display responses to those commands are fast enough, so there's no need to wait for that ACK bytes. Anyway, I was who recommended him to wait for ACK bytes few lines above.

So.. if he has connected the LCD correctly, no component damaged, and puts an empty loop(), he will see the Device Info screen. In fact, I do see it (yes, copy-paste his code).
Arduino Uno (R2fix) / Duemilanove (328p)
Ethernet Shield SD (v5)

Go Up