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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/28/04 13:46
Read: times


 
#75036 - RE: LCD Help!
Responding to: ???'s previous message
hi,

if you have so many cases to be compared, then why do you not use just a lookup table? For your task it requires 256 bytes placed somewhere inside code segment and a little piece of code, like:
const unsigned char code loot[256] = {0x31,0x32,0x33,0x00,0x34,0x35, // etc};
// here 0x00 is used as a marker for not possible conditions

// inside ISR
{
   unsigned char x; 
   x = XBYTE[0x0a000]; 
   if ((x = loot[x]) != 0x00)
   {
      P1 = x;
      2LCD();
   }
}
It is short, quick and effective way.

Regards,
Oleg



List of 13 messages in thread
TopicAuthorDate
LCD Help!            01/01/70 00:00      
   RE: LCD Help!            01/01/70 00:00      
   RE: LCD Help!            01/01/70 00:00      
   RE: LCD Help!            01/01/70 00:00      
   RE: LCD Help!            01/01/70 00:00      
      RE: LCD Help!            01/01/70 00:00      
         RE: LCD Help!            01/01/70 00:00      
            RE: LCD Help!            01/01/70 00:00      
   RE: LCD Help!            01/01/70 00:00      
      RE: LCD Help!            01/01/70 00:00      
      RE: LCD Help!            01/01/70 00:00      
         RE: Lookup table            01/01/70 00:00      
      Use a switch statement!            01/01/70 00:00      

Back to Subject List