PDA

View Full Version : PIC18F442-LCD problems



Samoele
- 15th November 2006, 20:14
I made circuit with PIC16F876 and used following definitions:


DEFINE osc 4

DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

LCD is working proper.

After this I changed MCU, instead of PIC16F876 I put PIC18F442 and changed DEFINE osc 20 and made configuration HS mode on oscillator.

In program it was also used INT0 PIN on port B.

LCD does not display anything, all other subprograms are working correct. Do I have to change any register on port B? Does somebody know what is the problem or why this problem occur?

Thank you for your help.

Kind regards.

Samo

sayzer
- 15th November 2006, 20:31
A possibility : If you changed the power supply also, meaning that if you are using this new PIC in another circuit, then the contrast level of LCD has also changed; thus you get either too dim or too dark on LCD.

Adjust the contrast pot.



----------------------------

Archangel
- 15th November 2006, 20:36
I made circuit with PIC16F876 and used following definitions:


DEFINE osc 4

DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2

LCD is working proper.

After this I changed MCU, instead of PIC16F876 I put PIC18F442 and changed DEFINE osc 20 and made configuration HS mode on oscillator.

In program it was also used INT0 PIN on port B.

LCD does not display anything, all other subprograms are working correct. Do I have to change any register on port B? Does somebody know what is the problem or why this problem occur?

Thank you for your help.

Kind regards.

Samo


In program it was also used INT0 PIN on port B.
If I understand correctly you have port B set as inputs, they must be set as outputs for the LCD to work. TRISB = %00000000 or if you need to use the leftover bits as inputs then TRISB = %00000011
JS

mister_e
- 15th November 2006, 21:16
is LVP fuse is set to OFF too?

Before programming your PIC, make sure your device programmer program those fuses settings.