1X16 dot matrix problems
Archiver
Posts: 46,084
Is anyone can help me on the following problem,
I am using a BS2 and a 1X16 DOT MATRIX LCD that is connected to a
HT595 serial controller. Everything work fine apart that my LCD shows
only the first 8 digits. I am using the program called LCD_595
created by Jon Williams. The only modification I made t it was the
connection to the HCT595 as follow.
SData CON 0+3 ' 74HC595 serial data (14)
Clk CON 1+3 ' 74HC595 shift clock (11)
Latch CON 2+3 ' 74HC595 output latch (12)
The commands worked fine as far clear the screen, move the cursor,
etc. but it does it only on the first 8 digits.
My second question that all the examples I have seen is the message
sent to the LCD were downloaded from the EEPROM how do you send let
say a variable value to the LCD. Do you have to send them only one
byte at the time?
Please help
I am using a BS2 and a 1X16 DOT MATRIX LCD that is connected to a
HT595 serial controller. Everything work fine apart that my LCD shows
only the first 8 digits. I am using the program called LCD_595
created by Jon Williams. The only modification I made t it was the
connection to the HCT595 as follow.
SData CON 0+3 ' 74HC595 serial data (14)
Clk CON 1+3 ' 74HC595 shift clock (11)
Latch CON 2+3 ' 74HC595 output latch (12)
The commands worked fine as far clear the screen, move the cursor,
etc. but it does it only on the first 8 digits.
My second question that all the examples I have seen is the message
sent to the LCD were downloaded from the EEPROM how do you send let
say a variable value to the LCD. Do you have to send them only one
byte at the time?
Please help
Comments
techchem@i... writes:
> Is anyone can help me on the following problem,
> I am using a BS2 and a 1X16 DOT MATRIX LCD that is connected to a
> HT595 serial controller. Everything work fine apart that my LCD shows
> only the first 8 digits. I am using the program called LCD_595
> created by Jon Williams. The only modification I made t it was the
> connection to the HCT595 as follow.
>
> SData CON 0+3 ' 74HC595 serial data (14)
> Clk CON 1+3 ' 74HC595 shift clock (11)
> Latch CON 2+3 ' 74HC595 output latch (12)
>
> The commands worked fine as far clear the screen, move the cursor,
> etc. but it does it only on the first 8 digits.
> My second question that all the examples I have seen is the message
> sent to the LCD were downloaded from the EEPROM how do you send let
> say a variable value to the LCD. Do you have to send them only one
> byte at the time?
> Please help
Your display is actually a two-line module, physically configured as one line
(a headache). To display past the middle, you have to move the DDRam pointer
to line two, then continue printing. It's likely that the address of line
two (your ninth character in the display) is $40.
-- Jon Williams
-- Dallas, TX
Stamp1
char = DDRAM + $40
gosub lcdcmd
--- In basicstamps@egroups.com, jonwms@a... wrote:
> In a message dated 8/17/00 8:06:41 AM Central Daylight Time,
> techchem@i... writes:
>
> > Is anyone can help me on the following problem,
> > I am using a BS2 and a 1X16 DOT MATRIX LCD that is connected to
a
> > HT595 serial controller. Everything work fine apart that my LCD
shows
> > only the first 8 digits. I am using the program called LCD_595
> > created by Jon Williams. The only modification I made t it was
the
> > connection to the HCT595 as follow.
> >
> > SData CON 0+3 ' 74HC595 serial data (14)
> > Clk CON 1+3 ' 74HC595 shift clock (11)
> > Latch CON 2+3 ' 74HC595 output latch (12)
> >
> > The commands worked fine as far clear the screen, move the
cursor,
> > etc. but it does it only on the first 8 digits.
> > My second question that all the examples I have seen is the
message
> > sent to the LCD were downloaded from the EEPROM how do you send
let
> > say a variable value to the LCD. Do you have to send them only
one
> > byte at the time?
> > Please help
>
> Your display is actually a two-line module, physically configured
as one line
> (a headache). To display past the middle, you have to move the
DDRam pointer
> to line two, then continue printing. It's likely that the address
of line
> two (your ninth character in the display) is $40.
>
> -- Jon Williams
> -- Dallas, TX
writes:
Stamp1
char = DDRAM + $40
gosub lcdcmd
This looks like some of my code....hmmm. ·Anyway, here's the entire BS1
listing -- just so you have everything you need.
-- Jon Williams
-- Dallas, TX
' Listing 3
' Stamp Applications: Nuts & Volts, September 1997
'
[noparse][[/noparse] Title ]
'
' File...... LCDDEMO2.BAS
' Purpose... Stamp 1 -> Multi-line LCD (4-bit interface)
' Author.... Jon Williams
' E-mail.... jonwms@aol.com
' WWW....... http://members.aol.com/jonwms
' Started... 16 JUL 1994
' Updated... 25 JUL 1997
'
[noparse][[/noparse] Program Description ]
'
' This program demonstrates the various standard features of a 2x16 LCD
' display that uses the Hitachi HD44780 controller.
'
' LCD Connections:
'
' LCD ·······(Function) ········Stamp
'
········
' pin 1 ········Vss ············Gnd
' pin 2 ········Vdd ············+5
' pin 3 ········Vo ·············wiper of 10K pot
' pin 4 ········RS ·············Pin 4
' pin 5 ········R/W ············Gnd
' pin 6 ········E ··············Pin 5
' pin 7 ········DB0 ············Gnd
' pin 8 ········DB1 ············Gnd
' pin 9 ········DB2 ············Gnd
' pin 10 ·······DB3 ············Gnd
' pin 11 ·······DB4 ············Pin 0
' pin 12 ·······DB5 ············Pin 1
' pin 13 ·······DB6 ············Pin 2
' pin 14 ·······DB7 ············Pin 3
'
[noparse][[/noparse] Revision History ]
'
' 16 JUL 94 : Version 1.0 - compilation of code from last 3 months
' 08 AUG 96 : Trimmed code to save space -- no performance changes!
' 25 JUL 97 : Updated for Nuts & Volts
'
[noparse][[/noparse] Constants ]
'
SYMBOL ·RS ·····= 4 ····················' Register Select (1 = char)
SYMBOL ·E ······= 5 ····················' LCD enable pin ·(1 = enabled)
' LCD control characters
'
SYMBOL ·ClrLCD ·= $01 ··················' clear the LCD
SYMBOL ·CrsrHm ·= $02 ··················' move cursor to home position
SYMBOL ·CrsrLf ·= $10 ··················' move cursor left
SYMBOL ·CrsrRt ·= $14 ··················' move cursor right
SYMBOL ·DispLf ·= $18 ··················' shift displayed chars left
SYMBOL ·DispRt ·= $1C ··················' shift displayed chars right
SYMBOL ·DDRam ··= $80 ' Display Data RAM control
SYMBOL Line1 = $00 ' starting address of line 1
SYMBOL Line2 = $40 ' starting address of line 2
'
[noparse][[/noparse] Variables ]
'
SYMBOL ·char ···= B1 ···················' character sent to LCD
SYMBOL ·index ··= B2 ···················' loop counter
'
[noparse][[/noparse] EEPROM Data ]
'
EEPROM ("This is Line 1") ' preload EEPROM with messages
EEPROM ("This is Line 2")
'
[noparse][[/noparse] Initialization ]
'
Init: Dirs = %00111111 ···············' set 0-5 as outputs
Pins = %00000000 ···············' clear the pins
' Initialize the LCD (Hitachi HD44780 controller)
'
LCDini: PAUSE 500 ······················' let the LCD settle
Pins = %0011 ···················' 8-bit mode
PULSOUT E, 1
PAUSE 5
PULSOUT E, 1
PULSOUT E, 1
Pins = %0010 ···················' 4-bit mode
PULSOUT E, 1
char = %00101000 ···············' 2-line mode
GOSUB LCDcmd
char = %00001100 ···············' disp on, crsr off, blink off
GOSUB LCDcmd
char = %00000110 ···············' inc crsr, no disp shift
GOSUB LCDcmd
'
[noparse][[/noparse] Main Code ]
'
Start: char = ClrLCD ' clear LCD, home cursor
GOSUB LCDcmd
PAUSE 1000
L1: FOR index = 0 TO 13
·READ index, char ' get character from EEPROM
·GOSUB LCDwr ··················' write it
·PAUSE 50 ·····················' delay between chars
NEXT
PAUSE 2000 ·····················' wait 2 seconds
char = DDRam + Line2 ' move to line 2
GOSUB LCDcmd
L2: FOR index = 14 TO 27
·READ index, char
·GOSUB LCDwr
·PAUSE 50
NEXT
PAUSE 2000
GOTO Start
'
[noparse][[/noparse] Subroutines ]
'
' Send command to the LCD
'
LCDcmd: LOW RS ·························' enter command mode
' ·then write the character
' Write ASCII char to LCD
'
LCDwr: Pins = Pins & %11010000 ········' save 7, 6 and RS; clear bus
Pins = char / 16 | Pins ········' output high nibble
PULSOUT E, 1 ' strobe the Enable line
Pins = Pins & %11010000
Pins = char & $0F | Pins ·······' output low nibble
PULSOUT E, 1
HIGH RS ························' return to character mode
RETURN[/font]