Jump to content


Photo

Hd44780 Lcd Woes...


3 replies to this topic

#1 Gues7

Gues7

    Newbrie

  • EstablishedMember
  • 8 posts
  • Gender:Male
  • Location:Ireland

Posted 12 December 2007 - 11:21 PM

I have been trying to get the LCD Driver routines working on the PIC16F684 (Which is properly defined in the project file) however, when executing the lcd_setup(), lcd_clear() and lprintf() functions I get errors, the lcd_driver.h file is definitely included. I have also checked the lcd sample project to ensure I wasnt missing any other header or library files from the project, I dont believe I am...

The code I am using is:
/*

BoostC HD44780 Interface

*/

#include <system.h>
#include <lcd_driver.h>

//#prgama CLOCK_FREQ 8000000
#pragma DATA _CONFIG, _BOD_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & 0x3FFC & _HS_OSC & _CP_OFF & _IESO_OFF & _FCMEN_OFF & _CPD_OFF
/*						1			2			3			4			5				6			7			8			9			10
	1&#58; BROWNOUT DETECT DISABLED
	2&#58; MCLR DISABLED
	3&#58; POWER UP TIMER ENABLED
	4&#58; WATCH DOG TIMER DISABLED
	5&#58; INTERNAL OSC, NO OUTPUT
	6&#58; HIGH SPEED OSC
	7&#58; CODE PROTECT DISABLED
	8&#58; INTERNAL/EXTENRAL SWITCHOVER DISABLED
	9&#58; FAIL SAFE CLOCK MONITOR DISABLED
	10&#58; EEPROM CODE PROTECT DISABLED */

#define LCD_ARGS	 2, 1, portc, trisc, porta, trisa, 0, 1, 2
/*				   1  2  3	  4	  5	  6	  7  8  9
	1&#58; 4BIT INTERFACE MODE, NOW NIBBLE
	2&#58; USE BUSY SIGNAL, NOT DELAYS
	3&#58; USE PORTC FOR DATA REGISTER
	4&#58; THE TRIS ADDRESS FOR PORTC
	5&#58; USE PORTA FOR CONTROL REGISTER
	6&#58; THE TRISS ADDRESS FOR PORTA
	7&#58; BIT NUMBER OF CONTROL PORT FOR RS
	8&#58; BIT NUMBER OF CONTROL PORT FOR RW
	9&#58; BIT NUMBER OF CONTROL PORT FOR EN */

void main&#40;void&#41;{
	cmcon0 = 0;		//DISABLE COMPARATORS
	adcon1 = 14;
	porta = 0;		//CLEAR PORTA
	portc = 0;		//CLEAR PORTC
	
	//char myString&#91;5&#93; = &#91;&#39;G&#39;, &#39;u&#39;, &#39;e&#39;, &#39;s&#39;, &#39;7&#39;&#93;;		//THE STRING TO BE OUTPUT
	int i;
	
	lcd_setup&#40;&#41;;	//ENSURE EVERYTHING IS READY FOR THE LCD
	lcd_clear&#40;&#41;;	//CLEAR THE LCD
		
	for&#40;i=0; i<=4; i++&#41; {	//LOOP THROUGH THE ELEMENTS IN THE ARRAY
		lprintf&#40;&#34;Gues7&#34;&#41;;	//AND PRINT THEM TO THE LCD
	}//rof
	
	while&#40;1&#41;;
	
}//naim

And the errors I receive are:

Building...
BoostC Optimizing C Compiler Version 6.81 (for PIC16 architecture)
http://www.sourceboost.com
Copyright© 2004-2007 Pavel Baranov
Copyright© 2004-2007 David Hobday

Licensed to MAPL50468 under Single user Standard License for 1 node(s)
Limitations: PIC12,PIC16 max code size:4096 words, max RAM banks:Unlimited, Non commercial use only


HD44780.c

failure
C:\Program Files\SourceBoost\Samples\C\BoostC\myProjects\HD44780.c(46:2): error: failed to generate expression
C:\Program Files\SourceBoost\Samples\C\BoostC\myProjects\HD44780.c(47:2): error: failed to generate expression
C:\Program Files\SourceBoost\Samples\C\BoostC\myProjects\HD44780.c(50:2): error: failed to generate expression
"C:\Program Files\SourceBoost\boostc.pic16.exe" HD44780.c -t PIC16F684
Exit code was 1.
Removing target: HD44780.obj
Failed to locate output file 'C:\Program Files\SourceBoost\Samples\C\BoostC\myProjects\HD44780.hex'
Done

Failed


At the minute, I am just trying to learn all og the functions of the BoostC libraries so in the event of having to use them, I can do it in a snap, any help on the matter would be much appreciated.

Thanks :P


Also... just an FYI for Dave, I got an error regarding _INTRC_OSC_NOCLK when I was using it in my device configuration... so I read the value out of the header file and that works without a problem... it seems the compiler had not got _INTRC_OSC_NOCLK defined, although it IS in the header file, and it IS spelled correctly (first thing I checked)

#2 Gues7

Gues7

    Newbrie

  • EstablishedMember
  • 8 posts
  • Gender:Male
  • Location:Ireland

Posted 17 December 2007 - 06:03 PM

Anyone have any ideas? I've tried a load of things such as including the header files in the project, copying the template out into it... I cant find any significant difference between this and the example...

Thanks in advance :P

#3 Carlos

Carlos

    Regular

  • EstablishedMember
  • Pip
  • 58 posts

Posted 17 December 2007 - 09:54 PM

Here is my basic template when working with the 684 chip.

It may be of some help to you...... :P

Attached File  LCD_684.txt   4.03K   63 downloads

#4 Gues7

Gues7

    Newbrie

  • EstablishedMember
  • 8 posts
  • Gender:Male
  • Location:Ireland

Posted 18 December 2007 - 01:45 AM

Many thanks Carlos, it is indeed working now, it appears the #define arguments for the lcd display must be included BEFORE the #include <lcd_driver.h>.

Also, there is an error in my #define LCD_ARGS thingy :P

Thanks Carlos!



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users