hey !
i have an lcd tft 3.95 inch with ST7796S driver and i wanna draw graphic values like a function or a sonsor values ... i've searched many example or how to do it on the internet but i didn't find the one which is compatible with my display and i tried to do it myself byt i failed . my idea was bitmap the value at the end of the area i wanted to plot to then scrolling it when the new value arrives.
i'm using the " LCDWIKI_KBV " and " LCDWIKI_GUI " libraries can someone help me with this task i appreciate that
I have posted examples e.g. scroll_graph_kbv in this message.
The pasted sketch will run on any MCUFRIEND_kbv shield.
It will run on your 16-bit parallel shield as a "SPECIAL" and force tft.begin(0x7796);
I have no intention of converting the example to badly-spelled-library but will assist you if you have a problem.
David.
tanhks for the example but it didn't work for me very well. Here the result after i uploaded ur code and forcing the idea into tft.begin(0x7796);
I have an ST7796 SPI display but I do not own a parallel ST7796 (yet).
Yes, I can provide a "better" begin(0x7796) sequence. But I will wait until I receive the 8-bit Shield that I have ordered from AliExpress.
I will run that sketch on my SPI display. And see how it behaves.
David.
Edit. It is running just fine on my SPI ST7796 display.
static const uint8_t PROGMEM ST7796_regValues[] = {
// (COMMAND_BYTE), n, data_bytes....
0xC5, 1, 0x1C, //VCOM Control 1 [1C]
0xB0, 1, 0x80, //Interface [00]
0xB4, 1, 0x01, //Inversion Control [01]
0xB6, 3, 0x80, 0x22, 0x3B, // Display Function Control [80 02 3B] .kbv SS=1, NL=480
0xB7, 1, 0xC6, //Entry Mode [06]
0xE8, 8, 0x40, 0x8A, 0x00, 0x00, 0x29, 0x19, 0xA5, 0x33,
};
David, Can this example be run with the TFT_eSPI library?
No, it does not run with TFT_eSPI library. There are several changes:
...
//#include <MCUFRIEND_kbv.h>
//MCUFRIEND_kbv tft;
...
#include <TFT_eSPI.h>
TFT_eSPI tft;
...
//uint16_t ID = tft.readID();
//if (ID == 0xD3D3) ID = 0x9486;
//tft.begin(ID);
tft.begin();
...
//tft.vertScroll(1, lines, current); //use hardware on TFT
vertScroll(1, lines, current); //use hardware on TFT
...
void vertScroll(int16_t top, int16_t scrollines, int16_t offset)
{
int16_t vsp = top + offset; // vertical start position
if (offset < 0)
vsp += scrollines; //keep in unsigned range
int HEIGHT = (tft.height() > tft.width()) ? tft.height() : tft.width();
int16_t bfa = HEIGHT - top - scrollines;
tft.writecommand(0x0033);
tft.writedata(top >> 8); //TOP
tft.writedata(top); //TOP
tft.writedata(scrollines >> 8);
tft.writedata(scrollines);
tft.writedata(bfa >> 8);
tft.writedata(bfa);
tft.writecommand(0x0037);
tft.writedata(vsp >> 8); //VL#
tft.writedata(vsp); //VL#
}
...
Bodmer does not have a native method for hardware scroll. Hence I have put a "helper function" for you.
However Bodmer's example: TFT_Terminal.ino has its own helper functions: void setupScrollArea(uint16_t tfa, uint16_t bfa) and void scrollAddress(uint16_t vsp)
Note that old-style controllers like ILI9320 can only scroll the whole screen. And some can not scroll at all.
Likewise, Adafruit_ILI9341 has different syntax for vertical scrolling.
But in principle any Adafruit_GFX style hardware library should work with this sketch.
Note that Bodmer implements similar methods to Adafruit_GFX but it does not inherit.
David.
yacineyaker:
tanhks for the example but it didn't work for me very well. Here the result after i uploaded ur code and forcing the idea into tft.begin(0x7796);
My Uno Shield arrived today. Sure enough the vertical scroll was HORRIBLE.
I have posted a mod for the current Library Release v2.9.8 in this message
The scroll_graph sketch works ok now.
I also tried one LCDWIKI_KBV example on the ST7796 shield. It worked ok. (if you don't mind bad spelling)
David.