
Originally Posted by
JohnPaul
Code:
' 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 ' <font color=red>disable analog comparators</font color>RA0-RA3 are digital I/O
TRISA = 0 ' PORT A is output
TRISB = 0 ' PORT B is output
<font color = red> Pause 1000</font color>
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
After I posted, I just added following statements to my code. Still no help.
define osc 4 ' Internal OSC 4 MHZ<font color=red> add intrc</font color>
define loader_used 1 ' <font color=red> makes bootloader work</font color>?
@ Device pic16F627A, BOD_ON, LVP_OFF, PWRT_ON, WDT_ON, PROTECT_OFF,<font color=red> INTRC_OSC_NOCLKOUT </font color>
Hello John Paul,
I made some minor tweaks in red above, also be advised RA4 is an open drain output..edit: Oh I see the resistor in your comments, so you got that covered.
JS
Last edited by Archangel; - 21st May 2007 at 09:55.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks