<?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>CodeWarrior for MCUのトピックRe: Is there any way to display RTC (real-time clock) on a LCD without the LCD &amp;quot;flickering</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163280#M4634</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An additional option is to use a buffer; make all your changes and only update the parts of the buffer that have changed. Most LCDs should allw either setting the row/column or address, so in you loop you'd have something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;
// lcdBuffer is shared (e.g., "public"unsigned char lcdBuffer[COLUMNS][ROWS];// printf redirects to display chars to the bufferprintf_toLcd("blablah");//...// this function will copy the contents of// lcdBuffer into lcdDisplay; and changes will// be copied to the LCD controllervoid updateLcd(void) {  // lcdDisplay is private and should not be used directly  static unsigned char lcdDisplay[COLUMNS][ROWS];  int nextx; x, y;  for(y=0;y&amp;lt;ROWS;y++) {    nextx=-1;    x=0;    do {      // check if the buffer and display are different      if(lcdBuffer[x][y]!=lcdDisplay[x][y]) {        if(nextx!=x) {          // if we're not immediately after the last          // position, we need to reset our cursor          // this takes advanatge of most LCD's ability          // to autoincrement when writing          lcdSetCursor(x,y);        }        // write the data to LCD        lcdWriteData(lcdBuffer[x][y]);        // update our display buffer        lcdDisplay[x][y]=lcdBuffer[x][y];        // and keep track of our next position        nextx = ++x;      }    } while(x!=COLUMNS);  }}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by nonarKitten on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-06-26&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;05:37 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 09:09:24 GMT</pubDate>
    <dc:creator>nonarKitten</dc:creator>
    <dc:date>2020-10-29T09:09:24Z</dc:date>
    <item>
      <title>Is there any way to display RTC (real-time clock) on a LCD without the LCD "flickering"?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163277#M4631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi. I'm able to display a RTC (real-time clock) on my LCD. The function I'm using to do this is called "clock()"&amp;nbsp;for this case. However, the LCD screen flickers randomly due to the clock() function being inside an infinite loop as shown below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;for(;; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clock();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I don't put the clock() into an infinite loop, the RTC on the LCD screen will never count up because the RTC will only be read once. Help is appreciated. Thx&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by Cryptical on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-03-17&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;09:38 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by Cryptical on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-03-17&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;09:41 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 16:35:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163277#M4631</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-03-17T16:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to display RTC (real-time clock) on a LCD without the LCD "flickering</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163278#M4632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Cryptical,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume the clock() function reads the RTC and updates LCD display.&lt;/P&gt;&lt;P&gt;In order to avoid screen flickers you shouldn't update the LCD display in the infinite loop.&lt;/P&gt;&lt;P&gt;You can e.g. update the LCD only in case the second couter changes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;unsingned char sec, sec_old=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for(;; )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; sec = clock();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if (sec != sec_old)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateLCD();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sec_old = sec;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stanish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 16:58:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163278#M4632</guid>
      <dc:creator>stanish</dc:creator>
      <dc:date>2009-03-17T16:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to display RTC (real-time clock) on a LCD without the LCD "flickering</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163279#M4633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;stanish wrote:&lt;BR /&gt;&lt;P&gt;Cryptical,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume the clock() function reads the RTC and updates LCD display.&lt;/P&gt;&lt;P&gt;In order to avoid screen flickers you shouldn't update the LCD display in the infinite loop.&lt;/P&gt;&lt;P&gt;You can e.g. update the LCD only in case the second couter changes:&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx for the help stanish. I followed your advice and only updated the LCD when the second counter incremented by 1. The flickering reduced significantly! &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Mar 2009 09:29:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163279#M4633</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2009-03-18T09:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to display RTC (real-time clock) on a LCD without the LCD "flickering</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163280#M4634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An additional option is to use a buffer; make all your changes and only update the parts of the buffer that have changed. Most LCDs should allw either setting the row/column or address, so in you loop you'd have something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;
// lcdBuffer is shared (e.g., "public"unsigned char lcdBuffer[COLUMNS][ROWS];// printf redirects to display chars to the bufferprintf_toLcd("blablah");//...// this function will copy the contents of// lcdBuffer into lcdDisplay; and changes will// be copied to the LCD controllervoid updateLcd(void) {  // lcdDisplay is private and should not be used directly  static unsigned char lcdDisplay[COLUMNS][ROWS];  int nextx; x, y;  for(y=0;y&amp;lt;ROWS;y++) {    nextx=-1;    x=0;    do {      // check if the buffer and display are different      if(lcdBuffer[x][y]!=lcdDisplay[x][y]) {        if(nextx!=x) {          // if we're not immediately after the last          // position, we need to reset our cursor          // this takes advanatge of most LCD's ability          // to autoincrement when writing          lcdSetCursor(x,y);        }        // write the data to LCD        lcdWriteData(lcdBuffer[x][y]);        // update our display buffer        lcdDisplay[x][y]=lcdBuffer[x][y];        // and keep track of our next position        nextx = ++x;      }    } while(x!=COLUMNS);  }}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by nonarKitten on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-06-26&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;05:37 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:09:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163280#M4634</guid>
      <dc:creator>nonarKitten</dc:creator>
      <dc:date>2020-10-29T09:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to display RTC (real-time clock) on a LCD without the LCD "flickering</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163281#M4635</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello there!&lt;/P&gt;&lt;P&gt;I am also doing a similar project but I have no idea how to write the code for the clock function. How to implement Real-Time clock?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;little.eggtart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Oct 2011 11:02:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-any-way-to-display-RTC-real-time-clock-on-a-LCD-without/m-p/163281#M4635</guid>
      <dc:creator>little_egg_tart</dc:creator>
      <dc:date>2011-10-11T11:02:43Z</dc:date>
    </item>
  </channel>
</rss>

