Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to drive a ST7735 TFT display with MX220?
15-10-2014, 01:58 PM, (This post was last modified: 15-10-2014, 02:16 PM by GastonLagaffe.)
#11
RE: How to drive a ST7735 TFT display with MX220?
(13-10-2014, 09:37 AM)pingotg Wrote: You don't need any resistors though it's faster with one.

Salut,
I have written the code for the ST7735 from scratch using the command sequence from the UTFT library from the arduino. Henning Karlsen, the author, did a great job there and the code is quite readable.

The actual status is that I can draw a square on the screen in the color I want. But when testing I noticed, that the LCD is sometimes working, sometimes not. I use 20cm long wires to connect the display to the 45k50. I assume that I have to use pull-ups for the device.
So two questions:

As I see pull-up resistor values ranging from 2.2k to 10k, I wonder what I should use. I prefer at the moment the 10k.

Do I need pull-up on all 5 pins or is it sufficient to use them on SDA and SCL only. I guess the later.

I will create now the entire lib scope of commands, as I can set the color of any pixel I want. I will publish the code as soon as the core drawing commands are done (which will take a couple of evenings).

Ciao, Mathias
Reply
15-10-2014, 06:32 PM,
#12
RE: How to drive a ST7735 TFT display with MX220?
(15-10-2014, 01:58 PM)GastonLagaffe Wrote:
(13-10-2014, 09:37 AM)pingotg Wrote: You don't need any resistors though it's faster with one.

Salut,
I have written the code for the ST7735 from scratch using the command sequence from the UTFT library from the arduino. Henning Karlsen, the author, did a great job there and the code is quite readable.

The actual status is that I can draw a square on the screen in the color I want. But when testing I noticed, that the LCD is sometimes working, sometimes not. I use 20cm long wires to connect the display to the 45k50. I assume that I have to use pull-ups for the device.
So two questions:

As I see pull-up resistor values ranging from 2.2k to 10k, I wonder what I should use. I prefer at the moment the 10k.

Do I need pull-up on all 5 pins or is it sufficient to use them on SDA and SCL only. I guess the later.

I will create now the entire lib scope of commands, as I can set the color of any pixel I want. I will publish the code as soon as the core drawing commands are done (which will take a couple of evenings).

Ciao, Mathias
Great work Mathias!
You burned me out! Unfortunately I have very little time to work on this at the moment...
I am looking forward to hear news from you. I will follow the thread every day.
Have a good evening!

Angelo
Reply
17-10-2014, 05:08 PM,
#13
RE: How to drive a ST7735 TFT display with MX220?
Salut,

just as an update: things that work on the display:
  • clear screen
  • draw rectangle
  • draw rectangle filled
  • draw circle
  • draw circle filled
  • draw pixel
  • draw horizontal/vertical line
  • draw line
  • draw character (using the 5x8 font)
  • select orientation portrait/landscape
  • set background/foreground color in rgb
outstanding:
  • string handling (this can be quite time consuming ...)
  • more fonts
  • nice demo
  • hardware SPI (I have no clue yet)
  • convert code to a library
At least I know what to do for the weekend Cool 

Ciao, Mathias


Attached Files Thumbnail(s)
   
Reply
20-10-2014, 03:27 PM,
#14
RE: How to drive a ST7735 TFT display with MX220?
Salut,

I have completed the ST7735 code excluding the hardware SPI. I am now struggling to get the code converted into a library. Is there some guidance how to create a library? I thought it is as simple as putting the subroutine definitions in a .h file and the code in a .c file. When I do this, it compiles ok but in stdout I get this error for each subroutine called:
Code:
Missing definition for symbol '_ST7735_drawLine', required by 'C:\pinguino-ide 11\user\source\main.o'.

Any advice is welcome
Ciao, Mathias
Reply
20-10-2014, 04:53 PM,
#15
RE: How to drive a ST7735 TFT display with MX220?
(20-10-2014, 03:27 PM)GastonLagaffe Wrote: Salut,
Don't forget to insert at the beginning of the .pde 
#include "xxx.c" // xxx being the name of your main library file that you put in the same folder as your .pde.
                          // xxx.h is put in this folder too
or 
#include <xxx.c> // then you put xxx.x and xxx.h in p8/include/pinguino/libraries folder. (IDE v11)
When this procedure works create a .pdl
see an example as  pcd8544.pdl pcd8544.c pcd8544.h and examples/07.Display/PCD8544/*.pde
to understand the principles used in the Pinguino IDE
Bye André
Reply
20-10-2014, 06:09 PM,
#16
RE: How to drive a ST7735 TFT display with MX220?
Salut,

converting the code to a library is no fun at all. So I cannot use normal calls like delay(), pinMode() and digitalWrite()... I am about to give up as I am fed up with the compiler messages. I got the code compiled but the TFT is dead now.

Why can't I use a #define statement in my pde to replace a code segment in the library?
#define ST7735_REG_SDA   LATBbits.LATB0
gets compiled if placed in ST7735.h but gets errors is located in the pde...

For today I give up. Compared to writing libs for ChipKit IDE or Arduino IDE this is ...

Ciao, Mathias
Reply
21-10-2014, 02:16 PM,
#17
RE: How to drive a ST7735 TFT display with MX220?
Salut,

after another wasted evening, I finally give up converting the code into a library. The documentation is sparse and I am poking in the dark trying to find out how to convince the compiler to include the right files in the right order.
So I post here the working code that holds all subroutines and leave it to the capable guys from pinguino if they want to turn this into a library. Please adhere to the CC license of the original UTFT code.

I am now checking how chipKit compares to pinguino ...

Ciao, Mathias


Attached Files Thumbnail(s)
   

.pde   ST7735demo.pde (Size: 14.89 KB / Downloads: 2)
Reply
21-10-2014, 03:44 PM,
#18
RE: How to drive a ST7735 TFT display with MX220?
It's the odd way the IDE scans a pde and reorders the code.

If you #include a .c file you can side-step it, and sometimes by using
# define
(with a space)
you can also fool it.

The internal names for things like pinMode are tough to guess sometimes so you need to go hunting and spend extra time. It's a pity.

John
Reply
21-10-2014, 04:13 PM,
#19
RE: How to drive a ST7735 TFT display with MX220?
(21-10-2014, 02:16 PM)GastonLagaffe Wrote: Salut,

after another wasted evening, I finally give up converting the code into a library. The documentation is sparse and I am poking in the dark trying to find out how to convince the compiler to include the right files in the right order.
So I post here the working code that holds all subroutines and leave it to the capable guys from pinguino if they want to turn this into a library. Please adhere to the CC license of the original UTFT code.

I am now checking how chipKit compares to pinguino ...

Ciao, Mathias
You' re still great, you work will be very useful to me. You own me a beer now!
I will post if advances will be made to the code!

Have a great day
Reply
22-10-2014, 11:40 AM,
#20
RE: How to drive a ST7735 TFT display with MX220?
goddamn won' t compile for MX220 !!!
But compiles for MX250... is it a memory issue?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)