caramelz
Junior Member level 2
- Joined
- Jul 19, 2012
- Messages
- 22
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,464
Hi guys. I want to make text in LCD to move around. i know is about shifting but due to my poor skills in microcontroller, i not able to do so. Please help.
here is the code i'm having.
#include <p18f4520.h>
#include <delays.h>
void Init_LCD(void); //Initialise the LCD
void W_ctr_8bit(char); //8-bit Control word for LCD
void W_data_8bit(char); //8-bit Text Data for LCD
#define LCD_DATA PORTD
#define LCD_RS PORTBbits.RB1
#define LCD_E PORTBbits.RB2
unsigned char LCD_TEMP,i,j,k,m;
char MESS[8]="welcome";
void main()
{
ADCON1=0x0f;
TRISB=0b11111001; // Port D as LCD data output
TRISD=0b00000000;
Init_LCD();
for(i=0;i<7;i++)
W_data_8bit(MESS);
}
/* LCD display initialization */
void Init_LCD()
{
W_ctr_8bit (0b00111000); //Function Set - 8-bit, 2 lines, 5x7
W_ctr_8bit (0b00001100); //Display on, cursor on
W_ctr_8bit (0b00000110); //Entry mode - inc addr, no shift
W_ctr_8bit (0b00000001); //Clear display
W_ctr_8bit (0b00000010); //Return cursor to home position
}
/* Write control word to LCD */
void W_ctr_8bit(char x)
{
LCD_RS = 0; //Logic '0'
LCD_E = 1; //Logic '1'
LCD_DATA= x;
LCD_E = 0; //Logic '0'
Delay10TCYx(50); //1ms delay
}
/* Write text data to LCD */
void W_data_8bit(char x)
{
LCD_RS = 1; //Logic '1'
LCD_E = 1; //Logic '1'
LCD_DATA = x;
LCD_E = 0; //Logic '0'
Delay10TCYx(50); //1ms delay
}
here is the code i'm having.
#include <p18f4520.h>
#include <delays.h>
void Init_LCD(void); //Initialise the LCD
void W_ctr_8bit(char); //8-bit Control word for LCD
void W_data_8bit(char); //8-bit Text Data for LCD
#define LCD_DATA PORTD
#define LCD_RS PORTBbits.RB1
#define LCD_E PORTBbits.RB2
unsigned char LCD_TEMP,i,j,k,m;
char MESS[8]="welcome";
void main()
{
ADCON1=0x0f;
TRISB=0b11111001; // Port D as LCD data output
TRISD=0b00000000;
Init_LCD();
for(i=0;i<7;i++)
W_data_8bit(MESS);
}
/* LCD display initialization */
void Init_LCD()
{
W_ctr_8bit (0b00111000); //Function Set - 8-bit, 2 lines, 5x7
W_ctr_8bit (0b00001100); //Display on, cursor on
W_ctr_8bit (0b00000110); //Entry mode - inc addr, no shift
W_ctr_8bit (0b00000001); //Clear display
W_ctr_8bit (0b00000010); //Return cursor to home position
}
/* Write control word to LCD */
void W_ctr_8bit(char x)
{
LCD_RS = 0; //Logic '0'
LCD_E = 1; //Logic '1'
LCD_DATA= x;
LCD_E = 0; //Logic '0'
Delay10TCYx(50); //1ms delay
}
/* Write text data to LCD */
void W_data_8bit(char x)
{
LCD_RS = 1; //Logic '1'
LCD_E = 1; //Logic '1'
LCD_DATA = x;
LCD_E = 0; //Logic '0'
Delay10TCYx(50); //1ms delay
}