Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/19/08 02:20
Read: times


 
#151088 - A few suggestions for Your code
Responding to: ???'s previous message
1) Make a subroutine that outputs one character to the display chip
2) Make another subroutine that rewinds the chip address counter (You already have this one)
3) Make yet another subroutine that actually clears the display by writing non visible character to all it's lenght
4) Make a subroutine that outputs a string to the display

After this Your main code would look like:

static void WriteDisplayString( const char * aString ) {
    ResetDisplayPointer();
    while ( *aString ) WriteLedDisplayChar( *(aString++) );
}

static void ClearLedDisplay() {
   unsigned char ix;
   ResetDisplayPointer();
   for (ix=0; ix < DISPLAY_LENGTH; ix++ ) {
        WriteLedDisplayChar( INVISIBLE_CHAR );
   }

}

extern void main() {
    ClearLedDisplay();
    WriteLedDisplayString( "WHOAA" );
}


Those will not make Your code any more efficient or smaller but they make it very much more readable.

List of 11 messages in thread
TopicAuthorDate
argggg....I'm stuck again.....:(            01/01/70 00:00      
   The clear bit is wron way around.            01/01/70 00:00      
      Esko..Just verified clear bit            01/01/70 00:00      
   What is the execution order ?            01/01/70 00:00      
      Verified the order execution            01/01/70 00:00      
         So it is the sbit thing that is hurting You now.            01/01/70 00:00      
            Correction: Place the CALL before data loop            01/01/70 00:00      
   A few suggestions for Your code            01/01/70 00:00      
      I will adapt some of it, thank you            01/01/70 00:00      
         I (don\'t) C            01/01/70 00:00      
         Make life easier            01/01/70 00:00      

Back to Subject List