Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to you scroll/move the message? 18f4520

Status
Not open for further replies.

darkz10

Newbie level 1
Joined
Feb 8, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
singapore
Activity points
1,296
#include <p18f4520.h>
#include <delays.h>
void Init_LCD(void); // Initialize 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 // RS signal for LCD
#define LCD_E PORTBbits.RB2 // E signal for LCD

unsigned char LCD_TEMP,i,j,k,m;
char MESS[14]="Welcome to EPS";
char MESS1[9]="Thank you";

void main()
{

ADCON1=0x0F; // Set ports A,B & E as digital I/O
TRISB = 0b11111001; // RB1 & 2 for LCD interface RS & E
TRISD = 0;
// Port D as LCD data output

Init_LCD();
while(1)
{ // Init LCD 8-bit interface,multiple line
W_ctr_8bit(0b10000000);
for (i=0; i<14; i++) // Output message "WELCOME" to LCD
W_data_8bit(MESS); // Write individual character to LCD

W_ctr_8bit(0b11000000); // Write individual character to LCD
for (i=0; i<9; i++)
W_data_8bit(MESS1);
}
}


/* 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
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top