title: How to initialize 4-bit operation of an LCD
body: <p>I am having a hard time finding succinct tutorials regrading the initialization of an LCD controller. I have read in the datasheet there is a specific sequence of bits that should be sent to the LCD. Such a initialization sequence is presented here: </p>
  
  <p><img src="https://i.stack.imgur.com/ocULy.jpg" alt="enter image description here"></p>
  
  <p>I simply cannot follow the information presented here. I can see that the first few steps require the user to power the device, wait a sufficient amount of time, and then set the state of a few data lines. I can understand through the following:</p>
  
  <p>Assuming we use the byte format as follows: D7 D6 D5 D4 RS RW X X </p>
  
  <ul>
  <li>Power on</li>
  <li>wait >40mS</li>
  <li>Write 0011 0000 => 0x30  </li>
  <li>wait >4.1mS</li>
  <li>write 0011 0000 => 0x30</li>
  <li>wait >100uS</li>
  <li>write 0011 0000 => 0x30</li>
  </ul>
  
  <p>After which I have no idea. I have scoured the datasheet and have found little explaining the references to <strong>N, I/D, D, B, F, C</strong> shown below (some not shown). Further, any tutorial I have read often references a mysterious "<strong>Function Set</strong>" (i.e. below with <em>Function set: interface is 8 bits long</em> ?) that am unsure about. </p>
  
  <p>The actual LCD model that I have is: WH2004A-CFH-JT#
  But from what I have read, most LCDs are derivatives of the HD44780</p>
  
  <p>As such, my first attempt at initializing this display was going to be realizing the sequence given in the datasheet for that display.</p>
  
  <p>Are there any good resources that would be recommended? Can anyone explain what the <strong><em>"Function Set</em></strong> is and the associated variables <strong><em>B, C, F, I/D</em></strong> .. etc? </p>
  
  <p>Further, is it that once in 4-bit mode that information is sent to the LCD simply by first presenting the 4-bit nibble of the highest data bits (7, 6, 5, 4), clocking in that data, and then repeating with the lower-bit nibble? </p>