NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Vertical Scrolling
January 08, 2010 by omer921 |
I have created a program that scroll text vertically : // initialload.c // for NerdKits with ATmega168 // mrobbins@mit.edu define F_CPU 14745600include <stdio.h>include <avr/io.h>include <avr/interrupt.h>include <avr/pgmspace.h>include <inttypes.h>include "../libnerdkits/delay.h"include "../libnerdkits/lcd.h"include <avr/io.h>include <avr/delay.h>int main() { // LED as output DDRC |= (1<<PC5);
// print message to screen // 20 columns wide: // 01234567890123456789 lcd_line_one(); lcd_write_string(PSTR(" Some times if")); lcd_line_two(); lcd_write_string(PSTR(" you think hard it")); lcd_line_three(); lcd_write_string(PSTR(" might pay off ")); lcd_line_four(); lcd_write_string(PSTR(" ** ")); delay_ms(1000); lcd_line_one(); lcd_write_string(PSTR(" **")); lcd_line_two(); lcd_write_string(PSTR(" Some times if")); lcd_line_three(); lcd_write_string(PSTR(" you think hard it")); lcd_line_four(); lcd_write_string(PSTR(" might pay off ")); delay_ms(1000); lcd_line_one(); lcd_write_string(PSTR(" might pay off ")); lcd_line_two(); lcd_write_string(PSTR(" **")); lcd_line_three(); lcd_write_string(PSTR(" Some times if")); lcd_line_four(); lcd_write_string(PSTR(" you think hard it")); delay_ms(1000); lcd_line_one(); lcd_write_string(PSTR(" you think hard it")); lcd_line_two(); lcd_write_string(PSTR(" might pay off ")); lcd_line_three(); lcd_write_string(PSTR(" ** ")); lcd_line_four(); lcd_write_string(PSTR(" Some times if")); delay_ms(1000); lcd_line_one(); lcd_write_string(PSTR(" Some times if")); lcd_line_two(); lcd_write_string(PSTR(" you think hard it")); lcd_line_three(); lcd_write_string(PSTR(" might pay off ")); lcd_line_four(); lcd_write_string(PSTR(" ")); // busy loop while(100) { } return 0; } |
---|---|
April 05, 2010 by Ralphxyz |
This is really cool. I was wondering how to do this, it will take some refinement to fit what I have in mind but you did the hard part, Thanks Ralph Here is the corrected code (minor typos and extra }):
|
April 07, 2010 by Ralphxyz |
The code stops on the last page if you add a while(1) loop it loops around and shows all of the pages again and again.
Of course now I have to learn interrupts to get any thing else done. Anyone know how to do horizontal scrolling? Ralph |
April 08, 2010 by Ralphxyz |
Here is discussion of horizontal scrolling: And here is the working code for the temperature project: Ralph |
Please log in to post a reply.
Did you know that you can see each keypress on a computer keyboard on an oscilloscope? Learn more...
|