Jump to content
Sign in to follow this  
IceKold0

16f627 44780 Lcd Problem

Recommended Posts

Hi everyone,

 

I'm having some 'reet problems getting any output to a 44780 16x2 LCD driven by a 16F627.

 

I use BoostC with SourceBoost IDE and have also purchased the plug-ins pack.

 

I have spent a good number of days trying to get even a basic "Hello World" output onto the

LCD display on my breadboard circuit.

 

My Schematic is as follows:

 

16F627_HD44780_Schematic.gif

 

Note: My schematic shows that the contrast pin of the 44780 is "not connected" - it IS connected using

a 10K potentiometer that provides an approximate NEGATIVE 2V (-2V).

 

The BoostC code for my 16F627 is as follows:

 

#include <system.h>

#define LCD_ARGS 2, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \
0, /* Use busy signal: 1 = use busy, 0 = use time delays */\
PORTB, TRISB, /* Data port and data port tris register */ \
PORTB, TRISB, /* Control port and control port tris register */ \
0, /* Bit number of control port is connected to RS */ \
2, /* Bit number of control port is connected to RW */ \
1 /* Bit number of control port is connected to Enable */

#include <lcd_driver.h> // include the LCD template code


//Target PIC16F627 configuration word
#pragma DATA _CONFIG, _PWRTE_ON & _WDT_OFF & _XT_OSC & _CP_OFF

//Set clock frequency
#pragma CLOCK_FREQ 4000000

void main()
{
//Configure port A
trisa = 0x00;
//Configure port B
trisb = 0x00;

//Initialize port A
porta = 0x00;
//Initialize port B
portb = 0x00;

cmcon = 7; //disable comparators


//Endless loop
while( 1 ){
	lcd_setup();

	lcd_gotoxy(0,0);
	lprintf( "First line" );
	lcd_gotoxy(0,1);
	lprintf( "Second line" );

	// Flash a LED to check program is running.
	set_bit( portb, 3 );
	delay_ms( 250 );
	clear_bit( portb, 3 );
	delay_ms( 250 );
}
}

 

The program compiles and builds without errors and I then use my programmer to

programme the 16F627.

 

Powering on the circuit I ONLY get the flashing LED - this I have set to show that the program is

running.

 

The LCD shows 2 lines of solid squares.

 

Now, when I debug the code using the SourceBoost IDE plug-ins (alphanumeric plug-in)

I receieve the correct output of:

 

First Line

Second Line

 

on the software LCD.

 

I have played around with the contrast voltages from positive voltages (up to +5V), to tieing the

contrast pin to 0V; and now I have tried it with negative voltages (down to -5V).

 

All the include files are in the correct folders (otherwise it wouldn't compile).

 

Any help would be fantastic... it's part of my final year university project!

 

IceKold0

Share this post


Link to post
Share on other sites

OK,

 

I'm a plonker...

 

The correct pragma configuration word might be helpful...

 

*DOH* *DOH* *DOH*

 

AND

 

The negative voltage to supply the contrast pin? Now positive and working fine 'n' dandy...

 

Sorry guys and girls!

 

At least I'm finding and resolving the problem myself lol!

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...