Change display orientation on ILI9325

armdisplaytft

I've started to play with a cheap TFT display, called HY28B. It's pretty well known, I guess…
Anyway, I want to change the orientation of the display to landscape mode, but somehow it doesn't do what I want.

I tried to config the display with this configuration (ILI9325): http://henningkarlsen.com/electronics/library.php?id=51

And I changed the Entry mode (0x03) register value to 0x10B0, but my string is still appaer in portrait mode. I draw the string with the display's sample code from ebay.

This is the exact config what I'm using:

  LCD_WriteReg(0xE5, 0x78F0); // set SRAM internal timing
    LCD_WriteReg(0x01, 0x0100); // set Driver Output Control  
    LCD_WriteReg(0x02, 0x0700); // set 1 line inversion  
    LCD_WriteReg(0x03, 0x1030); // set GRAM write direction and BGR=1.  
    LCD_WriteReg(0x04, 0x0000); // Resize register  
    LCD_WriteReg(0x08, 0x0207); // set the back porch and front porch  
    LCD_WriteReg(0x09, 0x0000); // set non-display area refresh cycle ISC[3:0]  
    LCD_WriteReg(0x0A, 0x0000); // FMARK function  
    LCD_WriteReg(0x0C, 0x0000); // RGB interface setting  
    LCD_WriteReg(0x0D, 0x0000); // Frame marker Position  
    LCD_WriteReg(0x0F, 0x0000); // RGB interface polarity  
    //*************Power On sequence ****************//  
    LCD_WriteReg(0x10, 0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB  
    LCD_WriteReg(0x11, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]  
    LCD_WriteReg(0x12, 0x0000); // VREG1OUT voltage  
    LCD_WriteReg(0x13, 0x0000); // VDV[4:0] for VCOM amplitude  
    LCD_WriteReg(0x07, 0x0001);  
    delay(200); // Dis-charge capacitor power voltage  
    LCD_WriteReg(0x10, 0x1090); // SAP, BT[3:0], AP, DSTB, SLP, STB  
    LCD_WriteReg(0x11, 0x0227); // Set DC1[2:0], DC0[2:0], VC[2:0]  
    delay(50); // Delay 50ms  
    LCD_WriteReg(0x12, 0x001F); // 0012  
    delay(50); // Delay 50ms  
    LCD_WriteReg(0x13, 0x1500); // VDV[4:0] for VCOM amplitude  
    LCD_WriteReg(0x29, 0x0027); // 04  VCM[5:0] for VCOMH  
    LCD_WriteReg(0x2B, 0x000D); // Set Frame Rate  
    delay(50); // Delay 50ms  
    LCD_WriteReg(0x20, 0x0000); // GRAM horizontal Address  
    LCD_WriteReg(0x21, 0x0000); // GRAM Vertical Address  
    // ----------- Adjust the Gamma Curve ----------//  
    LCD_WriteReg(0x30, 0x0000);  
    LCD_WriteReg(0x31, 0x0707);  
    LCD_WriteReg(0x32, 0x0307);  
    LCD_WriteReg(0x35, 0x0200);  
    LCD_WriteReg(0x36, 0x0008);  
    LCD_WriteReg(0x37, 0x0004);  
    LCD_WriteReg(0x38, 0x0000);  
    LCD_WriteReg(0x39, 0x0707);  
    LCD_WriteReg(0x3C, 0x0002);  
    LCD_WriteReg(0x3D, 0x1D04);  
    //------------------ Set GRAM area ---------------//  
    LCD_WriteReg(0x50, 0x0000); // Horizontal GRAM Start Address  
    LCD_WriteReg(0x51, 0x00EF); // Horizontal GRAM End Address  
    LCD_WriteReg(0x52, 0x0000); // Vertical GRAM Start Address  
    LCD_WriteReg(0x53, 0x013F); // Vertical GRAM Start Address  
    LCD_WriteReg(0x60, 0xA700); // Gate Scan Line  
    LCD_WriteReg(0x61, 0x0001); // NDL,VLE, REV   
    LCD_WriteReg(0x6A, 0x0000); // set scrolling line  
    //-------------- Partial Display Control ---------//  
    LCD_WriteReg(0x80, 0x0000);  
    LCD_WriteReg(0x81, 0x0000);  
    LCD_WriteReg(0x82, 0x0000);  
    LCD_WriteReg(0x83, 0x0000);  
    LCD_WriteReg(0x84, 0x0000);  
    LCD_WriteReg(0x85, 0x0000);  
    //-------------- Panel Control -------------------//  
    LCD_WriteReg(0x90, 0x0010);  
    LCD_WriteReg(0x92, 0x0600);  
    LCD_WriteReg(0x07, 0x0133); // 262K color and display ON        

Best Answer

EDIT: To all reading, the OP may need more help with the datasheet than I can give below, it's a good starting point, but I have no time to read up and down the sheet to see what's going on. See comments on this answer if you think you can help.


Original Post:


You set register 3 to the value: 0x1030 in your code. Now see the Adafruit datasheet of your chipset (I'm not the biggest Ada supporter in existence, but it's the only link I could find that's close to proper English):

Adafruit ILI9325 Chip Datas

On Page 55 of 107, it shows a table. You want AM = 1 and ID[0:1] are your choice depending on whether you want up/down and mirrored/unmirrored.

Now scroll up to page 54, to show the register layout:

{...}{D7} {D6} {D5} {D4} {D3} {D2} {D1} {D0}
{...}{ORG}{0}  {ID1}{ID0}{AM} {0}  {0}  {0}

As you can see, your last 0 writes a 0 to AM, you want the last cipher to be 8 for vertical, thus: 0x10?8, where ? is your choice based on the directions in the table on page 55.