Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 7th December 2007, 07:52 AM   (permalink)
Default HD44780 LCD operation

I'm having problems with my LCD (both in real life and simulator) on a
PIC18F system not showing anything, after ensuring that the hardware
is connected properly. I'm beginning to suspect that either my
sequence of operations on the LCD during the initialization before
writing anything isn't done properly, or the timing of the command
functions that I have called (those functions are built-in with mikroC
development suite) aren't proper for my LCD (even though their library
functions are said to be for HD44780 compatible LCDs). It would
fantastic if someone replies on the basic sequence of operations that
I should be instructing the LCD in order for it to work. I have
basically initialized in the program where the data port, RS, Enable,
and R/W pins are connected, turn on the LCD module, clear the display,
turn the cursor display/blinking off, and return the cursor to top
left corner. Thanks!
ssylee is offline  
Old 7th December 2007, 07:57 AM   (permalink)
Default

The mikroC libararies work fine... I've tested them. Check your connections, your contrast, and make sure you have Digital IO for the PIC pins feeding the LCD. If you want to look at some mikroC LCD source code, I wrote a program that writes the modules and functions based on your pin assignments. It helps optimize the code and speeds up the processes:

http://www.mikroe.com/en/projects/download/lcd4.zip

Last edited by wschroeder; 7th December 2007 at 08:01 AM.
wschroeder is offline  
Old 7th December 2007, 08:00 AM   (permalink)
Default

I have my ADCON1 register to be 0x0e or I believe to be using AN0 only. Also, TRISx = 0x01 would make all the bits 1-7 output and bit 0 input.
ssylee is offline  
Old 7th December 2007, 08:14 AM   (permalink)
Default

I have posted a thread on http://www.mikroe.com/forum/viewtopic.php?t=12630 . It has the link to the project folder that I'm having trouble with if you're interested in seeing more details. Does mikroC functions on the LCD incorporate the delays, or do I have to incorporate them myself?
ssylee is offline  
Old 7th December 2007, 08:37 AM   (permalink)
Default

Deleted by my me as the OP has given his version of c code at the site mentioned.
__________________
Regards,
Sarma.

Last edited by mvs sarma; 7th December 2007 at 08:45 AM.
mvs sarma is offline  
Old 7th December 2007, 07:08 PM   (permalink)
Default

What's deleted by my me?
ssylee is offline  
Old 8th December 2007, 05:01 AM   (permalink)
Default

Quote:
Originally Posted by ssylee
What's deleted by my me?
i did't see your post completely and the message was posted by me. Hence i have reoved the content that i posted.
you have provided details, and i was able to see them-as such no issues onwhat you posted, Please
__________________
Regards,
Sarma.
mvs sarma is offline  
Old 8th December 2007, 06:25 AM   (permalink)
Default

I have one more question, more of a conceptual one: what is the advantage of operating the LCD in 4-bit mode rather than 8-bit mode besides reduction of the amount of pins used on the microcontroller?
ssylee is offline  
Old 8th December 2007, 06:54 AM   (permalink)
Default

Quote:
Originally Posted by ssylee
I have one more question, more of a conceptual one: what is the advantage of operating the LCD in 4-bit mode rather than 8-bit mode besides reduction of the amount of pins used on the microcontroller?
The only advantage is the reduction in the number of pins. The only disadvantage is slightly slower code. A lot of people don't connect the RW line to save 1 more pin and use a delay after each write to the LCD. Using 6 pins instead of 11 can be the difference between an 18 and a 28 pin pic.

Mike.
Pommie is online now  
Old 8th December 2007, 08:36 AM   (permalink)
Default

I'm using a 28-pin PIC. I also have 40 pin PICs available. How much slower code execution would 4-pin mode compared to 8-bit mode?
ssylee is offline  
Old 8th December 2007, 08:55 AM   (permalink)
Default

Quote:
Originally Posted by ssylee
I'm using a 28-pin PIC. I also have 40 pin PICs available. How much slower code execution would 4-pin mode compared to 8-bit mode?
Not even noticeable. You're already waiting constantly for the LCD anyway. They're pretty slow.
__________________
=========================
Futz's Microcontrollers & Robotics
=========================
futz is online now  
Old 8th December 2007, 09:01 AM   (permalink)
Default

Quote:
Originally Posted by ssylee
I'm using a 28-pin PIC. I also have 40 pin PICs available. How much slower code execution would 4-pin mode compared to 8-bit mode?
Very little difference, it's the difference between,
Code:
		movfw	Data
		movwf	PortB
and,

Code:
		movfw	Data
		movwf	PortB
		bsf	PORTB,LCD_E
		bcf	PORTB,LCD_E
		swapf	Data,W
		movwf	PortB
		bsf	PORTB,LCD_E
		bcf	PORTB,LCD_E
So about 6 instructions per character. Completely irrelevant compared to the LCD internal timing which is 40uS for a character write.

Mike.
Pommie is online now  
Old 8th December 2007, 09:03 AM   (permalink)
Default

If I have want to data log something, should I use one microcontroller for the LCD and one for datalogging using a separate microcontroller?
ssylee is offline  
Old 8th December 2007, 09:09 AM   (permalink)
Default

It depends on the speed of logging. If it's less than a few 100 bytes per second then the pic would be able to do both. What are you logging?

Keep in mind that if you are writing to EEPROM then it takes around 6mS per byte.

Mike.
Pommie is online now  
Old 8th December 2007, 04:54 PM   (permalink)
Default

ssylee,

You never said whether you got the LCD working with mikroC.
wschroeder is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
LCD 2x16 Demo for the Unicorn (18F4550) blueroomelectronics Micro Controllers 21 31st October 2008 05:17 PM
HD44780 lcd help jay543_uk Micro Controllers 12 8th November 2007 04:26 PM
Question about Inchworm+ Quan Micro Controllers 54 28th October 2007 01:21 AM
LCD Troubles Kyle-s4h Micro Controllers 13 11th September 2007 01:30 PM
PLL WITH PIC AND TSA5511 savnik Micro Controllers 21 29th May 2006 03:39 PM



All times are GMT. The time now is 02:15 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker