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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/26/05 14:50
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#98169 - Software is the answer
Responding to: ???'s previous message

#define NUM_CHARS_LINE 20 //number of characters per lcd line

char lcd_buff[NUM_CHAR_LINE+1]; //+1 to be sure!!

void timer_tick_1s(void) //we get called every second
{
static char shift = 0;
lcd_output(shift);
shift++;
if (shift > NUM_CHARS_LINE) shift = 0;
}



void lcd_output(char offset)
{
char off;
char loop;

lcd_cursor(0); //set cursor to top left
off=offset; //set starting position in the line buffer
for(loop=0;loop<NUM_CHARS_LINE;loop++) //loop for 20 characters (1 line)
{
if (off >=NUM_CHARS_LINE) off = 0; //do the wrap around
lcd_out(lcd_buff[off]); //write char to the lcd
off++;
}
}

Whilst not super optimised, hopefully it illustrates the point. I'm sure if you want it in assembler, you can convert the code easily!




List of 8 messages in thread
TopicAuthorDate
20*4 lcd            01/01/70 00:00      
   Buffer, shift, then write            01/01/70 00:00      
      Alternative approach            01/01/70 00:00      
         lcd            01/01/70 00:00      
   It is easy!            01/01/70 00:00      
      Software Control!            01/01/70 00:00      
         Software is the answer            01/01/70 00:00      
         awesome            01/01/70 00:00      

Back to Subject List