CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to make text scroll on my 2x16 LCD?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest
Guest







How to make text scroll on my 2x16 LCD?
PostPosted: Wed Nov 10, 2004 9:01 am     Reply with quote

I am using a PIC millennium board and a PIC16F628. How can I make a text string scroll on the display?

My code:



#include "16F628.H"

#fuses INTRC,NOBROWNOUT,NOMCLR,NOWDT,NOPROTECT,NOLVP,NOPUT

#use delay (clock=4140000)

// Velger baud-rate og hvilke pinner som skal benyttes som RX og TX
#use rs232(baud=9600, xmit=PIN_A3,rcv=PIN_A2)

// Definerer SDA og SCL i hovedprogrammet.
#define SDA_PIN PIN_A1
#define SCL_PIN PIN_A0
#use i2c(master,sda=SDA_PIN, scl=SCL_PIN)

#include "lcd_rfo.c"
#include "2416_rfo.c"

//Globale variabler
char const text[26]="Stor blindtest av juleol!";
int tegn;
byte teller;

void main(void)
{
unsigned long j;

lcd_init(); //Initierer LCD
lcd_putc("\fSystem ready...\n"); //Sender en oppstartsmelding til LCD
printf("System ready...\n"); //Sender en oppstartsmelding til serieporten
delay_ms(2000); //Meldingen står i 2 sekunder
lcd_putc('\f'); //Sletter oppstartsmeldingen på LCD

//Initierer EEPROM
init_ext_eeprom();

// Skriver data (byte for byte) til EEPROM
for(j=0; j<26;j++)
{
write_ext_eeprom(0, j, text[j]);
delay_ms(10);
//printf("\n\rLagrer data i page 0 : offset %lu",j);
} // for

//puts("\n\rFerdig."); // Skriver en melding til serieporten
lcd_putc("DATA FRA EEPROM:");
lcd_putc('\n');
for ( teller=0; teller<26;teller++)
{
tegn=read_ext_eeprom(0, teller);
lcd_putc(tegn);
} // for
delay_ms(2000);

} // main
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Nov 10, 2004 11:27 am     Reply with quote

Write the text to the display
Wait
Write the text starting with the second char to the display
Wait
Write the text starting with the third char to the display
wait
and so on...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Nov 11, 2004 2:35 pm     Reply with quote

If you want to make the text scroll sideways, I have the following
routine from one of my programs. The lcd_send_byte() function
is in the CCS lcd.c driver file. The 0x18 value is a command
to scroll left, that works with standard LCD displays.
See this link for a list of commands:
http://www.geocities.com/dinceraydin/lcd/commands.htm

//-----------------------------------------------------------------------
// Scroll the lcd display 1 position left.
// After you're done scrolling, and want to enter new text, be sure to
// do a lcd_putc("\f"). This will clear the LCD and put the cursor in
// the upper left corner.

void lcd_scroll_left(void)
{

lcd_send_byte(0, 0x18);

}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group