Pages: [1]   Go Down
Author Topic: support serial communication and TFT display  (Read 644 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello!!

I recently purchased a TFT 3.2 "", works perfectly, but when I want to add my serial communication program, it stops working, anyone can help me???

 smiley-eek smiley-eek smiley-eek smiley-eek
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but when I want to add my serial communication program, it stops working,
What program would that be?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is a program code for example:

#include <Wire.h>
#include <ITDB02_Graph16.h>
extern uint8_t SmallFont[];
ITDB02 myGLCD(A1,A2,A0,A4,A5,2);   //

void setup()
{
  Serial.begin(9600);
   myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
}

void loop()
{
  int buf[238];
  int x, x2;
  int y, y2;
  int r;


  myGLCD.clrScr();

  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 239, 13);
  myGLCD.setColor(64, 64, 64);
  myGLCD.fillRect(0, 306, 239, 319);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("prove", CENTER, 1);
  Serial.print("TEST PC");
 
  When I open the hyper terminal screen turns off. I need not turn off and I want to communicate with a PC to modify or query data during program execution.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
this is a program code for example
that won't even compile. Try again.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#include <Wire.h>
#include <ITDB02_Graph16.h>
extern uint8_t SmallFont[];
ITDB02 myGLCD(A1,A2,A0,A4,A5,2);   //

void setup()
{
  Serial.begin(9600);
   myGLCD.InitLCD();
  myGLCD.setFont(SmallFont);
}

void loop()
{
  int buf[238];
  int x, x2;
  int y, y2;
  int r;


  myGLCD.clrScr();

  myGLCD.setColor(255, 0, 0);
  myGLCD.fillRect(0, 0, 239, 13);
  myGLCD.setColor(64, 64, 64);
  myGLCD.fillRect(0, 306, 239, 319);
  myGLCD.setColor(255, 255, 255);
  myGLCD.setBackColor(255, 0, 0);
  myGLCD.print("prove", CENTER, 1);
  Serial.print("TEST PC");
}


the libraries are given by the manufacturer default.

Code:

//ITDB02_Graph16.h

#ifndef ITDB02_Graph16_h
#define ITDB02_Graph16_h

#define LEFT 0
#define RIGHT 9999
#define CENTER 9998

#define PORTRAIT 0
#define LANDSCAPE 1

#define ASPECT_4x3 0 // Legacy
#define ASPECT_16x9 1 // Legacy
#define ITDB32 0 // HX8347-A
#define ITDB32WC 1 // ILI9327
#define TFT01_32W 1 // ILI9327
#define ITDB32S 2 // SSD1289
#define TFT01_32 2 // SSD1289
#define TFT01_24 3 // ILI9325D

#include "Arduino.h"

struct _current_font
{
uint8_t* font;
uint8_t x_size;
uint8_t y_size;
uint8_t offset;
uint8_t numchars;
};

class ITDB02
{
public:
ITDB02();
ITDB02(int RS, int WR,int CS, int RST, int ALE, byte model=ITDB32);
void InitLCD(byte orientation=PORTRAIT);
void clrScr();
void drawPixel(int x, int y);
void drawLine(int x1, int y1, int x2, int y2);
void fillScr(byte r, byte g, byte b);
void drawRect(int x1, int y1, int x2, int y2);
void drawRoundRect(int x1, int y1, int x2, int y2);
void fillRect(int x1, int y1, int x2, int y2);
void fillRoundRect(int x1, int y1, int x2, int y2);
void drawCircle(int x, int y, int radius);
void fillCircle(int x, int y, int radius);
void setColor(byte r, byte g, byte b);
void setBackColor(byte r, byte g, byte b);
void print(char *st, int x, int y, int deg=0);
void printNumI(long num, int x, int y);
void printNumF(double num, byte dec, int x, int y);
void setFont(uint8_t* font);
void drawBitmap(int x, int y, int sx, int sy, unsigned int* data, int scale=1);
void drawBitmap(int x, int y, int sx, int sy, unsigned int* data, int deg, int rox, int roy);
void LCD_Writ_Bus(char VH,char VL);
void LCD_Write_DATA(char VH,char VL);
protected:
byte fcolorr,fcolorg,fcolorb;
byte bcolorr,bcolorg,bcolorb;
byte orient;
long disp_y_size;
byte display_model;
volatile uint8_t *P_RS, *P_WR, *P_CS, *P_RST, *P_ALE;
uint8_t B_RS, B_WR, B_CS, B_RST, B_ALE;
_current_font cfont;


void LCD_Write_COM(char VL);

void main_W_com_data(char com1,int dat1);
void setPixel(byte r,byte g,byte b);
void drawHLine(int x, int y, int l);
void drawVLine(int x, int y, int l);
void printChar(byte c, int x, int y);
void setXY(word x1, word y1, word x2, word y2);
void rotateChar(byte c, int x, int y, int pos, int deg);
};

#endif
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  int buf[238];
What's this huge array for? That's using 1/4 of the memory on a 328-based Arduino.
Logged

Pages: [1]   Go Up
Jump to: