|
|
View previous topic :: View next topic |
Author |
Message |
Silver
Joined: 10 Jun 2005 Posts: 4 Location: Italy
|
LCD with pic18F452 |
Posted: Mon Jun 13, 2005 2:19 am |
|
|
Thank you for helping me...But I can't still write anything on LCD display.
My schematic configuration is:
4bit data LCD are connected to port D of 18F452 (RD0,RD1,RD2,RD3)
Enable line on LCD is connected to RA5 of 18F452
RS and R/W are connected respectively to RD4 and RD5 of 18F452
How could I modify the source code that you have me linked?
Thank you again! |
|
|
chingB
Joined: 29 Dec 2003 Posts: 81
|
|
Posted: Mon Jun 13, 2005 5:27 am |
|
|
Hi,
This is what I did for my PIC18F452 with an LCD module connection.
LCD Pin PIC18F452 Pin
DB4 RD4
DB5 RD5
DB6 RD6
DB7 RD7
LCD_EN RD0
RW RD2
RS RD1
My Header File for LCD.H
Code: |
#ifndef __LCD_H__
#define __LCD_H__
// LCD Pin Map Structure
typedef struct LcdPinMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
boolean enable; // PinD0
boolean rs; // PinD1
boolean rw; // PinD2
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of portD is used for data lines
} LCD_PIN_MAP_STRUCT;
// LCD PortA Register Mapping
#if defined(__PCH__)
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = PORTA_BASE
#else
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = 0x05
#endif
// LCD Tris Structure
typedef struct LcdTrisMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
int control :3;
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of PortD is used for data lines
} LCD_TRIS_MAP_STRUCT;
// LCD TrisA Register Mapping
#if defined(__PCH__)
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = TRISA_BASE
#else
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = 0x85
#endif
// set Tris on ports for LCD
#define SET_TRIS_LCD(x) \
LcdTrisMapBits.data = (x); \
LcdTrisMapBits.control = 0;
#define LCD_TYPE (2) // 0=5x7, 1=5x10, 2=2 lines
#define LCD_LINE_TWO (0x40) // LCD RAM address for the second line
#define XLAT_OFFSET (0x80) // Character Translation Offset
#define LCD_SIZE (16) // Allocated Buffer for LCD Module
// LCD buffer allocation
byte LCDbuff[LCD_SIZE];
// These bytes need to be sent to the LCD to start it up.
byte const LCD_INIT_STRING[4] = {0x20 | (LCD_TYPE << 2), 0xc, 1, 6};
// The following are used for setting the I/O port direction register.
#define LCD_WRITE 0 // For write mode all pins are out
#define LCD_READ 15 // For read mode data pins are in
// The following display a string at specified x,y position
#define LCD_DISPLAY(x,y,string) \
lcd_gotoxy(x,y); \
lcd_putc(string);
/******************************************************************************
* Function Prototypes *
******************************************************************************/
void lcd_init(void); // initialize LCD display
char lcd_getc(byte x, byte y); // get char from LCD display
void lcd_putc(char c); // put char to LCD display
void lcd_gotoxy(byte x, byte y); // set an x,y position
void lcd_send_byte(byte address, byte n); // send a byte to LCD display
void lcd_send_nibble(byte n); // send a nibble to LCD display
byte lcd_read_byte(void); // read a byte from LCD display
#endif
|
My Source File for LCD.C
Code: |
/******************************************************************************
* Driver for Common LCD Modules *
* *
* lcd_init() Must be called before any other function *
* lcd_putc(c) Will display character (c) on the next position of the LCD *
* The following Parameters: *
* \f Clear Display *
* \n Go to start of second line *
* \b Move back one position *
* *
* lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) *
* lcd_getc(x,y) Returns character at position x,y on LCD *
******************************************************************************/
#include "Include\T-Keeper LCD.H"
/******************************************************************************
* Read a Byte from LCD *
******************************************************************************/
byte lcd_read_byte(void)
{
byte low, high;
SET_TRIS_LCD(LCD_READ); // set data pin to input state (read mode)
LcdPinMapBits.rw = 1; // set to rw to high (read mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set the enable pin to high
#asm nop #endasm // delay for one-clock cycle
high = LcdPinMapBits.data; // get the data from LCD (high nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
#asm nop #endasm // delay for one-clock cycle
low = LcdPinMapBits.data; // get the data from LCD (low nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
SET_TRIS_LCD(LCD_WRITE); // set data pin to output state (write mode)
return ((high << 4) | low); // return result
}
/******************************************************************************
* Send Nibble to LCD *
******************************************************************************/
void lcd_send_nibble(byte n)
{
LcdPinMapBits.data = n; // send a nibble to LCD
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
delay_us(2); // delay for 2uSec.
LcdPinMapBits.enable = 0; // set enable pin to low
return;
}
/******************************************************************************
* Send Byte to LCD *
******************************************************************************/
void lcd_send_byte(byte address, byte n)
{
LcdPinMapBits.rs = 0; // set rs pin to low
while (bit_test(lcd_read_byte(),7));
LcdPinMapBits.rs = address; // provide the address to write
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.rw = 0; // set rw pin to low (write mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 0; // set enable pin to low
lcd_send_nibble(n >> 4); // send high nibble to LCD
lcd_send_nibble(n & 0x0F); // send low nibble to LCD
return;
}
/******************************************************************************
* Initialize LCD Display *
******************************************************************************/
void lcd_init(void)
{
byte i;
SET_TRIS_LCD(LCD_WRITE); // set all ports to output state (write mode)
LcdPinMapBits.rs = 0; // set rs pin to low
LcdPinMapBits.rw = 0; // set rw pin to low
LcdPinMapBits.enable = 0; // set enable pin to low
delay_ms(15); // make a 15mSec. delay
for(i=1; i<=3; ++i)
{
lcd_send_nibble(3);
delay_ms(5);
}
lcd_send_nibble(2);
for(i=0; i<=3; ++i)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
}
for (i=0; i<LCD_SIZE; )
{
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
}
return;
}
/******************************************************************************
* Gotoxy LCD Routine *
******************************************************************************/
void lcd_gotoxy(BYTE x, BYTE y)
{
byte address;
if (y != 1)
address = LCD_LINE_TWO; // if not line1 set address to line2
else
address = 0; // set address to line1
address += (x - 1); // increment to next address (line1 or line2)
lcd_send_byte(0,(0x80 | address)); // send to address to write
return;
}
/******************************************************************************
* LCD Display PutChar Routine *
******************************************************************************/
void lcd_putc(char c)
{
if (c == '\f') // clear and write to line1
{
lcd_send_byte(0,1);
delay_ms(2);
return;
}
else if (c == '\n') // write to line2
{
lcd_gotoxy(1,2);
return;
}
else if (c == '\b') // backspace one position (line1 or line2)
{
lcd_send_byte(0,0x10);
return;
}
else
{
lcd_send_byte(1,c);
return;
}
}
/******************************************************************************
* LCD Display GetChar Routine *
******************************************************************************/
char lcd_getc(byte x, byte y)
{
char value;
lcd_gotoxy(x,y); // provide a x,y position
LcdPinMapBits.rs = 1; // set rs pin to high
value = lcd_read_byte(); // get a byte from LCD at x,y position
LcdPinMapBits.rs = 0; // set rs pin to low
return (value); // return the value
}
|
Hope this would help connect your LCD module to a PIC18F452. |
|
|
chingB
Joined: 29 Dec 2003 Posts: 81
|
|
Posted: Mon Jun 13, 2005 5:28 am |
|
|
Hi,
This is what I did for my PIC18F452 with an LCD module connection.
LCD Pin PIC18F452 Pin
DB4 RD4
DB5 RD5
DB6 RD6
DB7 RD7
LCD_EN RD0
RW RD2
RS RD1
My Header File for LCD.H
Code: |
#ifndef __LCD_H__
#define __LCD_H__
// LCD Pin Map Structure
typedef struct LcdPinMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
boolean enable; // PinD0
boolean rs; // PinD1
boolean rw; // PinD2
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of portD is used for data lines
} LCD_PIN_MAP_STRUCT;
// LCD PortA Register Mapping
#if defined(__PCH__)
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = PORTA_BASE
#else
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = 0x05
#endif
// LCD Tris Structure
typedef struct LcdTrisMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
int control :3;
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of PortD is used for data lines
} LCD_TRIS_MAP_STRUCT;
// LCD TrisA Register Mapping
#if defined(__PCH__)
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = TRISA_BASE
#else
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = 0x85
#endif
// set Tris on ports for LCD
#define SET_TRIS_LCD(x) \
LcdTrisMapBits.data = (x); \
LcdTrisMapBits.control = 0;
#define LCD_TYPE (2) // 0=5x7, 1=5x10, 2=2 lines
#define LCD_LINE_TWO (0x40) // LCD RAM address for the second line
#define XLAT_OFFSET (0x80) // Character Translation Offset
#define LCD_SIZE (16) // Allocated Buffer for LCD Module
// LCD buffer allocation
byte LCDbuff[LCD_SIZE];
// These bytes need to be sent to the LCD to start it up.
byte const LCD_INIT_STRING[4] = {0x20 | (LCD_TYPE << 2), 0xc, 1, 6};
// The following are used for setting the I/O port direction register.
#define LCD_WRITE 0 // For write mode all pins are out
#define LCD_READ 15 // For read mode data pins are in
// The following display a string at specified x,y position
#define LCD_DISPLAY(x,y,string) \
lcd_gotoxy(x,y); \
lcd_putc(string);
/******************************************************************************
* Function Prototypes *
******************************************************************************/
void lcd_init(void); // initialize LCD display
char lcd_getc(byte x, byte y); // get char from LCD display
void lcd_putc(char c); // put char to LCD display
void lcd_gotoxy(byte x, byte y); // set an x,y position
void lcd_send_byte(byte address, byte n); // send a byte to LCD display
void lcd_send_nibble(byte n); // send a nibble to LCD display
byte lcd_read_byte(void); // read a byte from LCD display
#endif
|
My Source File for LCD.C
Code: |
/******************************************************************************
* Driver for Common LCD Modules *
* *
* lcd_init() Must be called before any other function *
* lcd_putc(c) Will display character (c) on the next position of the LCD *
* The following Parameters: *
* \f Clear Display *
* \n Go to start of second line *
* \b Move back one position *
* *
* lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) *
* lcd_getc(x,y) Returns character at position x,y on LCD *
******************************************************************************/
#include "Include\T-Keeper LCD.H"
/******************************************************************************
* Read a Byte from LCD *
******************************************************************************/
byte lcd_read_byte(void)
{
byte low, high;
SET_TRIS_LCD(LCD_READ); // set data pin to input state (read mode)
LcdPinMapBits.rw = 1; // set to rw to high (read mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set the enable pin to high
#asm nop #endasm // delay for one-clock cycle
high = LcdPinMapBits.data; // get the data from LCD (high nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
#asm nop #endasm // delay for one-clock cycle
low = LcdPinMapBits.data; // get the data from LCD (low nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
SET_TRIS_LCD(LCD_WRITE); // set data pin to output state (write mode)
return ((high << 4) | low); // return result
}
/******************************************************************************
* Send Nibble to LCD *
******************************************************************************/
void lcd_send_nibble(byte n)
{
LcdPinMapBits.data = n; // send a nibble to LCD
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
delay_us(2); // delay for 2uSec.
LcdPinMapBits.enable = 0; // set enable pin to low
return;
}
/******************************************************************************
* Send Byte to LCD *
******************************************************************************/
void lcd_send_byte(byte address, byte n)
{
LcdPinMapBits.rs = 0; // set rs pin to low
while (bit_test(lcd_read_byte(),7));
LcdPinMapBits.rs = address; // provide the address to write
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.rw = 0; // set rw pin to low (write mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 0; // set enable pin to low
lcd_send_nibble(n >> 4); // send high nibble to LCD
lcd_send_nibble(n & 0x0F); // send low nibble to LCD
return;
}
/******************************************************************************
* Initialize LCD Display *
******************************************************************************/
void lcd_init(void)
{
byte i;
SET_TRIS_LCD(LCD_WRITE); // set all ports to output state (write mode)
LcdPinMapBits.rs = 0; // set rs pin to low
LcdPinMapBits.rw = 0; // set rw pin to low
LcdPinMapBits.enable = 0; // set enable pin to low
delay_ms(15); // make a 15mSec. delay
for(i=1; i<=3; ++i)
{
lcd_send_nibble(3);
delay_ms(5);
}
lcd_send_nibble(2);
for(i=0; i<=3; ++i)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
}
for (i=0; i<LCD_SIZE; )
{
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
}
return;
}
/******************************************************************************
* Gotoxy LCD Routine *
******************************************************************************/
void lcd_gotoxy(BYTE x, BYTE y)
{
byte address;
if (y != 1)
address = LCD_LINE_TWO; // if not line1 set address to line2
else
address = 0; // set address to line1
address += (x - 1); // increment to next address (line1 or line2)
lcd_send_byte(0,(0x80 | address)); // send to address to write
return;
}
/******************************************************************************
* LCD Display PutChar Routine *
******************************************************************************/
void lcd_putc(char c)
{
if (c == '\f') // clear and write to line1
{
lcd_send_byte(0,1);
delay_ms(2);
return;
}
else if (c == '\n') // write to line2
{
lcd_gotoxy(1,2);
return;
}
else if (c == '\b') // backspace one position (line1 or line2)
{
lcd_send_byte(0,0x10);
return;
}
else
{
lcd_send_byte(1,c);
return;
}
}
/******************************************************************************
* LCD Display GetChar Routine *
******************************************************************************/
char lcd_getc(byte x, byte y)
{
char value;
lcd_gotoxy(x,y); // provide a x,y position
LcdPinMapBits.rs = 1; // set rs pin to high
value = lcd_read_byte(); // get a byte from LCD at x,y position
LcdPinMapBits.rs = 0; // set rs pin to low
return (value); // return the value
}
|
Hope this would help connect your LCD module to a PIC18F452. |
|
|
chingB
Joined: 29 Dec 2003 Posts: 81
|
|
Posted: Mon Jun 13, 2005 5:29 am |
|
|
Hi,
This is what I did for my PIC18F452 with an LCD module connection.
LCD Pin PIC18F452 Pin
DB4 RD4
DB5 RD5
DB6 RD6
DB7 RD7
LCD_EN RD0
RW RD2
RS RD1
My Header File for LCD.H
Code: |
#ifndef __LCD_H__
#define __LCD_H__
// LCD Pin Map Structure
typedef struct LcdPinMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
boolean enable; // PinD0
boolean rs; // PinD1
boolean rw; // PinD2
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of portD is used for data lines
} LCD_PIN_MAP_STRUCT;
// LCD PortA Register Mapping
#if defined(__PCH__)
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = PORTA_BASE
#else
LCD_PIN_MAP_STRUCT LcdPinMapBits;
#locate LcdPinMapBits = 0x05
#endif
// LCD Tris Structure
typedef struct LcdTrisMapStruct
{
int unusedA; // portA is not used
int unusedB; // portB is not used
int unusedC; // portC is not used
int control :3;
boolean dummy; // PinD3 is not used
int data :4; // higher nibble of PortD is used for data lines
} LCD_TRIS_MAP_STRUCT;
// LCD TrisA Register Mapping
#if defined(__PCH__)
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = TRISA_BASE
#else
LCD_TRIS_MAP_STRUCT LcdTrisMapBits;
#locate LcdTrisMapBits = 0x85
#endif
// set Tris on ports for LCD
#define SET_TRIS_LCD(x) \
LcdTrisMapBits.data = (x); \
LcdTrisMapBits.control = 0;
#define LCD_TYPE (2) // 0=5x7, 1=5x10, 2=2 lines
#define LCD_LINE_TWO (0x40) // LCD RAM address for the second line
#define XLAT_OFFSET (0x80) // Character Translation Offset
#define LCD_SIZE (16) // Allocated Buffer for LCD Module
// LCD buffer allocation
byte LCDbuff[LCD_SIZE];
// These bytes need to be sent to the LCD to start it up.
byte const LCD_INIT_STRING[4] = {0x20 | (LCD_TYPE << 2), 0xc, 1, 6};
// The following are used for setting the I/O port direction register.
#define LCD_WRITE 0 // For write mode all pins are out
#define LCD_READ 15 // For read mode data pins are in
// The following display a string at specified x,y position
#define LCD_DISPLAY(x,y,string) \
lcd_gotoxy(x,y); \
lcd_putc(string);
/******************************************************************************
* Function Prototypes *
******************************************************************************/
void lcd_init(void); // initialize LCD display
char lcd_getc(byte x, byte y); // get char from LCD display
void lcd_putc(char c); // put char to LCD display
void lcd_gotoxy(byte x, byte y); // set an x,y position
void lcd_send_byte(byte address, byte n); // send a byte to LCD display
void lcd_send_nibble(byte n); // send a nibble to LCD display
byte lcd_read_byte(void); // read a byte from LCD display
#endif
|
My Source File for LCD.C
Code: |
/******************************************************************************
* Driver for Common LCD Modules *
* *
* lcd_init() Must be called before any other function *
* lcd_putc(c) Will display character (c) on the next position of the LCD *
* The following Parameters: *
* \f Clear Display *
* \n Go to start of second line *
* \b Move back one position *
* *
* lcd_gotoxy(x,y) Set write position on LCD (upper left is 1,1) *
* lcd_getc(x,y) Returns character at position x,y on LCD *
******************************************************************************/
#include "Include\T-Keeper LCD.H"
/******************************************************************************
* Read a Byte from LCD *
******************************************************************************/
byte lcd_read_byte(void)
{
byte low, high;
SET_TRIS_LCD(LCD_READ); // set data pin to input state (read mode)
LcdPinMapBits.rw = 1; // set to rw to high (read mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set the enable pin to high
#asm nop #endasm // delay for one-clock cycle
high = LcdPinMapBits.data; // get the data from LCD (high nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
#asm nop #endasm // delay for one-clock cycle
low = LcdPinMapBits.data; // get the data from LCD (low nibble)
LcdPinMapBits.enable = 0; // set enable pin to low
SET_TRIS_LCD(LCD_WRITE); // set data pin to output state (write mode)
return ((high << 4) | low); // return result
}
/******************************************************************************
* Send Nibble to LCD *
******************************************************************************/
void lcd_send_nibble(byte n)
{
LcdPinMapBits.data = n; // send a nibble to LCD
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 1; // set enable pin to high
delay_us(2); // delay for 2uSec.
LcdPinMapBits.enable = 0; // set enable pin to low
return;
}
/******************************************************************************
* Send Byte to LCD *
******************************************************************************/
void lcd_send_byte(byte address, byte n)
{
LcdPinMapBits.rs = 0; // set rs pin to low
while (bit_test(lcd_read_byte(),7));
LcdPinMapBits.rs = address; // provide the address to write
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.rw = 0; // set rw pin to low (write mode)
#asm nop #endasm // delay for one-clock cycle
LcdPinMapBits.enable = 0; // set enable pin to low
lcd_send_nibble(n >> 4); // send high nibble to LCD
lcd_send_nibble(n & 0x0F); // send low nibble to LCD
return;
}
/******************************************************************************
* Initialize LCD Display *
******************************************************************************/
void lcd_init(void)
{
byte i;
SET_TRIS_LCD(LCD_WRITE); // set all ports to output state (write mode)
LcdPinMapBits.rs = 0; // set rs pin to low
LcdPinMapBits.rw = 0; // set rw pin to low
LcdPinMapBits.enable = 0; // set enable pin to low
delay_ms(15); // make a 15mSec. delay
for(i=1; i<=3; ++i)
{
lcd_send_nibble(3);
delay_ms(5);
}
lcd_send_nibble(2);
for(i=0; i<=3; ++i)
{
lcd_send_byte(0,LCD_INIT_STRING[i]);
}
for (i=0; i<LCD_SIZE; )
{
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
LCDbuff[i] = 0; i++;
}
return;
}
/******************************************************************************
* Gotoxy LCD Routine *
******************************************************************************/
void lcd_gotoxy(BYTE x, BYTE y)
{
byte address;
if (y != 1)
address = LCD_LINE_TWO; // if not line1 set address to line2
else
address = 0; // set address to line1
address += (x - 1); // increment to next address (line1 or line2)
lcd_send_byte(0,(0x80 | address)); // send to address to write
return;
}
/******************************************************************************
* LCD Display PutChar Routine *
******************************************************************************/
void lcd_putc(char c)
{
if (c == '\f') // clear and write to line1
{
lcd_send_byte(0,1);
delay_ms(2);
return;
}
else if (c == '\n') // write to line2
{
lcd_gotoxy(1,2);
return;
}
else if (c == '\b') // backspace one position (line1 or line2)
{
lcd_send_byte(0,0x10);
return;
}
else
{
lcd_send_byte(1,c);
return;
}
}
/******************************************************************************
* LCD Display GetChar Routine *
******************************************************************************/
char lcd_getc(byte x, byte y)
{
char value;
lcd_gotoxy(x,y); // provide a x,y position
LcdPinMapBits.rs = 1; // set rs pin to high
value = lcd_read_byte(); // get a byte from LCD at x,y position
LcdPinMapBits.rs = 0; // set rs pin to low
return (value); // return the value
}
|
Hope this would help connect your LCD module to a PIC18F452. |
|
|
|
|
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
|