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

use shift right/left with flex_lcd driver

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



Joined: 09 Jun 2010
Posts: 8

View user's profile Send private message MSN Messenger

use shift right/left with flex_lcd driver
PostPosted: Thu Jun 10, 2010 6:52 am     Reply with quote

I have this very simple program:

Code:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

#include "flex_lcd.c"
   
//==========================
void main()
{
lcd_init();  // Always call this first.

lcd_putc("\fHello World");

while(1);
}


I use the flex_lcd driver for the 16x2 lcd HD4478U to display the word "hello world" and i would like to make a clear question:

Can i use the command shift_right (address, bytes, value)
to shift the "hello word" or i have to do it with a for loop.

In other words does the flex_lcd driver supports the shift command?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jun 10, 2010 11:45 am     Reply with quote

Here is a side scrolling demo that works with the Flex lcd driver:
Code:

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)

#include "flex_lcd.c"

void lcd_scroll_right(void)
{
lcd_send_byte(0, 0x1E);
}
//-------------------------
void lcd_scroll_left(void)
{
lcd_send_byte(0, 0x18);
}
   
//=======================
void main()
{
int8 i;

lcd_init();

lcd_putc("\f");  // Clear the LCD
delay_ms(100);   

// The 16x2 LCD memory is 40 characters wide, so fill it
// up with data for two screens.  Each line below must
// contain 40 characters (excluding the newline).   
lcd_putc("Hello to the        Side scrolling      \n");
lcd_putc("world.              demo.               ");

delay_ms(1000);

while(1)
  {
   for(i = 0; i < 20; i++)  // Scroll for 20 chars
      {
       lcd_scroll_left();
       delay_ms(200);   // This sets the scroll speed
      }

   delay_ms(2000);   // Wait 2 seconds between scrolling
                     // each screen.
  }

}
Panos



Joined: 09 Jun 2010
Posts: 8

View user's profile Send private message MSN Messenger

PostPosted: Thu Jun 17, 2010 5:34 am     Reply with quote

Thank you very much PCM!! It works perfect! Although with the "lcd_scroll_left" comand it scrolls right and with the "lcd_scroll_right" scrolls left!! But i changed the "lcd_send_byte(0, 0x1E);" and "lcd_send_byte(0, 0x18);" and now it's right!!
Thank you! Very Happy
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