Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rrubiocastil

Pages: [1]
1
TFTs / NHD-2.8-240320AF-CSXP-FCTP and ARDUINO UNO
« on: November 03, 2019, 12:47:52 PM »
I use 262K-colors in 18bit/pixel format (8 bit interface) and it does not work. All I see is a random white line. The screen goes to black when I disable the Display ON command. Here is my code:

void setup() {

DDRD = 0xff;  // output (port D)

//set pins as outputs
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);

//control pin definitions
#define CS2HIGH()  digitalWrite(8, HIGH);
#define CS2LOW()  digitalWrite(8, LOW);
#define WR2HIGH()  digitalWrite(9, HIGH);
#define WR2LOW()  digitalWrite(9, LOW);
#define DCX2HIGH()  digitalWrite(10, HIGH);
#define DCX2LOW()  digitalWrite(10, LOW);
#define RD2HIGH()  digitalWrite(11, HIGH);
#define RD2LOW()  digitalWrite(11, LOW);
#define RESET2HIGH()   digitalWrite(12, HIGH);
#define RESET2LOW()   digitalWrite(12, LOW);

/////////////////////// prototypes ////////////////////////////
void TFT_28_7789_Write_Command(unsigned int command);
void TFT_28_7789_Write_Data(unsigned int data);
void TFT_28_7789_Init(void);


   
    TFT_28_7789_Init();
   
   

}

void loop() {

   
 
}


void TFT_28_7789_Write_Command(unsigned int command)
{
CS2LOW(); //GPIO_ResetBits(GPIOC, CS1);
DCX2LOW(); //GPIO_ResetBits(GPIOC, RS);
RD2HIGH(); //GPIO_SetBits(GPIOC, nRD);
WR2LOW(); //GPIO_ResetBits(GPIOC, nWR);
PORTD = command; //GPIO_Write(GPIOB, command); 8-bit interface (DB17:10)
delay(10);
WR2HIGH(); //GPIO_SetBits(GPIOC, nWR);
delay(10);
}

void TFT_28_7789_Write_Data(unsigned int data1)
{
PORTD = data1; //GPIO_Write(GPIOB, data1);//when using 16-bit interface (DB17:10,DB8:1)//when using 8-bit interface (DB17:10)
DCX2HIGH(); //GPIO_SetBits(GPIOC, RS);
WR2LOW(); //GPIO_ResetBits(GPIOC, nWR);
delay(1);
WR2HIGH(); //GPIO_SetBits(GPIOC, nWR);
}


void TFT_28_7789_Init(void)
{
CS2LOW(); //GPIO_ResetBits(GPIOC, CS1);
RD2HIGH(); //GPIO_SetBits(GPIOC, nRD);
WR2LOW(); //GPIO_ResetBits(GPIOC, nWR);
RESET2LOW(); //GPIO_WriteBit(GPIOC, RES, Bit_RESET); //reset por HW
delay(250);
RESET2HIGH(); //GPIO_WriteBit(GPIOC, RES, Bit_SET); (influye)
delay(250);

//exit SLEEP mode (SLEEP OUT))
TFT_28_7789_Write_Command(0x0011); //influye
delay(100);

//MADCTL: memory data access control
TFT_28_7789_Write_Command(0x0036);
TFT_28_7789_Write_Data(0x0080); 

//Pixel format set
TFT_28_7789_Write_Command(0x003A);
TFT_28_7789_Write_Data(0x0055);

//INVON: Display Inversion ON (setting for IPS)
TFT_28_7789_Write_Command(0x0021);

//PORCTRK: Porch setting
TFT_28_7789_Write_Command(0x00B2);
TFT_28_7789_Write_Data(0x000C);
TFT_28_7789_Write_Data(0x0C);
TFT_28_7789_Write_Data(0x00);
TFT_28_7789_Write_Data(0x33);
TFT_28_7789_Write_Data(0x33);

//GCTRL: Gate Control
TFT_28_7789_Write_Command(0x00B7);
TFT_28_7789_Write_Data(0x0035);

//VCOMS: VCOM setting
TFT_28_7789_Write_Command(0x00BB);
TFT_28_7789_Write_Data(0x002B);

//LCMCTRL: LCM Control
TFT_28_7789_Write_Command(0x00C0);
TFT_28_7789_Write_Data(0x002C);

//VDVVRHEN: VDV and VRH Command Enable
TFT_28_7789_Write_Command(0x00C2);
TFT_28_7789_Write_Data(0x0001);
TFT_28_7789_Write_Data(0xFF);

//VRHS: VRH Set
TFT_28_7789_Write_Command(0x00C3);
TFT_28_7789_Write_Data(0x0011);

//VDVS: VDV Set
TFT_28_7789_Write_Command(0x00C4);
TFT_28_7789_Write_Data(0x0020);

//FRCTRL2: Frame Rate control in normal mode
TFT_28_7789_Write_Command(0x00C6);
TFT_28_7789_Write_Data(0x000F);

//PWCTRL1: Power Control 1 (6.8, -4.8, 2.3)
TFT_28_7789_Write_Command(0x00D0);
TFT_28_7789_Write_Data(0x00A4);
TFT_28_7789_Write_Data(0xA1);

//PVGAMCTRL: Positive Voltage Gamma control
TFT_28_7789_Write_Command(0x00E0);
                  TFT_28_7789_Write_Data(0x00D0);
                  TFT_28_7789_Write_Data(0x0000);
                  TFT_28_7789_Write_Data(0x0005);
                  TFT_28_7789_Write_Data(0x000E);
                  TFT_28_7789_Write_Data(0x0015);
                  TFT_28_7789_Write_Data(0x000D);
                  TFT_28_7789_Write_Data(0x0037);
                  TFT_28_7789_Write_Data(0x0043);
                  TFT_28_7789_Write_Data(0x0047);
                  TFT_28_7789_Write_Data(0x0009);
                  TFT_28_7789_Write_Data(0x0015);
                  TFT_28_7789_Write_Data(0x0012);
                  TFT_28_7789_Write_Data(0x0016);
                  TFT_28_7789_Write_Data(0x0019);

//NVGAMCTRL: Negative Voltage Gamma control
TFT_28_7789_Write_Command(0x00E1);
                  TFT_28_7789_Write_Data(0x00D0);
                  TFT_28_7789_Write_Data(0x0000);
                  TFT_28_7789_Write_Data(0x0005);
                  TFT_28_7789_Write_Data(0x000D);
                  TFT_28_7789_Write_Data(0x000C);
                  TFT_28_7789_Write_Data(0x0006);
                  TFT_28_7789_Write_Data(0x002D);
                  TFT_28_7789_Write_Data(0x0044);
                  TFT_28_7789_Write_Data(0x0040);
                  TFT_28_7789_Write_Data(0x000E);
                  TFT_28_7789_Write_Data(0x001C);
                  TFT_28_7789_Write_Data(0x0018);
                  TFT_28_7789_Write_Data(0x0016);
                  TFT_28_7789_Write_Data(0x0019);


//X address set (CASET) de 0 a 239
TFT_28_7789_Write_Command(0x002A);
TFT_28_7789_Write_Data(0x0000);
TFT_28_7789_Write_Data(0x0000);
TFT_28_7789_Write_Data(0x0000);
TFT_28_7789_Write_Data(0x00EF);

//Y address set (PASET) de 0 a 319
TFT_28_7789_Write_Command(0x002B);
TFT_28_7789_Write_Data(0x0000);
TFT_28_7789_Write_Data(0x0000);
TFT_28_7789_Write_Data(0x0001);
TFT_28_7789_Write_Data(0x003F);

delay(10);

//Display ON
TFT_28_7789_Write_Command(0x0029);


  //RGB definition
    unsigned int Rcolor;
    unsigned int Gcolor;
    unsigned int Bcolor;
   
    Rcolor = 0b11110100;
    Gcolor = 0b10000100;
    Bcolor = 0b00110100;
     
TFT_28_7789_Write_Command(0x002C); 
    TFT_28_7789_Write_Data(0x0a);
    TFT_28_7789_Write_Data(0x0c);
    TFT_28_7789_Write_Data(0x0b);

}


************

All I get is this: https://ibb.co/QbmKxNv

Any suggestions?




2
Hello ezed413, did your code work?
I am using a PIC24F curiosity board (xc16 compiler)

3
TFTs / Code for NHD-2.8-240320AF-CSXP-FCTP
« on: October 21, 2019, 11:19:26 PM »
Hello, I recently purchased a NHD-2.8-240320AF-CSXP-FCTP display. I want to make it work using a PIC24F curiosity board or an Arduino Due. Where can I find libraries? 

Pages: [1]