PDA

View Full Version : 4-Line LCD and 18F4620



fowardbias
- 11th October 2007, 03:44
I moved from a 16F877 to a 18F4620 and can't get the latter to work. The 877 programs in 4 or 8 bit modes and is 100%. The 4620 shows only 2 lines all blanked dark. The only difference between the two codes is the config setup since the 4620 has to use the MPASM for assembly. I ran a blink test with the current config settings and it was OK. I have tried 4-bit and 8-bit modes, same result. The 4620 is the same pinout as the 877 except the 4620 has a couple of pins multiplexed for other uses. Is there something simple I am overlooking?

mackrackit
- 11th October 2007, 04:21
With out more info the contrast pin on the LCD needs looked at.

GrandPa
- 12th October 2007, 14:36
Works for me with a 18F4620


DEFINE LCD_LINES 4
define LCD_DREG PORTD
DEFINE LCD_RSREG PORTC
DEFINE LCD_RSBIT 0
DEFINE LCD_EREG PORTC
DEFINE LCD_EBIT 2

You may need to change this according to actual pins used. Would be easier to get more help if you post (at least) the defines your actually using.


J-P

fowardbias
- 13th October 2007, 00:38
Here are the DEFINES for the 4620

DEFINE OSC 4 'OSC IS 4Mhz.
DEFINE LCD_DREG PORTB 'DATA BUS IS DB4,DB5,DB6,DB7 = RB4,RB5,RB6,RB7
DEFINE LCD_DBIT 4 'STARTING BIT IS RB4, PIN #37
DEFINE LCD_RSREG PORTA 'REGISTER SELECT PORT IS PORTA
DEFINE LCD_RSBIT 0 'REGISTER SELECT BIT IS RA0,PIN #2
DEFINE LCD_EREG PORTD 'LCD ENABLE PORT IS PORTD
DEFINE LCD_EBIT 2 'LCD ENABLE BIT IS RD2,PIN #21
DEFINE LCD_BITS 4 'TOTAL DATA BUS WIDTH IS FOUR BITS
DEFINE LCD_LINES 4 'TOTAL LINES OF LCD IS FOUR
DEFINE LCD_COMMANDUS 2000 'COMMAND DELAY TIME IN MICROSECONDS
DEFINE LCD_DATAUS 50 'DATA DELAY TIME IN MICROSECO

I have tried other port combinations with the same results.
First off, sorry for posting in the wrong area. Let me back up to the 877 which was 100% perfect untill I tried to change the ENABLE port and ran into this error:INTERNAL[402]ATTEMPT TO POP EMPTY SYMBOL TABLE STACK. Don't know what is going on here? I tried another code for a 16F628 which was a simple and sound blink routine and got the same error. I thought I would post first before trying a restart and checking the MCS site for error codes. Nothing is simple in micro land.

Bruce
- 15th October 2007, 01:52
The only difference between the two codes is the config setup
This would be part of the problem at least. The 18F4620 has A/D inputs on several
port pins you're using to control the LCD.

RB4 is AN11. RA0 is AN0. ADCON1 = 15 disables A/D so you can use these pins for
digital I/O.

I've never seen the internal 402 error, but a re-install should take care of it.

fowardbias
- 15th October 2007, 03:43
Tried a reinstall , uninstall and install same-o, same-o. The question I have is: Is error 402 a lock up event meaning the programmer is bad and will need replacement. I hope MeLabs likes me. I will try turning off the comparators later. A positive side of all this is I had time to learn more about the drawing program in Eagle.

Bruce
- 15th October 2007, 22:14
I've never seen the 402 error. I can only find referrence to it in the PM assembler text. I don't think this error has anything to do with the device programmer, but I would for sure contact MeLabs on this one.