Interfacing Pic to HX8347-A?

Discussion in 'Embedded Systems and Microcontrollers' started by spinnaker, Jan 8, 2015.

  1. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Very probably. Why not try it?
     
    Last edited: Jan 9, 2015
  3. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Well your wrong. Had I gone on you "why not try it" I would have wasted hours for nothing. You can be very helpful to forum members but also very hostile too.

    I did some more investigating and it looks like this eBay device is very different than the actual controller I think I will post under a new subject line hopefully will get some more notice.
     
  4. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,672
    2,708
    I've never considered hours spent trying something wasted.
     
    ErnieM likes this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Well I've never considered encouraging someone in their work to be "very hostile."
     
  6. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988

    Sorry but that is not how I took, I think it is fairly obvious that I can just try it but the purpose of this forum is to share useful information. I was hoping I would find someone to point me in the write direction so that I am not chasing after something that simpley does not work.
     
  7. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    After getting some information on the microchip forum I found that the eBay board is indeed compatible with the HX8347 datasheet. The whole problem for me is that the HX8347 datasheet is not very descriptive at least to me. While some datasheets give me a little trouble I eventually figure at least most of it out. The microchip datasheets are one of the easiest for me to figure out. But his HX8347 is very difficult. I am guessing a solid understanding of TFT displays is required since the HX8347 is simply the controller.

    I found some code that looks pretty complete. Probably the best I have found to date.

    https://blackrynius.wordpress.com/2011/05/03/hx8347-a-lcd-code-for-pic18f4580/

    Here is the init code for the device.

    Code (Text):
    1.  
    2. LCD_REST = 1;
    3.  
    4. Delay10KTCYx(1); //5ms delay
    5.  
    6. LCD_REST = 0;
    7.  
    8. Delay10KTCYx(3); //10ms delay
    9.  
    10. LCD_REST = 1;
    11.  
    12. Delay10KTCYx(3); //20ms delay
    13.  
    14.  
    15.  
    16. //Vendor gamma
    17.  
    18. LCD_write_COM_DATA(0x0046,0x00a4);
    19.  
    20. LCD_write_COM_DATA(0x0047,0x0053);
    21.  
    22. LCD_write_COM_DATA(0x0048,0x0000);
    23.  
    24. LCD_write_COM_DATA(0x0049,0x0044);
    25.  
    26. LCD_write_COM_DATA(0x004a,0x0004);
    27.  
    28. LCD_write_COM_DATA(0x004b,0x0067);
    29.  
    30. LCD_write_COM_DATA(0x004c,0x0033);
    31.  
    32. LCD_write_COM_DATA(0x004d,0x0077);
    33.  
    34. LCD_write_COM_DATA(0x004e,0x0012);
    35.  
    36. LCD_write_COM_DATA(0x004f,0x004c);
    37.  
    38. LCD_write_COM_DATA(0x0050,0x0046);
    39.  
    40. LCD_write_COM_DATA(0x0051,0x0044);
    41.  
    42.  
    43.  
    44.  
    45. //240x320 window settings
    46.  
    47. LCD_write_COM_DATA(0x0002,0x0000); //Column address start2
    48.  
    49. LCD_write_COM_DATA(0x0003,0x0000); //column address start1
    50.  
    51. LCD_write_COM_DATA(0x0004,0x0000); //Column address end2
    52.  
    53. LCD_write_COM_DATA(0x0005,0x00ef); //Column address end1
    54.  
    55. LCD_write_COM_DATA(0x0006,0x0000); //Row address start2
    56.  
    57. LCD_write_COM_DATA(0x0007,0x0000); //Row address start1
    58.  
    59. LCD_write_COM_DATA(0x0008,0x0001); //Row address end2
    60.  
    61. LCD_write_COM_DATA(0x0009,0x003f); //Row address end1
    62.  
    63.  
    64.  
    65. //display settings
    66.  
    67. LCD_write_COM_DATA(0x0001,0x0006); //IDMON=0,INVON=1,NORON=1,PTLON=0
    68.  
    69. LCD_write_COM_DATA(0x0016,0x00c8); //MY=0,MX=0,MV=0,ML=1,BGR=0,TEON=0
    70.  
    71. LCD_write_COM_DATA(0x0023,0x0095); //N_DC=1001 0101
    72.  
    73. LCD_write_COM_DATA(0x0024,0x0095); //PI_DC=1001 0101
    74.  
    75. LCD_write_COM_DATA(0x0025,0x00ff); //I_DC=1111 1111
    76.  
    77.  
    78.  
    79. LCD_write_COM_DATA(0x0027,0x0002); //N_BP=0000 0010
    80.  
    81. LCD_write_COM_DATA(0x0028,0x0002); //N_FP=0000 0010
    82.  
    83. LCD_write_COM_DATA(0x0029,0x0002); //PI_BP=0000 0010
    84.  
    85. LCD_write_COM_DATA(0x002a,0x0002); //PI_FP=0000 0010
    86.  
    87. LCD_write_COM_DATA(0x002c,0x0002); //I_BP=0000 0010
    88.  
    89. LCD_write_COM_DATA(0x002d,0x0002); //I_FP=0000 0010
    90.  
    91.  
    92.  
    93. LCD_write_COM_DATA(0x003a,0x0001); //N_RTN=0000,N_NW=001
    94.  
    95. LCD_write_COM_DATA(0x003b,0x0000); //P_RTN=0000,P_NW=001
    96.  
    97. LCD_write_COM_DATA(0x003c,0x00f0); //I_RTN=1111,I_NW=000
    98.  
    99. LCD_write_COM_DATA(0x003d,0x0000); //DIV=00
    100.  
    101. Delay1KTCYx(2); //1ms delay
    102.  
    103. LCD_write_COM_DATA(0x0035,0x0038); //EOS=38h
    104.  
    105. LCD_write_COM_DATA(0x0036,0x0078); //EQP=78h
    106.  
    107. LCD_write_COM_DATA(0x003e,0x0038); //SON=38h
    108.  
    109. LCD_write_COM_DATA(0x0040,0x000f); //GDON=0fh
    110.  
    111. LCD_write_COM_DATA(0x0041,0x00f0); //GDOFF
    112.  
    113.  
    114.  
    115. //Power Supply Settings
    116.  
    117. LCD_write_COM_DATA(0x0019,0x0049); //CADJ=0100,CUADJ=100,OSD_EN=1,60Hz
    118.  
    119. LCD_write_COM_DATA(0x0093,0x000f); //RADJ=1111, 100%
    120.  
    121. Delay1KTCYx(2); //1ms delay
    122.  
    123. LCD_write_COM_DATA(0x0020,0x0040); //BT=0100
    124.  
    125. LCD_write_COM_DATA(0x001d,0x0007); //VC1=111
    126.  
    127. LCD_write_COM_DATA(0x001e,0x0000); //VC3=000
    128.  
    129. LCD_write_COM_DATA(0x001f,0x0004); //VRH=0011
    130.  
    131.  
    132.  
    133. //VCOM Settings
    134.  
    135. LCD_write_COM_DATA(0x0044,0x004d); //VCM=101 0000
    136.  
    137. LCD_write_COM_DATA(0x0045,0x000e); //VDV=1 0001
    138.  
    139. Delay1KTCYx(2); //1ms delay
    140.  
    141. LCD_write_COM_DATA(0x001c,0x0004); //AP=100
    142.  
    143. Delay1KTCYx(4); //2ms delay
    144.  
    145. LCD_write_COM_DATA(0x001b,0x0018); //GASENB=0,PON=1,DK=1,XDK=0,VLCD TRI=0,STB=0
    146.  
    147. Delay1KTCYx(2); //1ms delay
    148.  
    149. LCD_write_COM_DATA(0x001b,0x0010); //GASENB=0,PON=1,DK=0,XDK=0,VLCD TRI=0,STB=0
    150.  
    151. Delay1KTCYx(2); //1ms delay
    152.  
    153. LCD_write_COM_DATA(0x0043,0x0080); //set VCOMG=1
    154.  
    155. Delay1KTCYx(4); //2ms delay
    156.  
    157.  
    158.  
    159. //Display On Setting
    160.  
    161. LCD_write_COM_DATA(0x0090,0x007f); //SAP=0111 1111
    162.  
    163. LCD_write_COM_DATA(0x0026,0x0004); //GON=0,DTE=0,D=01
    164.  
    165. Delay1KTCYx(2); //1ms delay
    166.  
    167. LCD_write_COM_DATA(0x0026,0x0024); //GON=1,DTE=0,D=01
    168.  
    169. LCD_write_COM_DATA(0x0026,0x002c); //GON=1,DTE=0,D=11
    170.  
    171. Delay1KTCYx(2); //1ms delay
    172.  
    173. LCD_write_COM_DATA(0x0026,0x003c); //GON=1,DTE=1,D=11
    174.  
    175.  
    176.  
    177. //Internal Register Settings
    178.  
    179. LCD_write_COM_DATA(0x0057,0x0002); //TEST_Mode=1: into test mode
    180.  
    181. LCD_write_COM_DATA(0x0095,0x0001); //SET DISPLAY CLOCK AND PUMPKING CLOCK TO SYCRONIZE
    182.  
    183. LCD_write_COM_DATA(0x0057,0x0000); //TEST Mode=0:exit TEST Mode
    184.  
    185.  
    186.  
    187. LCD_write_COM(0x0022);
    188.  
    While I understand basically what is going on. That the various registers are being set, I am struggling to understand what each of these registers are actually doing or better why the programmer is setting them or knew the need to set them.

    I found a couple of tutorials online but basically they are just how to hook up the chip then run this code. It would be nice to know what the code is doing and why. So far I have not founs that type of tutorial.
     
  8. michael8

    New Member

    Jan 11, 2015
    18
    2
    If you follow your link to ebay and follow the link on ebay where it says:

    Data download: 2.4" TFT LCD Module

    you get a rar file with non-printing non-english file names. There is a pdf file in there with the name containing ILI9325.pdf.

    This appears to be an english datasheet for the LCD controller chip (and it's 111 pages). Oh, just googling for ILI9325
    brings up the first link with a later version of the data sheet...


    www.hpinfotech.ro/ILI9325.pdf

    PS: I haven't used this or any other LCD controller...
     
  9. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Thanks but mine is based on the HX8347 and I do have the datasheet (there was a similar rar file on the page where I ordered the product.). It is just that it is not very descriptive. No where near like microchip's datasheets.
     
  10. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
  11. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    No problem so far. In the process of bread boarding it all. I did not realize the ILI9325 was essentially compatible with the HX8347. I will take a look at that datasheet to see if it is more palatable.
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Is there some reason not to use the Microchip driver which already has a complete ResetDevice() function for this device along with the Microchip graphics libraries showing objects built in the Microchip Graphic Display Designer?

    They all worked nicely for me in 2011.
     
  13. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
  14. spinnaker

    Thread Starter AAC Fanatic!

    Oct 29, 2009
    4,866
    988
    Well I got this thing all wired up and it is not working. I suspect there is something wrong with the device. All I need to do is to connect DB1 and ground. When I measure the voltage on DB1 the level can be 2-3 volts under the 5V supply. Disconnect the ground and it pops up to where it should be. DB0 works fine with ground connected.

    Any idea what could be wrong? DB1 shorted internally or something?
     
Loading...