<?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>topic Re: problem busy LCD 16X2 TO 4bits in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183961#M13615</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now it work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Aug 2012 02:35:11 GMT</pubDate>
    <dc:creator>yecosuma</dc:creator>
    <dc:date>2012-08-14T02:35:11Z</dc:date>
    <item>
      <title>problem   busy LCD 16X2    TO 4bits</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183959#M13613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working one lcd 16x2 en en 4 bits. I read already different information about this.&lt;BR /&gt;I am working with one Mcu JM60. with a pll to 40 Mhz I have a problem, because when I have programed the Mcu appear this symbol ← one arrow to the left&lt;BR /&gt;I think the problem is in the funcion busy but I do not sure. if anybody can help me I thanks.&lt;/P&gt;&lt;P&gt;the others funtions I am sure are corrects &amp;nbsp;but I doubt of the busy funtion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void busy()&lt;BR /&gt;{&lt;BR /&gt;unsigned char bf=1;&lt;BR /&gt;//port of dates input&lt;BR /&gt;PTEDD_PTEDD7=0;&lt;BR /&gt;PTEDD_PTEDD6=0;&lt;BR /&gt;PTEDD_PTEDD5=0;&lt;BR /&gt;PTEDD_PTEDD4=0;&lt;BR /&gt;rs=control; //0&lt;BR /&gt;rw=lee; //1&lt;BR /&gt;// enable = on;&lt;BR /&gt;while (bf ){ // If Busy (PTA7=1), loop&lt;BR /&gt;enable = on; // Set E=1&lt;BR /&gt;bf = PTED_PTED7; // Read status register&lt;BR /&gt;enable = off; // Set E=0&lt;BR /&gt;enable = on; // Set E=1&lt;BR /&gt;enable = off; // Set E=0&lt;BR /&gt;}&lt;BR /&gt;PTEDD_PTEDD7=1;&lt;BR /&gt;PTEDD_PTEDD6=1;&lt;BR /&gt;PTEDD_PTEDD5=1;&lt;BR /&gt;PTEDD_PTEDD4=1;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jul 2012 22:47:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183959#M13613</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2012-07-27T22:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: problem busy LCD 16X2 TO 4bits</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183960#M13614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your busy() function is probably operational, but I have&amp;nbsp;the following comments -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With&amp;nbsp;a bus frequency of 20MHz, the following sequence may be borderline with respect to the minimum display module timing specification for the E-signal.&amp;nbsp; You may wish to place a small delay between each of the statements.&amp;nbsp; However, I doubt that this will prove to&amp;nbsp;be your problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;enable = off; // Set E=0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;enable = on;&amp;nbsp; // Set E=1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;enable = off; // Set E=0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This would become ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#define DELAY3&amp;nbsp;&amp;nbsp;&amp;nbsp; __asm nop; __asm nop; __asm nop&amp;nbsp; // Delay 3 cycles&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;enable = off; // Set E=0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DELAY3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;enable = on;&amp;nbsp; // Set E=1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;DELAY3;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;enable = off; // Set E=0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It is probably a good idea to restore write mode before the function exits, since further operations will generally require write mode.&amp;nbsp; With the present code, it would be problematic if the other LCD functions did not firstly select write mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that the busy flag is not operative during the first part of the LCD initialization process, with the consequence that you will need to generate time delays here, rather than use the busy flag.&amp;nbsp; If you&amp;nbsp;happen to be attempting to&amp;nbsp;use the busy flag, the initialisation will fail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once initialization is complete, the minimum delay requirement following most commands is 40 microseconds, which is not too onerous to provide, in lieu of the testing of the busy flag.&amp;nbsp; Most LCD implementations that I have seen do not bother with the busy flag, but adopt adequate time delays.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some additional comments about your code implementation - these are not "errors" per se, but will result in code that isless efficient and is cluttered.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PTEDD_PTEDD7=0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PTEDD_PTEDD6=0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PTEDD_PTEDD5=0;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;PTEDD_PTEDD4=0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an inefficient coding practice to clear the upper nybble of the&amp;nbsp;data direction&amp;nbsp;register.&amp;nbsp; It is better to do all bits simultaneously using a bit mask.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#define DMASK&amp;nbsp; 0xF0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PTEDD &amp;amp;= ~DMASK;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conversely, to&amp;nbsp;set the upper nybble, you would use -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;PTEDD |= DMASK;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this instance, the busy flag test would be better done&amp;nbsp;using a &lt;FONT face="courier new,courier"&gt;do...while&lt;/FONT&gt; loop, rather than&amp;nbsp;the existing&lt;FONT face="courier new,courier"&gt;&amp;nbsp;while&lt;/FONT&gt; loop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 29 Jul 2012 21:27:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183960#M13614</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2012-07-29T21:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: problem busy LCD 16X2 TO 4bits</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183961#M13615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now it work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 02:35:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-busy-LCD-16X2-TO-4bits/m-p/183961#M13615</guid>
      <dc:creator>yecosuma</dc:creator>
      <dc:date>2012-08-14T02:35:11Z</dc:date>
    </item>
  </channel>
</rss>

