I've the following code based on a Microchip code example:
There's to notice that I've replaced the BusyXLCD usual function for the ones I'm showing below this paragraph, as the schematic circuit has the R/W pin of the LCD pin grounded and, in any case the original BusyXLCD function doesn't seem to work right for me.
In fact, the original example just modified to have the microcontroller pins that control the display the same as mine , doesn't show anything if not with that portion of code:
I understand that the modifications I've introduced could make the strings to display right or wrong but... I don't see any reason how they can make the LCD display the first character ("1" and "P") at the beginning of each line and not more of them, moreover putsXLCD seemingly is working right (I've entered debug mode and I have seen that it looks like it reads the full strings but just displays the first character).
Any idea of what can be happening? I don't really know what to check.
Thanks.
Code:
#include <p18cxxx.h>
#include "xlcd.h"
#pragma config OSC=INTIO67, FCMEN=ON, WDT=OFF, IESO=ON, XINST=OFF, LVP=OFF
char XLCD_Disp1[] = "1234567890";
char XLCD_Disp2[] = " PIC_UC ";
void main(void)
{
unsigned char config=0xFF,i=0,addr=0,data=0;
ADCON1 = 0xFF;
TRISD = 0;
PORTD = 0;
TRISB = 0; // Port,pin direction configuration
PORTB = 0;
TRISC = 0;
PORTC = 0;
TRISCbits.TRISC7 = 1; // make sure this pin is input
TRISE=0;
config = FOUR_BIT & LINES_5X7;
//******** Configure LCD for four line communication and 5X7 line display *********************************
OpenXLCD(config);
busylcd(); //wait untill LCD controller is busy
//*********** Set the starting address in the LCD RAM for display. This determines the location of display ********
SetDDRamAddr(0x80);
busylcd(); //wait untill LCD controller is busy
putsXLCD(XLCD_Disp1); //Display string of text
busylcd(); //wait untill LCD controller is busy
//********** Set the address in second line for display ****************************************************
SetDDRamAddr(0xC1);
busylcd(); //wait untill LCD controller is busy
putsXLCD(XLCD_Disp2); //Display string of text
busylcd(); //wait untill LCD controller is busy
putcXLCD(0x5F); //dsiplay some chrecter
busylcd(); //wait untill LCD controller is busy
SetDDRamAddr(0x20);
busylcd(); //wait untill LCD controller is busy
while(1); //end of program
}
There's to notice that I've replaced the BusyXLCD usual function for the ones I'm showing below this paragraph, as the schematic circuit has the R/W pin of the LCD pin grounded and, in any case the original BusyXLCD function doesn't seem to work right for me.
Code:
void busylcd(void)
{
LCDDelay();
LCDDelay();
LCDDelay();
}
void LCDDelay(void)
{
int i=0;
for (i=0;i<250;i++);
}
In fact, the original example just modified to have the microcontroller pins that control the display the same as mine , doesn't show anything if not with that portion of code:
Code:
TRISD = 0;
PORTD = 0;
TRISB = 0; // Port,pin direction configuration
PORTB = 0;
TRISC = 0;
PORTC = 0;
TRISCbits.TRISC7 = 1; // make sure this pin is input
TRISE=0;
I understand that the modifications I've introduced could make the strings to display right or wrong but... I don't see any reason how they can make the LCD display the first character ("1" and "P") at the beginning of each line and not more of them, moreover putsXLCD seemingly is working right (I've entered debug mode and I have seen that it looks like it reads the full strings but just displays the first character).
Any idea of what can be happening? I don't really know what to check.
Thanks.
Last edited: