Hello, everyone.
I am new to this forum. I am so happy to see so many people helping out others. I wish I could be of help myself in the future.
I have been tracking problems in HD44780. I think this could be the closest problem solved that is relevant to my problem.
I have two HD44780 that I am currently getting to work. One is a 16x2 and another 20x4. I am using Pic Basic Pro & PIC16F627A. I pick this chip because I would like to simplify without the External Osc components. I am currently using a solderless breadboard.
Currently,
for the 16x2, I got 16 blocks on first line and blank on 2nd line.
for the 20x4, I am getting 20 blocks of 1st & 3rd lines, rest are blank.
So far, my code is
' HD44780 LCD MODULE
' Pin 1: VSS 0V(Ground)
' Pin 2: VDD Power Supply for logic
' Pin 3: V0 Power Supply for LCD Driver (5k Potentiometer for Contrast)
' Pin 4: RS Data / Instruction register select (10k Resistor)
' Pin 5: R/W Read/Write select
' Pin 6: E Read/Write enable strobe
' Pin 11-14: DB0-7 Data bus (LSB)
' Pin 15: LED Backlight (5.0v)
' Pin 16: LED Backlight (0v)
'
' PIC16F627A
' Pin 1: RA2 LCD DB6
' Pin 2: RA3 LCD DB7
' Pin 3: RA4 LCD RS (10k Voltage Pullup to +5v)
' Pin 5: VSS Ground
' Pin 9: RB3 LCD E
' Pin 14: VDD
' Pin 17: RA0 LCD DB4
' Pin 18: RA1 LCD DB5
'
' LCD Definition
DEFINE LCD_DREG PORTA ' Set LCD Data port
DEFINE LCD_DBIT 0 ' Set starting Data bit (0 or 4) if 4-bit bus
DEFINE LCD_RSREG PORTB ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTB ' Set LCD Enable port
DEFINE LCD_EBIT 3 ' Set LCD Enable bit
DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
DEFINE LCD_LINES 2 ' Set number of lines on LCD
' DEFINE LCD_LINES 4 ' Set number of lines on LCD
DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us
DEFINE LCD_DATAUS 50 ' Set data delay time in us
CMCON = 7 ' RA0-RA3 are digital I/O
TRISA = 0 ' PORT A is output
TRISB = 0 ' PORT B is output
RPT:
LCDOUT $FE,1 ' Clear LCD
LCDOUT $FE, $0C 'Cursor off
LCDOUT $FE, $0F ' Blinking cursor on
PAUSE 500 ' Wait 0.5 second for LCD to startup
' For 16x2 LCD
LCDOUT $FE,2, "Hello." ' Display 1st Line
LCDOUT $FE,$C0, "World." ' Display 2nd Line
' For 20x4 LCD
' LCDOUT $FE,2, "Hello." ' Display 1st Line
' LCDOUT $FE,$C0, "World." ' Display 2nd Line
' LCDOUT $FE,$94, "Line 3" ' Display 3rd Line
' LCDOUT $FE,$D4, "Line 4" ' Display 4th Line
PAUSE 10000 ' Wait 10 second
GOTO RPT ' Repeat
END ' End of program
I think based on code below. It appear that I am missing
define osc 20
define loader_used 1
@ Device pic16F877A, HS_OSC, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
for 16F627, what should my parameters be?
define osc 4 ? for pic16f627a
What is the usage for all these statements? Are they all required?
Can someone kindly explain? And show me where these material (an perhaps more) are documented?
Also, do I still need the following three PBP statements. Are they redundant with the DEFINE statements?
CMCON = 7 ' RA0-RA3 are digital I/O
TRISA = 0 ' PORT A is output
TRISB = 0 ' PORT B is output
What is the best way to test if my internal OSC function is working?
Since I am so new to all the elements, can someone tell me where how to pin down my LCD problem(s). Any help would be greatly appreciated.
Hello, everyone.
After I posted, I just added following statements to my code. Still no help.
define osc 4 ' Internal OSC 4 MHZ
define loader_used 1 ' ?
@ Device pic16F627A, HS_OSC, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF
I am also new to both pic chip and LCD module. I have used voltmeter to check the voltages at each point. How do I conduct proper hardware check. I have been through many times on regarding the pin / wiring connection. How do I know if my chip is defective? How do I know if my LCD is defective? Thank you for reading.
John Paul
Michigan
Bookmarks