Truncated match.
PICList
Thread
'LCD problem'
1997\02\03@070833
by
Greg Marchokov
>>
>> Hi PICers,
>> I have a trouble. A big trouble. I want to hook a LCD module to pic16c84.
>> I build a schematics - it uses 8 bit interface. I get Microchip application
>> note AN??? (sorry can't remember the number). I port it for 16c84, program
>> the chip and ...nothing happens. I use 2x20 LCD with LED backlight, so I
>> carefully examine LCD data sheet - it says Vo (LCD driving voltage) must be
>> 0..5V, use 10K-20K pot between 5v and ground - well evereting was OK. After
>> that I wrote a simple program that tests every line - evereting was OK,
>> but LCD still displays nothing - only the backlite is on but LCD is empty.
>
Hi PICers. It's me again. Thanks to all who reply. Finally I solve the problem.
I change the LCD and it WORKS, so I think the old LCD is gone.
Best regards,
Greg
1997\02\03@152301
by
Tim Kerby
|
Does your code hang the lcd off one port (port b). I desperately need some
code that frees porta completely but uses lcd on port b.
Thanks
Tim
At 13:07 03/02/97 +0200, you wrote:
{Quote hidden}>>>
>>> Hi PICers,
>>> I have a trouble. A big trouble. I want to hook a LCD module to pic16c84.
>>> I build a schematics - it uses 8 bit interface. I get Microchip application
>>> note AN??? (sorry can't remember the number). I port it for 16c84, program
>>> the chip and ...nothing happens. I use 2x20 LCD with LED backlight, so I
>>> carefully examine LCD data sheet - it says Vo (LCD driving voltage) must be
>>> 0..5V, use 10K-20K pot between 5v and ground - well evereting was OK. After
>>> that I wrote a simple program that tests every line - evereting was OK,
>>> but LCD still displays nothing - only the backlite is on but LCD is empty.
>>
> Hi PICers. It's me again. Thanks to all who reply. Finally I solve the
problem.
>I change the LCD and it WORKS, so I think the old LCD is gone.
>
>Best regards,
> Greg
>
------------------------------------------------------------------
If you can read this, it is the end of the message!
My web pages are at http://web.ukonline.co.uk/members/tim.kerby/
My PIC site is at web.ukonline.co.uk/members/tim.kerby/pic/
It needs your projects!
------------------------------------------------------------------
1997\02\03@231226
by
David W. Duley
|
In a message dated 97-02-03 15:24:51 EST, you write:
<<
Does your code hang the lcd off one port (port b). I desperately need some
code that frees porta completely but uses lcd on port b.
Thanks
Tim >>
Tim,
I have used this routine with some success, It uses only the portB on a
16C84.
It is in the form of an include file.
In your source just put : Include LCD4.h.
It is a derivative (if not a direct copy) of the MCHIP app note.
Hope this helps
David Duley
V.P. DreiTek Inc.
;************************************************************
;Use this file for 4 bit LCD interfaces
;************************************************************
lcddata equ Port_B ; these two lines make it easy to port LCD
lcdcntrl equ Port_A ; routines to the PIC 57 or whatever.
LCD_DATA equ lcddata
LCD_CNTL equ lcdcntrl
;************************************************************
; Bit Definitions
;************************************************************
E equ 2 ;LCD enable strobe
RS equ 3 ;LCD register select
RW equ 4 ;LCD read write select
lcd_strobe equ 03fh ;LCD strobe pulse width
number_of_chars equ .20 ;# of characters on line
Disp_On equ 0x00C ;Display on
Disp_On_C equ 0x00E ;Display on Cursor on
Disp_On_B equ 0x00F ;Display on cursor blink
Disp_Off equ 0x008 ;Display off
Clr_Disp equ 0x001 ;Clear display
Entry_Inc equ 0x006
Entry_Inc_S equ 0x007
Entry_Dec equ 0x004
Entry_Dec_S equ 0x005
DD_RAM_ADDR equ 0x080 ;Least significant 7 bit are for address
DD_RAM_UL equ 0x080 ;Upper Left corner of the display
Busy_Check
movlw TrisMaskB ;get I/O assignments
bsf status,rp0 ;bank 1 select
iorlw 0xf0 ;deal with only the upper nibble
movwf Tris_B ;setup LCD to read data
bcf status,rp0
bcf LCD_CNTL,RS
bsf LCD_CNTL,RW
call lcd_wait
bsf LCD_CNTL,E ;get upper nibble
bcf LCD_CNTL,E
movf LCD_DATA,w ;get upper nibble of display data
andlw 0xf0 ;mask off the lower nibble
movwf temp
bsf LCD_CNTL,E ;get lower nibble
bcf LCD_CNTL,E
swapf LCD_DATA,W
andlw 0x0f ;mask off upper nibble
iorwf temp,f
btfsc temp,7 ;check busy flag
goto Busy_Check ;do it again if still busy
bcf LCD_CNTL,RW
movlw TrisMaskB
bsf status,rp0
Movwf Tris_B
bcf status,rp0
return
LCD_init ;init LCD display
call lcd_wait
bcf lcdcntrl,RS ;Set register select to command regs
bcf lcdcntrl,E ;Clear the lcd module enable bit.
bcf lcdcntrl,RW ;Clear the lcd module Read/Write bit.
call lcd_wait
movlw 0x020 ;set lcd module for 4 bit operation
movwf lcddata
bsf LCD_CNTL,E
bcf LCD_CNTL,E
call lcd_wait
movlw 0x020 ;set lcd module for 4 bit operation
movwf lcddata
bsf LCD_CNTL,E
bcf LCD_CNTL,E
call lcd_wait
movlw 0x080 ;set lcd module for 8 bit operation
movwf lcddata
bsf LCD_CNTL,E
bcf LCD_CNTL,E
movlw Disp_On ;set lcd on, cursor off
call SEND_CMD
movlw Clr_Disp ;Clear Display
call SEND_CMD
movlw Entry_Inc ;Set to increment display
call SEND_CMD
movlw DD_RAM_ADDR
call SEND_CMD
movlw number_of_chars
movwf chcount
bcf flag,7
goto lcd_wait
;*******************************************************************
;* The LCD Module Subroutines *
;*******************************************************************
;
;*******************************************************************
;*SendChar - Sends character to LCD *
;*This routine splits the character into the upper and lower *
;*nibbles and sends them to the LCD, upper nibble first. *
;*******************************************************************
;
SEND_CHAR
MOVWF CHAR ;Character to be sent is in W
call Busy_Check
movf CHAR,w
ANDLW 0xF0 ;Get upper nibble
movwf CharSave
movf LCD_DATA,w
andlw 0x0F
iorwf CharSave,w ;only affect upper nibble of LCD_DATA
MOVWF LCD_DATA ;Send data to LCD
BSF LCD_CNTL, RS ;Set LCD to data mode
BSF LCD_CNTL, E ;toggle E for LCD
BCF LCD_CNTL, E
SWAPF CHAR, w
ANDLW 0xF0 ;Get lower nibble
movwf CharSave
movf LCD_DATA,w
andlw 0x0F
iorwf CharSave,w ;only affect upper nibble of LCD_DATA
MOVWF LCD_DATA ;Send data to LCD
BSF LCD_CNTL, E ;toggle E for LCD
BCF LCD_CNTL, E
return
;*******************************************************************
;* SEND_CMD - Sends command to LCD *
;* This routine splits the command into the upper and lower *
;* nibbles and sends them to the LCD, upper nibble first. *
;*******************************************************************
SEND_CMD
MOVWF CHAR ; Character to be sent is in W
call Busy_Check
movf CHAR,w
ANDLW 0xF0 ; Get upper nibble
movwf CharSave
movf LCD_DATA,w
andlw 0x0F
iorwf CharSave,w ;only affect upper nibble of LCD_DATA
MOVWF LCD_DATA ; Send data to LCD
BCF LCD_CNTL,RS ; Set LCD to command mode
BSF LCD_CNTL,E ; toggle E for LCD
BCF LCD_CNTL,E
SWAPF CHAR,w
ANDLW 0xF0 ; Get lower nibble
movwf CharSave
movf LCD_DATA,w
andlw 0x0F
iorwf CharSave,w ;only affect upper nibble of LCD_DATA
MOVWF LCD_DATA ; Send data to LCD
BSF LCD_CNTL,E ; toggle E for LCD
BCF LCD_CNTL,E
return
;********************************************************************
; This routine clears the LCD display *
;********************************************************************
dispclear
bcf lcdcntrl,RS
movlw 01h ;clear lcd display
call SEND_CMD
movlw 06h ;set entry mode on lcd module
call SEND_CMD
movlw number_of_chars
movwf chcount
bcf flag,7
;********************************************************************
; This routine waits 12ms for erase ans write commands *
;********************************************************************
lcd_wait
movlw .48
movwf count
wwait
movlw 0ffh
movwf temp
wwait1
decfsz temp,f
goto wwait1
decfsz count,f
goto wwait
retlw 0
;
LCD_Out ;put data at current cursor position on LCD
call SEND_CHAR
decf chcount,f
retlw 0
set1st ;set display to display on the first line
movlw 080h ;address cursor to 1st position
call SEND_CMD
movlw number_of_chars ;reset character counter
movwf chcount
bcf flag,7 ;reset line flag
retlw 0
set2nd ;set display to display on the second line
movlw 0c0h ;address cursor to 1st position 2nd line
call SEND_CMD
movlw number_of_chars ;reset character counter
movwf chcount
bsf flag,7 ;set line flag
retlw 0
'LCD Problem'
1998\10\07@182718
by
Sean Breheny
Hi all,
I need your help with an LCD that I am trying to use. I bought it surplus
from Marlin P. Jones
( http://www.mpja.com ). It is a TRULY SEMICONDUCTOR model MC162-1 It is a
text LCD/driver/controller board.
Sorry in advance for writing a veritable book here, but I thought it best
to fully describe my problem.
I have a datasheet for it, but as always, there are a few things which the
datasheet doesn't explain. For example, there is an input signal/voltage
listed as "Vo" on the pinout, and listed as an input on the block diagram,
but it is mentioned nowhere else. The absolute maximum ratings only mention
two supplies, Vdd and Vlcd, both of which should be 5V. Now, here's the
second thing I don't understand: there are actually two terminals for Vlcd,
positive and negative. Why two? Why wouldn't it just be referenced to Vss?
Especially because its maximum input rating is given in terms of Vdd
(Vdd+0.3V).
There are also two additional solder pads on the side of the LCD board,
marked + and -, which are never mentioned in the datasheet. The "-" one is
connected internally to Vlcd(-), but the "+" one is not connected to either
Vdd, Vss, or Vlcd(+).
This is a parallel interface LCD and I have code running on a PIC to send
the correct data, at least according to the datasheet. The result is that I
see nothing at all on the LCD screen. Nothing turns opaque. The datasheet
is also not clear about whether or not the Enable signal is active high or
low. It appears that a high-low transistion causes a load of the data, but
it shows it in the low state before the data transfer, it goes high before
the data is valid, drops to low while the data is valid, and goes back high
at the end of the transfer,so it is not clear to me what value it should
assume during idle.
I have tried treating the E as both active high and active low. I have also
tried applying 5V to only Vdd, to both Vdd and Vo, to both Vdd and Vlcd(+)
(with and without Vlcd(-) being attached), to Vdd and the undocumented +
terminal, and to all Vo, Vdd, Vlcd(+), and the undocumented + terminal, and
none of these combinations has caused anything visible to happen.
I guess the next step would be to try reading back what I have written to
the display memory, to see if at least the LSI is running. However, I am
hesitant to write extra code if there is a simple solution.
One last note: The datasheet is for model MC162-1, but the board itself
actually says MCC162A4-5. I hope that they are compatible <G>.
Thanks very much,
Sean
BTW, in case you are wondering what I am making, it is a dual (pos/neg)
variable power supply/frequency counter/function generator all in one. It
will have pretty much only a PIC and a MAXIM function generator IC in it.
The LCD will read out either internal or external frequency, as well as the
voltage on the two supply outputs. I need this instrument to facilitate my
work on the PIC-based DSO because I currently do not have any good
adjustable frequency source, or pos/neg voltage supply, both of which are
needed to troubleshoot my scope input amp design and trigger circuit.
+--------------------------------+
| Sean Breheny |
| Amateur Radio Callsign: KA3YXM |
| Electrical Engineering Student |
+--------------------------------+
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
spam_OUTshb7TakeThisOuT
cornell.edu Phone(USA): (607) 253-0315 ICQ #: 3329174
1998\10\07@223553
by
Peter Schultz
Hi,
Vo voltage for the LCD contrast adjustment, You need a 10-5 KOhm trimmerpot
between Vdd and Vss the wiper goes to
Vo. There are more tricky circuits to control the contrast ( contrast is
very temperature dependent ) but this is the easiest way to check. Do not
connect any data line, if your PS rising time is OK it will reset itself
and adjusting the pot You must see all dots in one line are on.
The reason of using different pins for the background LCD because they usual
current is 100-300 mA and most of the designers do not want to dissipate
that thru the 5V power supply .
I have Optrex data sheet better discription of the data lines. Let me know
and I will fax You,
Cheers,
Peters
1998\10\07@230408
by
Sean Breheny
Peters,
YOU ARE THE MAN! <VBG>
It worked as soon as I hooked up that pot.
I would never have believed it was that simple.
There it is , that little display saying "Hello" at me, and I can even
adjust the contrast now!
Thanks very much,
Sean
At 07:35 PM 10/7/98 -0700, you wrote:
{Quote hidden}>Hi,
>Vo voltage for the LCD contrast adjustment, You need a 10-5 KOhm trimmerpot
>between Vdd and Vss the wiper goes to
>Vo. There are more tricky circuits to control the contrast ( contrast is
>very temperature dependent ) but this is the easiest way to check. Do not
>connect any data line, if your PS rising time is OK it will reset itself
>and adjusting the pot You must see all dots in one line are on.
>The reason of using different pins for the background LCD because they usual
>current is 100-300 mA and most of the designers do not want to dissipate
>that thru the 5V power supply .
>I have Optrex data sheet better discription of the data lines. Let me know
>and I will fax You,
>Cheers,
>Peters
>
+--------------------------------+
| Sean Breheny |
| Amateur Radio Callsign: KA3YXM |
| Electrical Engineering Student |
+--------------------------------+
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
.....shb7KILLspam
@spam@cornell.edu Phone(USA): (607) 253-0315 ICQ #: 3329174
1998\10\07@231000
by
Heinz Czychun
|
Hi Sean,
I also bought the same display, and also the 16x1. Assuming it to be a
standard type, I just connected it according to David Benson's Book PIC'n
up the Pace. The book provides a fairly complete treatment of these
displays, both 16x1, and 16x2 in a very understandable form, with complete
PIC software code.
At 6:24 PM 10/7/98, Sean Breheny wrote:
>Hi all,
...large snip...
>For example, there is an input signal/voltage
>listed as "Vo" on the pinout, and listed as an input on the block diagram,
>but it is mentioned nowhere else. The absolute maximum ratings only mention
>two supplies, Vdd and Vlcd, both of which should be 5V. Now, here's the
>second thing I don't understand: there are actually two terminals for Vlcd,
>positive and negative. Why two? Why wouldn't it just be referenced to Vss?
>Especially because its maximum input rating is given in terms of Vdd
>(Vdd+0.3V).
from the book the pins from left to right ( with the display facing you) are
1 - GND
2 - +5V
3 - Gnd -> voltage for display contrast (I've seen a 2k5 ohm voltage
divider for contrast but not tried it.)
4 - RS
5 - R/-W -> Grounded for most apps
6 - E -> Positive logic (125 micro sec pulse)
7 - D0
8 - D1
9 - D2
10 - D3
11 - D4
12 - D5
13 - D6
14 - D7
15 - Not used |
16 - Not used |
| I've taken these to be involved with backlighted displays
"+" - Not used |
"-" - Not used |
>There are also two additional solder pads on the side of the LCD board,
>marked + and -, which are never mentioned in the datasheet. The "-" one is
>connected internally to Vlcd(-), but the "+" one is not connected to either
>Vdd, Vss, or Vlcd(+).
>
This maybe for the backlight option ?
>This is a parallel interface LCD and I have code running on a PIC to send
>the correct data, at least according to the datasheet. The result is that I
>see nothing at all on the LCD screen. Nothing turns opaque.
Is pin 3 low?
>The datasheet
>is also not clear about whether or not the Enable signal is active high or
>low. It appears that a high-low transistion causes a load of the data, but
>it shows it in the low state before the data transfer, it goes high before
>the data is valid, drops to low while the data is valid, and goes back high
>at the end of the transfer,so it is not clear to me what value it should
>assume during idle
>I have tried treating the E as both active high and active low.
See above
...snip...
>I guess the next step would be to try reading back what I have written to
>the display memory, to see if at least the LSI is running. However, I am
>hesitant to write extra code if there is a simple solution.
There are some tricks to allow the display time to initialize after powerup.
>
>One last note: The datasheet is for model MC162-1, but the board itself
>actually says MCC162A4-5. I hope that they are compatible <G>.
?
....snip...
regards,
Heinz
1998\10\07@232022
by
Sean Breheny
Thanks Heinz,
As you probably have seen by now in my other post, the problem is now fixed
and it had to do with the fact that I was not attaching a pot to Vo (the
contrast pin).
I do have one question for you, though. I have so far only displayed
"Hello" on it on one line. Tomorrow, I should get a bit more time to play
with it. Is there anything special needed to access the second line, or can
I just continue to write chars and it will wrap around to the next line?
Also, what is the address for the next line (does it just start with 16?)
Thanks,
Sean
At 11:10 PM 10/7/98 -0500, you wrote:
{Quote hidden}>Hi Sean,
>
>I also bought the same display, and also the 16x1. Assuming it to be a
>standard type, I just connected it according to David Benson's Book PIC'n
>up the Pace. The book provides a fairly complete treatment of these
>displays, both 16x1, and 16x2 in a very understandable form, with complete
>PIC software code.
>
+--------------------------------+
| Sean Breheny |
| Amateur Radio Callsign: KA3YXM |
| Electrical Engineering Student |
+--------------------------------+
Save lives, please look at http://www.all.org
Personal page: http://www.people.cornell.edu/pages/shb7
shb7
KILLspamcornell.edu Phone(USA): (607) 253-0315 ICQ #: 3329174
1998\10\08@064616
by
Heinz Czychun
|
At 11:18 PM 10/7/98, Sean Breheny wrote:
>Thanks Heinz,
>
>As you probably have seen by now in my other post, the problem is now fixed
>and it had to do with the fact that I was not attaching a pot to Vo (the
>contrast pin).
Great that the fix was so simple.
>I do have one question for you, though. I have so far only displayed
>"Hello" on it on one line. Tomorrow, I should get a bit more time to play
>with it. Is there anything special needed to access the second line, or can
>I just continue to write chars and it will wrap around to the next line?
>Also, what is the address for the next line (does it just start with 16?)
You got me, I over sold the book 8^o, but it did help make using
the 16x2 self evident.
I had only gotten as far as you ( getting the display to send
simple messages, surprisingly always less than 9 characters ) and because I
tried a 16x1, and a 16x2 display, I thought both were covered. I checked
the book again and found that it only covered 16x1 displays.
What it indicated was the first eight character addresses start at
0x80, the next 8 at 0xC0 (for a 16x1 display).
When I sent more than 8 characters to the 16x2 display, using the
16x1 software the 9th and subsequent characters went to the next line.
So the first group of 16 characters are addressed from 0x80 through
0x8F, and the next set of 16 characters start at 0xC0.
Embarrassed, Heinz
More... (looser matching)
- Last day of these posts
- In 1998
, 1999 only
- Today
- New search...