HP-488 board (too much problem)

Forum for users of the CoCo software produced by Matrix Multimedia in conjunction with Commotion Group.

Moderators: Benj, Mods

Post Reply
aazmi1
Posts: 7
Joined: Sat Mar 10, 2012 9:14 am
Contact:

HP-488 board (too much problem)

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HP-488 board (too much problem)

Post 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.

aazmi1
Posts: 7
Joined: Sat Mar 10, 2012 9:14 am
Contact:

Re: HP-488 board (too much problem)

Post 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 :(

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HP-488 board (too much problem)

Post 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?

aazmi1
Posts: 7
Joined: Sat Mar 10, 2012 9:14 am
Contact:

Re: HP-488 board (too much problem)

Post 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);
////////////////////////////////////////////////////////////////
}

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: HP-488 board (too much problem)

Post 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);

aazmi1
Posts: 7
Joined: Sat Mar 10, 2012 9:14 am
Contact:

Re: HP-488 board (too much problem)

Post by aazmi1 »

taking along time but not working :( sorry to bother it seems this wouldn't work :( thanks any ways

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: HP-488 board (too much problem)

Post by acestu »

Hi aazmi1,

You might find this article interesting:

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

cheers
Stuart
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

Post Reply