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.

Check my LCD display code written using c18

Status
Not open for further replies.

handsprince

Member level 2
Joined
Feb 7, 2006
Messages
43
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,583
i had wrote a lcd display code as below using c18; but it is not function, can anyone check for me:

code:
#include <stdio.h>
#include <p18f4620.h>
#include <xlcd.h>
#include <delays.h>
void DelayFor18TCY( void )
{
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
Nop();
}
void DelayPORXLCD (void)
{
Delay1KTCYx(60); // Delay of 15ms
// Cycles = (TimeDelay * Fosc) / 4
// Cycles = (15ms * 16MHz) / 4
// Cycles = 60,000
return;
}
void DelayXLCD (void)
{
Delay1KTCYx(20); // Delay of 5ms
// Cycles = (TimeDelay * Fosc) / 4
// Cycles = (5ms * 16MHz) / 4
// Cycles = 20,000
return;
}
void main()
{
TRISB = 0x00;
OpenXLCD(FOUR_BIT & LINES_5X7);
while(1)
{
putrsXLCD( "Hello World" );
}
}

*******************************************************
XLCD.h haeder file i modified

#define UPPER

/* DATA_PORT defines the port to which the LCD data lines are connected */
#define DATA_PORT PORTB
#define TRIS_DATA_PORT TRISB

/* CTRL_PORT defines the port where the control lines are connected.
* These are just samples, change to match your application.
*/
#define RW_PIN PORTBbits.RB1 /* PORT for RW */
#define TRIS_RW DDRBbits.RB1 /* TRIS for RW */
#define RS_PIN PORTBbits.RB2 /* PORT for RS */
#define TRIS_RS DDRBbits.RB2 /* TRIS for RS */
#define E_PIN PORTBbits.RB3 /* PORT for E */
#define TRIS_E DDRBbits.RB3 /* TRIS for E */
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top