Editing BoostC Forum Extracts 2007

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 241: Line 241:
 
Yes, this one bit me too! I wrote the following routine that you can use for any ms value from 1 to 65535. I timed it at 60,000 and it seems to be pretty much on the money.
 
Yes, this one bit me too! I wrote the following routine that you can use for any ms value from 1 to 65535. I timed it at 60,000 and it seems to be pretty much on the money.
  
  void delayMs(unsigned int ms){
+
void delayMs(unsigned int ms){
      char i;
+
char i;
      char high = ms >> 8;
+
char high = ms >> 8;
      char low = ms & 0x00ff;
+
char low = ms & 0x00ff;
      for(i = 0; i < high; i++){
+
for(i = 0; i < high; i++){
            delay_ms(255);
+
delay_ms(255);
      }
+
}
      delay_ms(low);  
+
delay_ms(low);  
  }
+
}
  
 
You might think that it needs another delay_ms(1) in the loop but I got the most accurate time without it.
 
You might think that it needs another delay_ms(1) in the loop but I got the most accurate time without it.
Line 263: Line 263:
  
  
 +
Use
 +
CODE
 +
...
 +
    lcd_datamode();
 +
    char c, i;
 +
    for( i = 0; i < 16; i++ )
 +
    {
 +
        c = buffer[i];
 +
        if( c == 0 )
 +
            break;
 +
        lcd_write( c );
 +
    }
 +
...
  
...
+
Regards
    lcd_datamode();
+
Dave
    char c, i;
 
    for( i = 0; i < 16; i++ )
 
    {
 
        c = buffer[i];
 
        if( c == 0 )
 
            break;
 
        lcd_write( c );
 
    }
 
...
 
 
 
  
  
 
-------------
 
-------------
* From:  http://forum.sourceboost.com/index.php?showtopic=3367&pid=12653&mode=threaded&start=#entry12653
+
*From:  http://forum.sourceboost.com/index.php?showtopic=3367&pid=12653&mode=threaded&start=#entry12653
  
 +
@Pavel:
  
 
That's it. Adding -d DEBUG to the compiler options does exactly what I want.
 
That's it. Adding -d DEBUG to the compiler options does exactly what I want.

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)