Page 1 of 1

HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 7:34 am
by aazmi1
hello

I am having problem in HP-488 board programming with LCD. Here in LVP The programming is not the same as using 8-bit mode to initialize the LCD.We can use only 4-bits of one port because of Low voltage programing and architecture of HP-488.I have to send MSB first and then LSB using c-programming.I have tried to do possible what i could but in LVP, LCD is not working only one cursor is blinking
Thanks in advance.

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 10:11 am
by Benj
Hello,

Can you disable the low voltage programming in the chip's configuration settings. The LCD should then work fine.

If you need the LVP to be enabled then there is a jumper on the HP488 to connect the LCD to alternate pins. The HP488 datasheet should provide more information regarding this.

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 10:54 am
by aazmi1
Means I will perform PSU?
The thing is I have checked the LCD configuration,
I am using start nibble
RB0 ,1,2,3 for data means(LOWER NIBBLE)
RB4 for RS
RB7 for EN

USING J19 AND J21 to change the default bits for LVP and LCD.
Now in programming I am sending only 4 bits to PORTB.
Previously only one cursor on the LCD was blinking now instead of LCD only LEDs are becoming on.
Why this board is too much complicated :(

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 1:05 pm
by Benj
Hello,

Why are you using LVP with the HP488. I would strongly advise against using this and simply using a 12V PSU with the board. Makes life much simpler and means you get an extra I/O pin for your application. When LVP is enabled it can cause a wide range of problems eg going into programming mode when you are trying to simply run your program.

The LCD on the HP488 is connected in 4-bit mode which means there is less I/O pins required to drive the LCD. This makes designs based on the HP488 schematic much more efficient. There should be plenty of example code available for driving the display in 4 bit mode. If you are still struggling then let us know and I will see if I can dig you out an example. What compiler are you using?

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 2:58 pm
by aazmi1
I am using MPLAB c18.I dont have the adapter right now.
this is my code .This is not the first code I have worked with.
#include <p18f458.h>
#define _XTAL_FREQ 20e6 // 20MHz
#define RS PORTBbits.RB4
#define EN PORTBbits.RB7
void LCD_STROBE(void);
void data(unsigned char);
void cmd(unsigned char);
void string(const char *);
void lcd_init(void);
void delay_us(unsigned int);
///////////////////////////////////////////////////////////////////
void LCD_STROBE(void)
{
EN = 1;
delay_us(0.5);
EN = 0;
}
////////////////////////////////////////////////////////////////////
void data(unsigned char c)
{ RS=1;
delay_us(40);
PORTB = ( c >> 4 );
LCD_STROBE();
PORTB = ( c );
LCD_STROBE();

}
//////////////////////////////////////////////////////////////////
void delay_us(unsigned int numberofmsec)
{
unsigned int j,k;
for (k=0;k<numberofmsec;k++)
for (j=0; j<135; j++) ;
}

//////////////////
void cmd(unsigned char c)
{ RS=0;
delay_us(40);

PORTB = ( c >> 4 );LCD_STROBE();
delay_us(2);
PORTB = ( c );LCD_STROBE();
delay_us(2);
}
/////////////////////////////////////////////////////////////////
void clear(void)
{

cmd(0x1);
delay_us(2);
}
/////////////////////////////////////////////////////////////////
void lcd_init()
{
delay_us(20);
cmd(0x03);
delay_us(200);
cmd(0x03);
delay_us(200);
cmd(0x03);

cmd(0x28 ); // Function set (4-bit interface, 2 lines, 5*7 Pixels)
cmd(0x0c); // Make cursor invisible
clear(); // Clear screen
cmd(0x6); // Set entry Mode
}
////////////////////////////////////////////////////////////////
void string(const char *q)
{
while(*q)
data(*q++);
}
/////////////////////////////////////////////////////////////////


void main()
{
delay_us(100);
PORTB=0;TRISB=0;
TRISC=0b11001111;
delay_us(15);
lcd_init();
////////////////////////////////////////////////////////////////
cmd(0x82);//simply to start display from 3rd column of first row//
//first row start address is 0x80 and second row is 0xC0//
string("HELLO");
cmd(0xC0); //NEXT LINE START ADDRESS//
//string("LCD 4-BIT MODE");

////////////////////////////////////////////////////////////////
while(1);
////////////////////////////////////////////////////////////////
}

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 4:42 pm
by Benj
Hello,

This line of code will not work.

Code: Select all

delay_us(0.5);
You will need to pass integer variables to this function eg 1 or 10.

Code: Select all

delay_us(10);
Also your initialisation seems to be missing a lot of commands. Here is some example code to go on for the initialisation of the LCD in 4-bit mode.

Code: Select all

	delay_us(1200);

	cmd(0x33);
	delay_us(2000);
	cmd(0x33);
	delay_us(2000);
	cmd(0x32);
	delay_us(2000);
	cmd(0x2c);
	delay_us(2000);
	cmd(0x06);
	delay_us(2000);
	cmd(0x0c);
	delay_us(2000);

	//clear the display
	cmd(0x01);
	delay_us(2000);
	cmd(0x02);
	delay_us(2000);

Re: HP-488 board (too much problem)

Posted: Fri Mar 16, 2012 5:02 pm
by aazmi1
taking along time but not working :( sorry to bother it seems this wouldn't work :( thanks any ways

Re: HP-488 board (too much problem)

Posted: Tue May 12, 2015 5:32 pm
by acestu
Hi aazmi1,

You might find this article interesting:

http://www.microchip.com/forums/m640643.aspx

cheers
Stuart