<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPCXpresso IDEのトピックHelp~~!! Could anyone help me debug the code for LPC1769 &amp; 4-bit 2*16 LCD</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571142#M20459</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by a0105540 on Mon Sep 15 03:00:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to attach a 2*16 LCD to my LPC1769 using 4_bit configuration. I found some useful code online and took them as my references to write my own code. However, my friends and i spent three whole days to debug the simple code but nothing happened. I sincerely call for your guys help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The LCD i use is a rt1602c. I want to display "hello" and "world!" on two separate rows of the screen. But every time i compile, the screen showed "Vellogorld!" or "ello"(row1)&amp;amp;gworld!(row2) or "ello! ello", etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; [u]The display results are quite random[/u] but i can roughly see "hello world!" there. The position is not stable, which shifts with time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;I attached the lcd.c lcd.h and main.c file below. And i also attached a datasheet for the rt1602c. A website is provided as well if you want to know more about the lcd.(&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.8051projects.net%2Flcd-interfacing%2Flcd-4-bit.php" rel="nofollow" target="_blank"&gt;http://www.8051projects.net/lcd-interfacing/lcd-4-bit.php&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jun 2016 01:02:24 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-16T01:02:24Z</dc:date>
    <item>
      <title>Help~~!! Could anyone help me debug the code for LPC1769 &amp; 4-bit 2*16 LCD</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571142#M20459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by a0105540 on Mon Sep 15 03:00:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to attach a 2*16 LCD to my LPC1769 using 4_bit configuration. I found some useful code online and took them as my references to write my own code. However, my friends and i spent three whole days to debug the simple code but nothing happened. I sincerely call for your guys help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The LCD i use is a rt1602c. I want to display "hello" and "world!" on two separate rows of the screen. But every time i compile, the screen showed "Vellogorld!" or "ello"(row1)&amp;amp;gworld!(row2) or "ello! ello", etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; [u]The display results are quite random[/u] but i can roughly see "hello world!" there. The position is not stable, which shifts with time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;I attached the lcd.c lcd.h and main.c file below. And i also attached a datasheet for the rt1602c. A website is provided as well if you want to know more about the lcd.(&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.8051projects.net%2Flcd-interfacing%2Flcd-4-bit.php" rel="nofollow" target="_blank"&gt;http://www.8051projects.net/lcd-interfacing/lcd-4-bit.php&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:02:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571142#M20459</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help~~!! Could anyone help me debug the code for LPC1769 &amp; 4-bit 2*16 LCD</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571143#M20460</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by gbm on Mon Sep 15 03:39:21 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Don't rely on software loops in delay();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.wait_lcd() is incorrect - it doesn't read the second half of status register and testing the state of BUSY while keping E high may be problematic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. wait_lcd should be used BEFORE writing new command/data, not after.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Do not use |= while writing to port set and clear registers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5. There is no delay between setting the data and clearing E in lcd_data_write - this seems to be the main problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:02:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571143#M20460</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help~~!! Could anyone help me debug the code for LPC1769 &amp; 4-bit 2*16 LCD</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571144#M20461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by a0105540 on Mon Sep 15 18:06:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much for your instant response. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I read your suggestions carefully and I do some adjustment. However, the LCD still doesn't perform well. Besides, my LCD sometimes has one line sometimes has two line for the same code. I don't think this causality&amp;nbsp; is normal either. Does this has anything to do with my code,too?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:02:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571144#M20461</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help~~!! Could anyone help me debug the code for LPC1769 &amp; 4-bit 2*16 LCD</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571145#M20462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Pacman on Mon Sep 15 19:01:36 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;void delay(int count)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; int j = 0, i = 0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for(j = 0; j &amp;lt; count; j++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* At 60Mhz, the below loop introduces delay of 10 us */
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i = 0; i &amp;lt; 35; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; asm volatile("nop");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-You need some kind of volatile in there. I've used 'nop', so your loop won't be optimized.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;After my changes, please re-calibrate your loop. New value might be something between 26 and 28 (wild guess).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For short delays, I would recommend that you assume the MCU is running at 120MHz. The 1602 displays won't mind if you're waiting a few microseconds longer. The only thing that matters is that your delay should not be too short.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For large delays, it might be a good idea to use a timer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2016 01:02:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Help-Could-anyone-help-me-debug-the-code-for-LPC1769-4-bit-2-16/m-p/571145#M20462</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-16T01:02:27Z</dc:date>
    </item>
  </channel>
</rss>

