Go Down

Topic: Fast library for Due and low cost HX8357B/C and ILI9481 480 x 320 displays (Read 13033 times) previous topic - next topic

bodmer

@auno123

Unfortunately on most of these display shields the backlight LEDs are hardwired to the 5V power line so there is no brightness control.
Formerly Rowboteer (now a broken user profile!)

auno123

@bodmer,

OK, thanks for the information.
I'll try to play with screen colours.

Anyone have a idea of the shield which brightness can be adjusted?

Br, MikaA

michibures

First af all, thank you for this library. Finally I found a fast way for using my ILI9488 based display (thanks to Five55 for the additional ILI9488 code)

This morning I included the library within my current project and was wondering why a timer based frequency measurement routine did not work anymore. Regarding my still little knowledge of all these things it took a while to figure this out and I think I found a little bug:

I'm using
Code: [Select]
//#define HX8357B
//#define HX8357C
#define ILI9481
//#define ILI9481_8BIT


and Five55's additional code (see Post #27 of this thread). The display is connected according the pin mapping in the header of TFT_HX8357_Due.cpp to my Arduino Due. Everything worked fine except of my frequence measurement.

Then I fount the following code in TFT_HX8357_Due.cpp (line 233 ff.)
Code: [Select]
/***************************************************************************************
** Function name:           init
** Description:             Reset, then initialise the TFT display registers
***************************************************************************************/
void TFT_HX8357_Due::init(void)
{
  pinMode(_rst, OUTPUT);
  digitalWrite(_rst, HIGH);

  pinMode(_rs, OUTPUT);
  pinMode(_cs, OUTPUT);
  pinMode(_wr, OUTPUT);

  digitalWrite(_rs, HIGH);

  digitalWrite(_cs, HIGH);

  digitalWrite(_wr, HIGH);

  pinMode(_fcs, OUTPUT);
  digitalWrite(_fcs, HIGH); // Stop line floating
  pinMode(A0, OUTPUT);
  digitalWrite(A0, HIGH);

  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);


Pins 2-9 are defined here as OUTPUT independend from the chosen driver in the User_Setup file.
Since I use pins 22-41 for communication to the display there is no need to define pins 2-9 as OUTPUT. After uncommenting the pinMode instructions my frequency measurement (which uses Pin 5 (TIOA6) as INPUT) worked again.

Maybe this could be helpful for other people.
Grüße, Michael

bodmer

#93
Jan 23, 2017, 11:50 pm Last Edit: Jan 24, 2017, 02:20 pm by bodmer Reason: Found the problem code!
@michibures

Updated. Ahah, you are right the code is incorrectly duplicated in the init function.

I have fixed this on Github.

Thanks for finding and reporting this. A Karma point for you!
Formerly Rowboteer (now a broken user profile!)

michibures

Thanks for finding and reporting this. A Karma point for you!
My pleasure - and thank you.

Well, unfortunately I had problems reading an analogue sensor value on pin A0...
And as it turned out: Pin A0 is set as Output and HIGH in the init() function of your library:

Code: [Select]

/***************************************************************************************
** Function name:           init
** Description:             Reset, then initialise the TFT display registers
***************************************************************************************/
void TFT_HX8357_Due::init(void)
{
  pinMode(_rst, OUTPUT);
  digitalWrite(_rst, HIGH);

  pinMode(_rs, OUTPUT);
  pinMode(_cs, OUTPUT);
  pinMode(_wr, OUTPUT);

  digitalWrite(_rs, HIGH);

  digitalWrite(_cs, HIGH);

  digitalWrite(_wr, HIGH);

  pinMode(_fcs, OUTPUT);
  digitalWrite(_fcs, HIGH); // Stop line floating
  pinMode(A0, OUTPUT);
  digitalWrite(A0, HIGH);

  // toggle RST low to reset
    digitalWrite(_rst, HIGH);
    delay(50);
    //digitalWrite(_rst, LOW);
    delay(10);
    digitalWrite(_rst, HIGH);
    delay(10);

This seems to be unneeded (same environment as in post #92, see above) and caused my analogue reading problems as I had permanent Vdd voltage at A0. Took me a while to figure this out, now it works.

May be helpful  ;)
Grüße, Michael

bodmer

Looks like I left in some code after a quick test hack for 8 bit displays. That is the Read line for those displays and so can't be left floating, it is correctly configure in the constructor so those two lines can be safely deleted.

Take another Karma point! Thanks.

P.S. I found a few more latent bugs (text background not applied when plotting datum set to top left (TL_DATUM), and missing return values for some functions) and so will be updating the library soon.
Formerly Rowboteer (now a broken user profile!)

bodmer

Formerly Rowboteer (now a broken user profile!)

harnen

Dear All,

I have some issues making my ILI9481 screen work with Bodmer's library on Arduino Mega. The screen turns on, but doesn't display anything. I was trying several examples provided with the library.

My screen works (but is slow) with the Adafruit library with the following configuration:
Code: [Select]

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_TFTLCD.h> // Hardware-specific library

#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0
#define LCD_RESET A4
#define SD_CS 53

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);


In UserConfig.h I only specified my driver

Code: [Select]

#define ILI9481


Do I need do specify the pins or do any further changes to make it work?

Go Up