Announcement

Collapse
No announcement yet.

Has anyone the ILI9163C driver for Goldelox?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Has anyone the ILI9163C driver for Goldelox?

    Hello
    I need the ILI9163C driver for the Goldelox Chip. Has Anyone the code to initialize a display with this driver???
    I think that the wrong part is the GRAM state machine for ILI9163C.
    With a microcontroller I can display images with a function like this:
    SendCommand(0x2a);SendData(0x00);SendData(0);SendData(0x00);SendData(127);
    SendCommand(0x2b);SendData(0x00);SendData(0);SendData(0x00);SendData(159);
    SendCommand(0x2c);
    However, I don't know how to complete the GRAM part for this display using these register. Help please!


    #platform "GOLDELOX"
    #inherit "4DGL_16bitColours.fnc"

    //=============================================
    //=============================================
    // 4D Systems
    // GOLDELOX-GFX2
    // display specifics for ILI9163C
    // Version 1.0
    // 11/08/2015
    //=============================================
    //=============================================
    #constant _DISPLAY_X_MAX 127
    #constant _DISPLAY_Y_MAX 159

    //=============================================
    // write device state machine constants
    // The values are fixed, do not change.
    // used in GRAM state machine tables
    //=============================================
    #CONST
    WRITE_CONTROL_CONSTANT 0
    WRITE_DATA_CONSTANT 1
    WRITE_CONTROL_BYTE 2
    WRITE_DATA_BYTE 3
    WRITE_EXIT 0xFF
    #END

    //=============================================
    // GRAM rectangle control register addresses
    // the values represent the addresses of the
    // internal register address holding register
    // and are fixed.
    //=============================================
    #CONST
    _VX1 0x80
    _VY1 0x81
    _VX2 0x82
    _VY2 0x83
    #END

    //=============================================
    // associated constants
    //=============================================
    #constant _256_COLOURS 0x34
    #constant _65K_COLOURS 0x74
    #constant _262K_COLOURS 0xB4

    //=============================================
    // ILI9163C Registers
    //=============================================
    #CONST
    // ILI9163 LCD Controller Commands
    NOP 0x00
    SOFT_RESET 0x01
    GET_RED_CHANNEL 0x06
    GET_GREEN_CHANNEL 0x07
    GET_BLUE_CHANNEL 0x08
    GET_PIXEL_FORMAT 0x0C
    GET_POWER_MODE 0x0A
    GET_ADDRESS_MODE 0x0B
    GET_DISPLAY_MODE 0x0D
    GET_SIGNAL_MODE 0x0E
    GET_DIAGNOSTIC_RESULT 0x0F
    ENTER_SLEEP_MODE 0x10
    EXIT_SLEEP_MODE 0x11
    ENTER_PARTIAL_MODE 0x12
    ENTER_NORMAL_MODE 0x13
    EXIT_INVERT_MODE 0x20
    ENTER_INVERT_MODE 0x21
    SET_GAMMA_CURVE 0x26
    SET_DISPLAY_OFF 0x28
    SET_DISPLAY_ON 0x29
    SET_COLUMN_ADDRESS 0x2A//
    SET_PAGE_ADDRESS 0x2B//
    WRITE_MEMORY_START 0x2C//
    WRITE_LUT 0x2D
    READ_MEMORY_START 0x2E//
    SET_PARTIAL_AREA 0x30
    SET_SCROLL_AREA 0x33
    SET_TEAR_OFF 0x34
    SET_TEAR_ON 0x35
    SET_ADDRESS_MODE 0x36//
    SET_SCROLL_START 0X37
    EXIT_IDLE_MODE 0x38
    ENTER_IDLE_MODE 0x39
    SET_PIXEL_FORMAT 0x3A
    WRITE_MEMORY_CONTINUE 0x3C
    READ_MEMORY_CONTINUE 0x3E
    SET_TEAR_SCANLINE 0x44
    GET_SCANLINE 0x45
    READ_ID1 0xDA
    READ_ID2 0xDB
    READ_ID3 0xDC
    FRAME_RATE_CONTROL1 0xB1
    FRAME_RATE_CONTROL2 0xB2
    FRAME_RATE_CONTROL3 0xB3
    DISPLAY_INVERSION 0xB4
    SOURCE_DRIVER_DIRECTION 0xB7
    GATE_DRIVER_DIRECTION 0xB8
    POWER_CONTROL1 0xC0
    POWER_CONTROL2 0xC1
    POWER_CONTROL3 0xC2
    POWER_CONTROL4 0xC3
    POWER_CONTROL5 0xC4
    VCOM_CONTROL1 0xC5
    VCOM_CONTROL2 0xC6
    VCOM_OFFSET_CONTROL 0xC7
    WRITE_ID4_VALUE 0xD3
    NV_MEMORY_FUNCTION1 0xD7
    NV_MEMORY_FUNCTION2 0xDE
    POSITIVE_GAMMA_CORRECT 0xE0
    NEGATIVE_GAMMA_CORRECT 0xE1
    GAM_R_SEL 0xF2
    #END
    //=============================================
    // fin
    //=============================================


    //===========================================================
    // GRAM state machine for ILI9163C
    // using 13 bytes
    //===========================================================
    #DATA
    byte GRAM_sm

    WRITE_CONTROL_CONSTANT, SET_COLUMN_ADDRESS ,
    WRITE_DATA_BYTE, 0x00,
    WRITE_DATA_BYTE, _VX1,
    WRITE_DATA_BYTE, 0x00,
    WRITE_DATA_BYTE, _VX2,
    WRITE_CONTROL_CONSTANT, SET_PAGE_ADDRESS ,
    WRITE_DATA_BYTE, 0x00,
    WRITE_DATA_BYTE, _VY1,
    WRITE_DATA_BYTE, 0x00,
    WRITE_DATA_BYTE, _VY2,

    WRITE_CONTROL_CONSTANT,WRITE_MEMORY_START,
    WRITE_EXIT
    #END


    //===========================================================
    // initialization for the ILI9163C
    // using 33 bytes
    //===========================================================
    #DATA
    byte INIT_tbl

    // first 4 bytes of table hold
    // display access information
    _DISPLAY_X_MAX, // width: 128-1
    _DISPLAY_Y_MAX, // height: 160-1
    WRITE_MEMORY_START, // write access register:0X2C
    READ_MEMORY_START, // read access register:0X2E

    //INIT_TABLE_PORTRAIT, // initial screen mode requirement
    //INIT_TABLE_LANDSCAPE,
    //INIT_TABLE_PORTRAIT_R ,
    INIT_TABLE_LANDSCAPE_R,

    // now the display initialization table
    0,SOFT_RESET,
    INIT_TABLE_DELAY, 1,//50ms
    0,EXIT_SLEEP_MODE, //0x11,
    INIT_TABLE_DELAY, 1,//5ms
    1,SET_GAMMA_CURVE, 0x04,//Gamma adjustment enabled
    //2,FRAME_RATE_CONTROL1, 0x08,0x08,//DIVA=8,VPA=8
    //1,DISPLAY_INVERSION, 0x07,//NLA=,NLB=1,NLC=1(all frame Inversion)
    1,POWER_CONTROL1, 0x1F,//0xC0
    1,POWER_CONTROL2, 0x00,//0xC1
    1,POWER_CONTROL3, 0x00,//0xC2
    1,POWER_CONTROL4, 0x00,//0xC3
    2,VCOM_CONTROL1, 0x24,0xC8,//0xC5
    0,EXIT_IDLE_MODE, //0x38
    1,SET_PIXEL_FORMAT, 0x05,//0x3A
    1,SET_ADDRESS_MODE, 0x08,//0x36
    //1,VCOM_OFFSET_CONTROL, 0x40,//nvM=0,vmf=64:VOMH output=VMH,VCOML output=VM
    //4,SET_COLUMN_ADDRESS, 0x00,0x00,0x00,0x7F,
    //4,SET_PAGE_ADDRESS, 0x00,0x00,0x00,0x9F,
    0,SET_DISPLAY_ON, //0x29,
    INIT_TABLE_END // 0xFF,dont forget this !
    #END
    func main()

    disp_Init(INIT_tbl, GRAM_sm); // initialize the display
    pause(100);
    while(!media_Init()) // initialize the SD Card
    putstr("Drive not mounted...");
    pause(100);
    gfx_Cls();
    pause(100);
    wend

    gfx_Cls();
    media_SetSector(0x0000,0x0000);
    media_Video(0,0);
    repeat

    forever

    endfunc

  • #2
    You don't need
    Code:
    WRITE_CONTROL_CONSTANT,WRITE_MEMORY_START,
    at the end, but otherwise it should work fine.

    What are you seeing?
    Mark

    Comment


    • #3
      I see the screen white.
      Is the GRAM part OK?
      //===========================================================
      // GRAM state machine for ILI9163C
      // using 13 bytes
      //===========================================================
      #DATA
      byte GRAM_sm
      WRITE_CONTROL_CONSTANT,WRITE_MEMORY_START,
      WRITE_EXIT
      #END

      and Are the first four bytes ok?
      // first 4 bytes of table hold
      // display access information
      _DISPLAY_X_MAX, // width: 128-1
      _DISPLAY_Y_MAX, // height: 160-1
      WRITE_MEMORY_START, // write access register:0X2C
      READ_MEMORY_START, // read access register:0X2E

      Comment


      • #4
        Gee, from what I said about the sm, I thought you'd have this now.
        Code:
        #DATA
        byte GRAM_sm
        WRITE_CONTROL_CONSTANT, SET_COLUMN_ADDRESS ,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VX1,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VX2,
        WRITE_CONTROL_CONSTANT, SET_PAGE_ADDRESS ,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VY1,
        WRITE_DATA_BYTE, 0x00,
        WRITE_DATA_BYTE, _VY2,
        WRITE_EXIT
        #END
        The other bits look fine.

        Because the screen is white it must be getting initialised in some way to the right result, but all white on an OLED seems 'extreme'
        Mark

        Comment


        • #5
          This device is the TFT display LMT018DNBFWD-NAN1 with the driver ILI9163C. I have tested many combinations of the GRAM_sm, with and without
          the line :WRITE_CONTROL_CONSTANT,WRITE_MEMORY_START,. The hardware is ok. I have designed other PCBs with GOLDELOX. I have another design with an OLED Flexible and the driver SEPS645B which I will post the code when I finish with this TFT. This display is OK because has been working with the microcontroller ATmega328. I don't have much ideas of how to follow with this driver ILI6163, Any suggestion?
          Now my code looks like:
          #platform "GOLDELOX"
          #inherit "4DGL_16bitColours.fnc"

          //=============================================
          //=============================================
          // 4D Systems
          // GOLDELOX-GFX2
          // display specifics for ILI9163C
          // Version 1.0
          // 11/08/2015
          //=============================================
          //=============================================
          #constant _DISPLAY_X_MAX 127
          #constant _DISPLAY_Y_MAX 159

          //=============================================
          // write device state machine constants
          // The values are fixed, do not change.
          // used in GRAM state machine tables
          //=============================================
          #CONST
          WRITE_CONTROL_CONSTANT 0
          WRITE_DATA_CONSTANT 1
          WRITE_CONTROL_BYTE 2
          WRITE_DATA_BYTE 3
          WRITE_EXIT 0xFF
          #END

          //=============================================
          // GRAM rectangle control register addresses
          // the values represent the addresses of the
          // internal register address holding register
          // and are fixed.
          //=============================================
          #CONST
          _VX1 0x80
          _VY1 0x81
          _VX2 0x82
          _VY2 0x83
          #END

          //=============================================
          // associated constants
          //=============================================
          #constant _256_COLOURS 0x34
          #constant _65K_COLOURS 0x74
          #constant _262K_COLOURS 0xB4

          //=============================================
          // ILI9163C Registers
          //=============================================
          #CONST
          // ILI9163 LCD Controller Commands
          NOP 0x00
          SOFT_RESET 0x01
          GET_RED_CHANNEL 0x06
          GET_GREEN_CHANNEL 0x07
          GET_BLUE_CHANNEL 0x08
          GET_PIXEL_FORMAT 0x0C
          GET_POWER_MODE 0x0A
          GET_ADDRESS_MODE 0x0B
          GET_DISPLAY_MODE 0x0D
          GET_SIGNAL_MODE 0x0E
          GET_DIAGNOSTIC_RESULT 0x0F
          ENTER_SLEEP_MODE 0x10
          EXIT_SLEEP_MODE 0x11
          ENTER_PARTIAL_MODE 0x12
          ENTER_NORMAL_MODE 0x13
          EXIT_INVERT_MODE 0x20
          ENTER_INVERT_MODE 0x21
          SET_GAMMA_CURVE 0x26
          SET_DISPLAY_OFF 0x28
          SET_DISPLAY_ON 0x29
          SET_COLUMN_ADDRESS 0x2A//
          SET_PAGE_ADDRESS 0x2B//
          WRITE_MEMORY_START 0x2C//
          WRITE_LUT 0x2D
          READ_MEMORY_START 0x2E//
          SET_PARTIAL_AREA 0x30
          SET_SCROLL_AREA 0x33
          SET_TEAR_OFF 0x34
          SET_TEAR_ON 0x35
          SET_ADDRESS_MODE 0x36//
          SET_SCROLL_START 0X37
          EXIT_IDLE_MODE 0x38
          ENTER_IDLE_MODE 0x39
          SET_PIXEL_FORMAT 0x3A
          WRITE_MEMORY_CONTINUE 0x3C
          READ_MEMORY_CONTINUE 0x3E
          SET_TEAR_SCANLINE 0x44
          GET_SCANLINE 0x45
          READ_ID1 0xDA
          READ_ID2 0xDB
          READ_ID3 0xDC
          FRAME_RATE_CONTROL1 0xB1
          FRAME_RATE_CONTROL2 0xB2
          FRAME_RATE_CONTROL3 0xB3
          DISPLAY_INVERSION 0xB4
          SOURCE_DRIVER_DIRECTION 0xB7
          GATE_DRIVER_DIRECTION 0xB8
          POWER_CONTROL1 0xC0
          POWER_CONTROL2 0xC1
          POWER_CONTROL3 0xC2
          POWER_CONTROL4 0xC3
          POWER_CONTROL5 0xC4
          VCOM_CONTROL1 0xC5
          VCOM_CONTROL2 0xC6
          VCOM_OFFSET_CONTROL 0xC7
          WRITE_ID4_VALUE 0xD3
          NV_MEMORY_FUNCTION1 0xD7
          NV_MEMORY_FUNCTION2 0xDE
          POSITIVE_GAMMA_CORRECT 0xE0
          NEGATIVE_GAMMA_CORRECT 0xE1
          GAM_R_SEL 0xF2
          #END
          //=============================================
          // fin
          //=============================================


          //===========================================================
          // GRAM state machine for ILI9163C
          // using 13 bytes
          //===========================================================
          #DATA
          byte GRAM_sm
          WRITE_CONTROL_CONSTANT, SET_COLUMN_ADDRESS ,
          WRITE_DATA_BYTE, 0x00,
          WRITE_DATA_BYTE, _VX1,
          WRITE_DATA_BYTE, 0x00,
          WRITE_DATA_BYTE, _VX2,
          WRITE_CONTROL_CONSTANT, SET_PAGE_ADDRESS ,
          WRITE_DATA_BYTE, 0x00,
          WRITE_DATA_BYTE, _VY1,
          WRITE_DATA_BYTE, 0x00,
          WRITE_DATA_BYTE, _VY2,
          //WRITE_CONTROL_CONSTANT,WRITE_MEMORY_START,
          WRITE_EXIT
          #END

          //===========================================================
          // initialization for the ILI9163C
          // using 33 bytes
          //===========================================================
          #DATA
          byte INIT_tbl

          // first 4 bytes of table hold
          // display access information
          _DISPLAY_X_MAX, // width: 128-1
          _DISPLAY_Y_MAX, // height: 160-1
          WRITE_MEMORY_START, // write access register:0X2C
          READ_MEMORY_START, // read access register:0X2E

          INIT_TABLE_PORTRAIT, // initial screen mode requirement
          //INIT_TABLE_LANDSCAPE,
          //INIT_TABLE_PORTRAIT_R ,
          //INIT_TABLE_LANDSCAPE_R,

          // now the display initialization table
          0,SOFT_RESET,
          0,EXIT_SLEEP_MODE, //0x11,
          INIT_TABLE_DELAY, 20,//1ms
          0,EXIT_INVERT_MODE, //0x20
          0,ENTER_NORMAL_MODE, //0x13
          1,SET_GAMMA_CURVE, 0x04,//Gamma adjustment enabled
          2,FRAME_RATE_CONTROL1, 0x08,0x08,//DIVA=8,VPA=8
          //1,DISPLAY_INVERSION, 0x07,//NLA=,NLB=1,NLC=1(all frame Inversion)
          1,POWER_CONTROL1, 0x1F,//0xC0
          1,POWER_CONTROL2, 0x00,//0xC1
          1,POWER_CONTROL3, 0x00,//0xC2
          1,POWER_CONTROL4, 0x00,//0xC3
          2,VCOM_CONTROL1, 0x24,0xC8,//0xC5
          0,EXIT_IDLE_MODE, //0x38
          1,SET_PIXEL_FORMAT, 0x05,//0x3A
          1,SET_ADDRESS_MODE, 0x08,//0x36
          //2,0xB1, 0x0E,0x14,//FR=61.7Hz
          //1,VCOM_OFFSET_CONTROL, 0x40,//nvM=0,vmf=64:VOMH output=VMH,VCOML output=VM
          //4,SET_COLUMN_ADDRESS, 0x00,0x00,0x00,0x7F,
          //4,SET_PAGE_ADDRESS, 0x00,0x00,0x00,0x9F,
          0,SET_DISPLAY_ON, //0x29,
          INIT_TABLE_END // 0xFF,dont forget this !
          #END

          func main()

          disp_Init(INIT_tbl, GRAM_sm); // initialize the display
          pause(100);
          while(!media_Init()) // initialize the SD Card
          putstr("Drive not mounted...");
          pause(100);
          gfx_Cls();
          pause(100);
          wend

          txt_Bold(1);
          txt_Italic(1);
          txt_MoveCursor(1, 1);
          txt_Set(TEXT_COLOUR, RED);
          print("HELLO");
          pause(5000);

          //Imagen
          media_SetSector(0x0000,0x0000);
          media_Image(0,0);
          repeat
          forever

          endfunc




          Thank you



































          Attached Files

          Comment


          • #6
            The ILI9163C is the driver used in the uLCD-144-G2-A-R25 PmmC. What happens if you load that PmmC?

            Any reason why you didn't just use a uLCD-144-G2?

            I think I can see a Transcend card in the uSD socket. Read this http://forum.4dsystems.com.au/forum/...ds-support-spi
            Mark

            Comment


            • #7
              Duh, your display seems to be a different resolution, but the driver matches, so I'm curious as to what you will see with that PmmC.

              Also try running the attached and see what gets written to the serial port (open terminal at 115200 and click reset)
              Attached Files
              Mark

              Comment


              • #8
                I thought that uLCD-144-G2 has only the ST7735 IC driver. It is a very good new that uLCD-144-G2 runs also with the ILI9163C. I have loaded the uLCD-144-G2-A-R25.PmmC, however it does the same, it tries to load continuosly the image from the SD and the screen remains white. The Terminal says:"Unknown Driver IC, ID bytes:- FE FE FE".

                Furthermore, I have repeated this procedure with another PCB that it has a TFT with the ST7735C IC driver. It happens a similar action, it tries to load the image but it can't. In this case the screen is full with little dots of differents colors.

                Both TFTs has a resolution of 128x160, nevertheless I believe that the pmmc file is for a resolution of 128x128. With this the terminal says: The Terminal says:"Unknown Driver IC, ID bytes:- 00 00 00".

                In reference to the SD card, the Transcend memories have always woked fine to me. Indeed, that SD was working in the prototype with the Flexible OLED.
                Click image for larger version

Name:	pantallas.jpg
Views:	27
Size:	107.9 KB
ID:	48144

                I will change the SD and repeat the test.
                Can I change the resolution of the uLCD-144-G2-A-R25.PmmC?

                Comment


                • #9
                  FE FE FE and 00 00 00 would tend to indicate a short, or open connection to the display, or some other connection that is not correct.

                  If the backlight is on the display will respond with its device ID for the driver types listed in the code ST7735, ST7735C and ILI9163C
                  Mark

                  Comment


                  • #10
                    Hi Mark,

                    The Goldelox had a lead bad soldered.
                    Now the display works, but I have a resolution of 128x128, how can I change it? I need 128x160.
                    Click image for larger version

Name:	Dibujo.JPG
Views:	48
Size:	8.0 KB
ID:	48231

                    Thank you.

                    Comment


                    • #11
                      OK, so now your original code might be closer to working..

                      Try this, which I think is close to what you should end up with.
                      Attached Files
                      Mark

                      Comment


                      • #12
                        Hi,

                        Now I have a different problem. I hava I prototype with the display PH128160n which has the driver ST7735R. The resolution is 128x160, so the "uLCD_144.pmmc" isn't useful for me. I have loaded "Goldelox_G2-r25.pmmc" into the chip and then my own code. I can see images, videos, etc.. However, I can't show RED colors. For instance, an image with a red circle is displayed on my LCD as a blue circle. Other colors have the lack of red component. Do you know what parameter I must change? or I need a special configuration on the Goldelox chip?

                        My code for SR7735R is:

                        #platform "GOLDELOX"
                        #inherit "4DGL_16bitColours.fnc"

                        //=============================================
                        //=============================================
                        // 4D Systems
                        // GOLDELOX-GFX2
                        // display specifics for ST7735R
                        // Version 1.0
                        // 11/08/2015
                        //=============================================
                        //=============================================
                        #constant _DISPLAY_X_MAX 129
                        #constant _DISPLAY_Y_MAX 160

                        //=============================================
                        // write device state machine constants
                        // The values are fixed, do not change.
                        // used in GRAM state machine tables
                        //=============================================
                        #CONST
                        WRITE_CONTROL_CONSTANT 0
                        WRITE_DATA_CONSTANT 1
                        WRITE_CONTROL_BYTE 2
                        WRITE_DATA_BYTE 3
                        WRITE_EXIT 0xFF
                        #END

                        //=============================================
                        // GRAM rectangle control register addresses
                        // the values represent the addresses of the
                        // internal register address holding register
                        // and are fixed.
                        //=============================================
                        #CONST
                        _VX1 0x80
                        _VY1 0x81
                        _VX2 0x82
                        _VY2 0x83
                        #END

                        //=============================================
                        // ST7735 Registers
                        //=============================================
                        #CONST
                        // ST7735 LCD Controller Commands
                        ST7735_NOP 0x00
                        ST7735_SWRESET 0x01
                        ST7735_RDDID 0x04
                        ST7735_RDDST 0x09
                        ST7735_SLPIN 0x10
                        ST7735_SLPOUT 0x11
                        ST7735_PTLON 0x12
                        ST7735_NORON 0x13
                        ST7735_INVOFF 0x20
                        ST7735_INVON 0x21
                        ST7735_DISPOFF 0x28
                        ST7735_DISPON 0x29
                        ST7735_CASET 0x2A
                        ST7735_RASET 0x2B
                        ST7735_RAMWR 0x2C
                        ST7735_RAMRD 0x2E
                        ST7735_COLMOD 0x3A
                        ST7735_MADCTL 0x36
                        ST7735_FRMCTR1 0xB1
                        ST7735_FRMCTR2 0xB2
                        ST7735_FRMCTR3 0xB3
                        ST7735_INVCTR 0xB4
                        ST7735_DISSET5 0xB6
                        ST7735_PWCTR1 0xC0
                        ST7735_PWCTR2 0xC1
                        ST7735_PWCTR3 0xC2
                        ST7735_PWCTR4 0xC3
                        ST7735_PWCTR5 0xC4
                        ST7735_VMCTR1 0xC5
                        ST7735_RDID1 0xDA
                        ST7735_RDID2 0xDB
                        ST7735_RDID3 0xDC
                        ST7735_RDID4 0xDD
                        ST7735_SSSSS 0xF0
                        ST7735_VVVVV 0xF6
                        ST7735_PWCTR6 0xFC
                        ST7735_GMCTRP1 0xE0
                        ST7735_GMCTRN1 0xE1
                        #END
                        //=============================================
                        // fin
                        //=============================================


                        //===========================================================
                        // GRAM state machine for ST7735R
                        // using 13 bytes
                        //===========================================================
                        #DATA
                        byte GRAM_sm
                        WRITE_CONTROL_CONSTANT, ST7735_CASET,
                        WRITE_DATA_BYTE, 0x00,
                        WRITE_DATA_BYTE, _VX1,
                        WRITE_DATA_BYTE, 0x00,
                        WRITE_DATA_BYTE, _VX2,
                        WRITE_CONTROL_CONSTANT, ST7735_RASET ,
                        WRITE_DATA_BYTE, 0x00,
                        WRITE_DATA_BYTE, _VY1,
                        WRITE_DATA_BYTE, 0x00,
                        WRITE_DATA_BYTE, _VY2,
                        WRITE_EXIT
                        #END

                        //===========================================================
                        // initialization for the ST7735R
                        // using 33 bytes
                        //===========================================================
                        #DATA
                        byte INIT_tbl

                        // first 4 bytes of table hold
                        // display access information
                        _DISPLAY_X_MAX, // width: 128-1
                        _DISPLAY_Y_MAX, // height: 160-1
                        ST7735_RAMWR, // write access register 0x0C=GRAM Read/Write Port
                        ST7735_RAMWR, // read access register

                        //INIT_TABLE_PORTRAIT, // initial screen mode requirement
                        //INIT_TABLE_LANDSCAPE,
                        //INIT_TABLE_PORTRAIT_R ,
                        INIT_TABLE_LANDSCAPE_R,

                        // now the display initialization table
                        0,ST7735_SWRESET, //software reset
                        INIT_TABLE_DELAY, 150,//0xFE, delay 150ms
                        0,ST7735_SLPOUT,
                        INIT_TABLE_DELAY, 120,//0xFE, delay 120ms
                        3,ST7735_FRMCTR1, 0x05,0x3C,0x3C,//frame rate control - normal mode
                        3,ST7735_FRMCTR2, 0x05,0x3C,0x3C,//frame rate control - idle mode
                        6,ST7735_FRMCTR3, 0x01,0x3C,0x3C,0x05,0x3C,0x3C,//frame rate control - partial mode
                        1,ST7735_INVCTR, 0x07,//display inversion control, no inversion
                        3,ST7735_DISSET5, 0x84,0xF0,0x20,
                        3,ST7735_PWCTR1, 0xB4,0x14,0x04,//power control
                        1,ST7735_PWCTR2, 0xC0,//VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
                        2,ST7735_PWCTR3, 0x0A,0x00,//Opamp current small,Boost frequency
                        2,ST7735_PWCTR4, 0x8A,0x2A,// BCLK/2, Opamp current small & Medium low
                        1,ST7735_VMCTR1, 0x00,// power control
                        0,ST7735_INVOFF, // don't invert display
                        1,ST7735_MADCTL, 0xC0,// power control
                        1,ST7735_COLMOD, 0x05,// power control
                        4,ST7735_CASET, 0x00,0x00,0x00,0x7F,// column addr set:0-127
                        4,ST7735_RASET, 0x00,0x00,0x00,0x9F,// row addr set:0-159
                        //16,ST7735_GMCTRP1, 0x02,0x1C,0x07,0x12,0x37,0x32,0x29,0x2D,0x29,0x25,0x2B,0x39,0x00,0x01,0x03,0x10,
                        //16,ST7735_GMCTRN1, 0x03,0x1D,0x07,0x06,0x2E,0x2C,0x29,0x2D,0x2E,0x2E,0x37,0x3F,0x00,0x00,0x02,0x10,
                        16,ST7735_GMCTRP1, 0x09,0x16,0x09,0x20,0x21,0x1B,0x13,0x19,0x17,0x15,0x1E,0x2B,0x04,0x05,0x02,0x0E,
                        16,ST7735_GMCTRN1, 0x0B,0x14,0x08,0x1E,0x22,0x1D,0x18,0x1E,0x1B,0x1A,0x24,0x2B,0x06,0x06,0x02,0x0F,
                        //1,ST7735_SSSSS, 0x01,
                        //1,ST7735_VVVVV, 0x00,
                        0,ST7735_DISPON,
                        INIT_TABLE_DELAY, 100,//0xFE, delay 100ms
                        0,ST7735_NORON,
                        INIT_TABLE_DELAY, 10,//0xFE, delay 10ms
                        INIT_TABLE_END // 0xFF,dont forget this !
                        #END

                        func main()

                        disp_Init(INIT_tbl, GRAM_sm); // initialize the display
                        while(!media_Init()) // initialize the SD Card
                        putstr("Drive not mounted...");
                        pause(100);
                        gfx_Cls();
                        pause(100);
                        wend

                        repeat

                        // Image - Size 128x160
                        media_SetSector(0x0000,0x0000);
                        media_Image(0,0);
                        pause(5000);


                        // Movie - "3_cuadrados.gif" Size 128x160
                        media_SetSector(0x0000, 0x5FF3);
                        media_Video(0,0);

                        // Movie - "4_black.gif" Size 128x160
                        media_SetSector(0x0000, 0x9D84);
                        media_Video(0,0);


                        forever

                        endfunc








































                        Comment


                        • #13
                          I presume if you try and display a blue circle it will some out red....

                          Change MADCTL to 0xC8 during init and see how that works
                          Mark

                          Comment


                          • #14
                            Changing MADCTL=0xC8 the display works correctly. Thank you very much!

                            Comment

                            Working...
                            X