Truncated match.
PICList
Thread
'4 Bit LCD HD44780 Interface Code'
1998\07\19@214731
by
Taylor Jacob
I am about to start a project for the PIC 16F84 at 10mhz , and I
need to interface with a HD44780 Interface 20x4 LCD screen.. Since I am
using most of the IO Lines on the PIC for other tasks, I can only talk to
the LCD in 4 bit mode (4 io pins for data, 1 for E, 1 for SE, and RS will
tied to ground, since I don't need to read from the LCD..)..
I was wondering if anyone had already written the code to talk to
the LCD, display characters, etc.. If someone would be so kind as to send
that code to me it would save me a good deal of time..
Taylor Jacob
1998\07\19@220435
by
Timothy D. Gray
go to http://www.parallaxinc.com and get the basic stamp manual.
It has detailed info on how to talk to this device in 4 bit mode.
On Sun, 19 Jul 1998, Taylor Jacob wrote:
{Quote hidden}> I am about to start a project for the PIC 16F84 at 10mhz , and I
> need to interface with a HD44780 Interface 20x4 LCD screen.. Since I am
> using most of the IO Lines on the PIC for other tasks, I can only talk to
> the LCD in 4 bit mode (4 io pins for data, 1 for E, 1 for SE, and RS will
> tied to ground, since I don't need to read from the LCD..)..
>
> I was wondering if anyone had already written the code to talk to
> the LCD, display characters, etc.. If someone would be so kind as to send
> that code to me it would save me a good deal of time..
>
> Taylor Jacob
>
1998\07\20@001613
by
Taylor Jacob
> go to http://www.parallaxinc.com and get the basic stamp manual.
> It has detailed info on how to talk to this device in 4 bit mode.
I have the datasheet, I was just wondering if someone already had
the code, and wanted to let me have a copy of it, rather than coding it
myself, and spending time debugging that code..
> > I am about to start a project for the PIC 16F84 at 10mhz , and I
> > need to interface with a HD44780 Interface 20x4 LCD screen.. Since I am
> > using most of the IO Lines on the PIC for other tasks, I can only talk to
> > the LCD in 4 bit mode (4 io pins for data, 1 for E, 1 for SE, and RS will
> > tied to ground, since I don't need to read from the LCD..)..
> >
> > I was wondering if anyone had already written the code to talk to
> > the LCD, display characters, etc.. If someone would be so kind as to send
> > that code to me it would save me a good deal of time..
1998\07\20@033502
by
Philippe
At 21:46 19/07/98 -0400, you wrote:
> I am about to start a project for the PIC 16F84 at 10mhz , and I
>need to interface with a HD44780 Interface 20x4 LCD screen.. Since I am
>using most of the IO Lines on the PIC for other tasks, I can only talk to
>the LCD in 4 bit mode (4 io pins for data, 1 for E, 1 for SE, and RS will
>tied to ground, since I don't need to read from the LCD..)..
You will find ASM file for LCD & 16F84 as well as UMPS project for LCD panel
in UMPS directory: UMPSDEMO\EXAMPLES\16C84
UMPS can be downloaded at:
http://www.sistudio.com/umps
Best regards,
Philippe.
+--------------------------------------------------------+
| Virtual Micro Design |
| Technopole Izarbel, |
| 64210 BIDART |
| FRANCE |
| |
| Phone: ++33 559.438.458 Fax: ++33 559.438.401 |
| |
| E-Mail: spam_OUTp.techerTakeThisOuT
idls.izarbel.tm.fr |
| URL: http://www.sistudio.com/umps |
+--------------------------------------------------------+
1998\07\20@062714
by
Keith Howell
|
Hi Taylor,
I don't know what your app is, but I found in mine that time
spent setting up the data bits and such became considerable.
This is because I have to put text on the screen quickly and
the guy who laid out the PCB put the data bits all over the place!
I'd recommend keeping the LCD data bits grouped together.
All 8-bits in the same port, or 4 bits in D7:4 if 4-bit mode.
This keeps code simple and small.
I prefer 8-bit mode - repeated spaces are needed often to wipe
previous chars. In 8-bit mode you only need to set the data once,
and simply strobe it in multiple times. In 4-bit, you have to
set up '2' then '0' for each space.
I can see how my project could have got 8-bit mode and used less pins,
by having pins doing multiple functions. For example, a data line to
volume attenuators can be used, since it won't affect the volume
unless the strobe for that chip is asserted. There are 7 lines
driving channel indicator LEDs and scanning the keyboard.
These could also be borrowed if the LEDs can be temporarily disabled
(e.g. by 2N7000 FET in the common cathode).
Hope these tips help.
1998\07\21@001418
by
NCS Products
|
At 09:46 PM 7/19/98 -0400, you wrote:
>
> I was wondering if anyone had already written the code to talk to
>the LCD, display characters, etc.. If someone would be so kind as to send
>that code to me it would save me a good deal of time..
If you don't mind Parallax (ack!) code, I just got this running.
Note that I hooked up the LED backlight to ra2 and ra3.
You'll have to adjust 'wait' subroutines, this code works on 16mhz 16F84. :-)
2x16 Display.
; PROGRAM: LCD.SRC
; Taken from Parallax PIC Application Note: Driving a Liquid Crystal Display
; DA - July 9,1998
device pic16c84,hs_osc,wdt_off,protect_off
RS = RA.1 ;REGISTERSELECT - PIN 6 H=DATA
L=INSTRUCTION
E = RA.0 ;ENABLE - PIN 5
data = RB ;Data to LCD
LCDLED1 = RA.2
LCDLED2 = RA.3
count = 9 ;Number of characters in demo string.
char_cnt = 64 ;Number of bytes in custom character
;definition
line1 = 10000001b
line2 = 11000001b
; Declare constants for common LCD instructions. To perform the functions
; listed below, clear bit RS and send #constant to the display. Remember to
set
; RS again before sending characters to the LCD.
clear = 1 ;Clears the display (fills with blanks)
home = 2 ;Returns display to the home position.
shift_l = 24 ;Shifts display to the left.
shift_r = 28 ;Shifts display to the right.
crsr_l = 16 ;Moves cursor to the left.
crsr_r = 20 ;Moves cursor to the right.
blink_c = 11 ;Blinks whole character to indicate
;cursor position.
no_crsr = 8 ;Turns off the cursor.
; Set RAM origin above special registers, declare variables, and set code
; origin.
org 0CH
temp ds 1 ;Temporary counter.
temp2 ds 1
counter ds 1 ;Index variable.
output ds 1 ;data to send
output2 ds 1 ;data to send
org 0
start mov ra, #01100b
mov rb, #0
mov !ra,#0h ;Set control lines to output
mov !rb,#0h ;Set data lines to output
call long_wait
;Initialize LCD: set 4-bit, 1-line
;interface data lenght = 4
;lines = 2
mov output,#0011b
call Iout1
mov output,#0010b
call Iout1
; clear display
mov output,#00000001b
call Iout
;entry mode select
mov output,#00011000b
call Iout
; turn on
mov output, #00001111b
call Iout
; jmp send_msg
; CREATE CUSTOM CHARACTERS
mov output,#01000000b
call Iout
mov counter, #0
:stuff mov w, counter
call my_chars ;Get next byte.
mov output, w ;Write byte to CG RAM.
call Dout
inc counter
cjb counter, #char_cnt, :stuff
clr counter
send_msg mov output, #line1 ;Address ? of DD RAM.
call Iout
:loop mov output,counter
call Dout
inc counter
sb counter.4
jmp :loop
mov output,#line2
call Iout
:loop2 mov output,counter
call Dout
inc counter
snb counter.4
jmp :loop2
jmp send_msg
Iout1 call long_wait ; go slow...
clrb RS ;instruction register
mov rb,output ;send command
setb E
clrb E
ret
Iout call wait ; go slow...
clrb RS ;instruction register
jmp Dout2
;Data out
Dout setb RS ;data register
Dout2 call wait ;go slow...
swap output
mov rb,output ;send MSNybble command
setb E
clrb E
swap output
mov rb,output ;send LSNybble command
setb E
clrb E
ret
long_wait mov temp2,#35
goto wait2
wait mov temp2,#30
wait2 djnz temp,$
djnz temp2,wait2
ret
msg jmp pc+w
retw 'x','D','o','m','1','2','3','4','5','6','7'
my_chars jmp pc+w ;Table of data for custom 'backwards'
;characters.
retw 31,31,0,0,0,0,31,31 ; lines
retw 31,31,31,0,0,31,31,31 ; lines
retw 31,3,3,31,31,3,3,31 ; lines
retw 0,0,31,31,31,31,0,0 ; lines
retw 31,31,7,3,3,7,31,31 ; lines
retw 31,31,3,1,1,3,31,31 ; lines
retw 31,31,3,3,3,3,31,31 ; lines
retw 31,31,17,17,17,17,31,31 ; lines
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...