News:

;) This forum is the property of Proton software developers

Main Menu

PICDEM 2 PLUS and LCD

Started by gtvpic, Mar 24, 2021, 08:44 PM

Previous topic - Next topic

gtvpic

Hello good,
I am trying to use an old PICDEM2 PLUS card from the year 2002.
The problem is with the LCD that I am not able to make it work.
I enclose the program and comment that with the PRINT instruction the led D "stops flashing and the display does not work. If I remove the PRINT instruction, the led D2 will blink properly again.
Any suggestion?
Version 3.7.5.5
Thanks a lot
Device = 16F877
Declare Xtal = 20
'declare Optimiser_Level =     3        ' Tipo Optimizacion del Compilador

Config FOSC_HS, WDTE_OFF, PWRTE_OFF, BOREN_ON, LVP_ON, CPD_OFF, WRT_OFF, DEBUG_OFF, CP_OFF

' Declaraciones del Display
Declare LCD_Lines        =  2           ' 2 linea de Display
Declare LCD_RSPin        = PORTD.4      ' Linea RS del Display
Declare LCD_ENPin        = PORTD.6      ' Linea EN del Display
Declare LCD_RWPin        = PORTD.5      ' Linea R/W del Display
Declare LCD_Data0_Pin    = PORTD.0      ' Puerto de datos D.0 al D.4
Declare LCD_Data1_Pin    = PORTD.1      ' Puerto de datos D.0 al D.4
Declare LCD_Data2_Pin    = PORTD.2      ' Puerto de datos D.0 al D.4
Declare LCD_Data3_Pin    = PORTD.3      ' Puerto de datos D.0 al D.4
Declare LCD_Interface    = 4            ' 8 Lineas de Datos
Declare LCD_Type         = 0            ' Tipo Alfanumerico
Declare LCD_CommandUs    = 10000        ' Espera Entre Comandos
Declare LCD_DataUs       = 200          ' Espera entre Datos
Symbol Luz_LCD PORTD.7                  ' Encendido Luz del Display


TRISA = 0                               ' Puerto A como Salidas
TRISB = 0                               ' Puerto B como Salidas
TRISC = 0                               ' Puerto C como Salidas
TRISD = 0                               ' Puerto D como Salidas
TRISE = 0                               ' Puerto E como Salidas

' Inicializa
PORTA = 0
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
' Espera Inicial
DelayMS 20
Cls
PORTD.7 = 1
Do
    Toggle PORTB.0                      ' Led D2
    Print "Hola Mundo"
    DelayMS 200
Loop

Gods

Maybe ?   Print At 1,1 ,"Hola Mundo"

Gods

#2
I do this code to test an old board last year, and is working well.


   
    Device = 16F877A
    Declare Xtal = 8                    ' 8 Mhz

' Init du LCD 2x16   
    Declare LCD_Type = Alphanumeric
    Declare LCD_DTPin = PORTB.4
    Declare LCD_RSPin = PORTB.2
    Declare LCD_ENPin = PORTB.3
    Declare LCD_Interface = 4
    Declare LCD_Lines = 2
    Declare LCD_CommandUs = 2000
    Declare LCD_DataUs = 50

' Init du DAC   
    Declare Adin_Res = 10               ' Résolution de 10 bits
    Declare Adin_Tad = FRC              ' Choix Oscilateur RC pour le DAC
    Declare Adin_Stime = 50             ' 50 uS de delay pour la conversion
   
    Dim ADC_result1 As Float
    Dim ADC_result2 As Float
   
    TRISA  = $FF                        ' PORTA en entrée
    ADCON1 = $82                        ' Tous les ports en Analogique et VRef = Vcc
   
 Cls                                    ' Efface l écran du LCD
   
Do
    ADC_result1 = (ADIn 2) * (5.0/1024.0)                ' Lecture AN2
    ADC_result2 = (ADIn 3) * (5.0/1024.0)                ' Lecture AN3
   
    Print At 1,1 ,"AN2= ", Dec ADC_result1 , " V"
    Print At 2,1 ,"AN3= ", Dec ADC_result2 , " V"
   
Loop                                                     ' Boucle infinie
 

m.kaviani

Gtvpic,
two things, first are you sure that the R/W pin of the LCD is pulled down?
second the syntax of print command to be correct to
PRINT AT 1,1,"HELLO WORD"

gtvpic

Thank you very much for opinions

Quote from: m.kaviani on Mar 25, 2021, 06:42 AMGtvpic,
two things, first are you sure that the R/W pin of the LCD is pulled down?
second the syntax of print command to be correct to
PRINT AT 1,1,"HELLO WORD"
m.kaviani  -> The Result is the same uses PRINT "Hello World" as Print 1,1, "Hello World",
Declare LCD_RWPin        = PORTD.5      ' Linea R/W del DisplayHere the R / W pin is defined to be defined low by the compiler or the PRINT routine

Gods -> Your code uses port B to control the LCD, mine uses port D and I think the problem is in the port, in fact port B.0 works erratically when I use the PRINT instruction.



Thank

RGV250

Hi,
I wonder if it is because you have not declared the DT pin??
The manual says it will default to B.4 if not declared but worth a try.

Bob

Gods

yes, I know, this is an example. I look at the datasheet and it says "There are three control lines (RA3: RA1) and four data lines (RD3: RD0)" so you have to check with a multimeter if these control lines are connected to the PORTA or the PORTD.

RGV250

#7
Hi,
If you remove the individual lines and add DTPin it seems to work, in my sim B.) toggles but the LCD used different control lines.
' Declaraciones del Display
Declare LCD_Lines        =  2           ' 2 linea de Display
Declare LCD_RSPin        = PORTD.4      ' Linea RS del Display
Declare LCD_ENPin        = PORTD.6      ' Linea EN del Display
Declare LCD_RWPin        = PORTD.5      ' Linea R/W del Display
Declare LCD_DTPin        = PORTD.0      ' Puerto de datos D.0 al D.4
Declare LCD_Interface    = 4            ' 8 Lineas de Datos
Declare LCD_Type         = 0            ' Tipo Alfanumerico
Declare LCD_CommandUs    = 10000        ' Espera Entre Comandos
Declare LCD_DataUs       = 200          ' Espera entre Datos

Also you do not need RW pin, just tie it to ground.

Bob

gtvpic

I modify the program as indicated, I solve the LED D2 that is connected to PORT B.0 but the LCD still does not work.
Does anyone have a PICDEM 2 PLUS and can try this code to verify that the card is not damaged?
I am beginning to think that the LCD is not working properly.  : o

Device = 16F877
Declare Xtal = 20

Config FOSC_HS, WDTE_OFF, PWRTE_OFF, BOREN_ON, LVP_ON, CPD_OFF, WRT_OFF, DEBUG_OFF, CP_OFF

' Declaraciones del Display
Declare LCD_Lines        = 2            ' 2 linea de Display
Declare LCD_RSPin        = PORTD.4      ' Linea RS del Display
Declare LCD_ENPin        = PORTD.6      ' Linea EN del Display
Declare LCD_RWPin        = PORTD.5      ' Linea R/W del Display
Declare LCD_DTPin        = PORTD.0      ' Puerto de Datos D.0 al D.4
Declare LCD_Interface    = 4            ' 4 Lineas de Datos
Declare LCD_Type         = 0            ' Tipo Alfanumerico
Declare LCD_CommandUs    = 10000        ' Espera Entre Comandos
Declare LCD_DataUs       = 200          ' Espera entre Datos



Symbol Luz_LCD PORTD.7                  ' Iluminacion del Display
TRISB = 0                               ' Puerto B como Salidas
' Inicializa
Low PORTD.5                             ' R/W del LCD
Low Luz_LCD                             ' Luz Display
' Espera Inicial
DelayMS 20
Cls
Do
    Toggle PORTB.0                      ' Led D2
    Toggle PORTB.1                      ' Led D3   
    Print At 1,1,"Hola Mundo"
    DelayMS 200
Loop

RGV250

#9
Hi,
You might need to do a bit more investigation into the display, looking at the PICDEM board it is LUMEX OM16214, I think this is the datasheet https://www.pacificdisplay.com/cdm/CDM-16214.pdf but dont quote me on it.
Looking at that it has a SPLC782A controller where PDS is written for Hitachi 44780 or similar.
I think this is the controller datasheet https://www.pacificdisplay.com/ics_app%20notes/sunplus/SPLC782av10.pdf
Looking at it quickly it seems the same so it is possible this has nothing to do with your issue.
Bob

RGV250

Hi,
I have done a bit more searching and it seems the controller is 44780 compatible but a lot of people have had issues with the PICDEM board working with the demo code but not with others.

Bob

gtvpic

Thanks
I'm also looking but can't find a code that works to first determine if my card is damaged or a software problem.
That's why I try to get someone to send me a code tested on a PICDEM 2 PLUS or to test the code on a card so that we can determine where the problem is coming from.
Thank you very much, I'm still searching.

RGV250


gtvpic

Download the files, thank you
It does not work, but I observe that the original Y2 crystal of the PICDEM 2 was not 20Mhz which is the one it has now.
I do not have to modify the files to adapt them to the current frequency.
Check all the pins of the PIC and they work correctly, so a problem in the PIC is ruled out. Check it by executing a program to intermittent each of the output pins and checking that the output frequency matches the program performed. It is clear that he hides it from port to port in an alternative way.
Thanks and I'm still looking.

Gods

It finally seems that there are two versions of the board. What I find strange is that the contrast voltage VEE is connected to ground.

Device = 16F877
Declare Xtal = 20

' Declaraciones del Display

    Declare LCD_Type = Alphanumeric
    Declare LCD_DTPin = PORTD.0
    Declare LCD_RSPin = PORTD.4
    Declare LCD_ENPin = PORTD.6
    Declare LCD_Interface = 4
    Declare LCD_Lines = 2
    Declare LCD_CommandUs = 2000
    Declare LCD_DataUs = 50

Symbol Luz_LCD PORTD.7                  ' Iluminacion del Display
TRISB = 0                               ' Puerto B como Salidas

' Inicializa
Low PORTD.5                             ' R/W del LCD
Low Luz_LCD                             ' Luz Display

' Espera Inicial
DelayMS 20
Cls
Do
    Toggle PORTB.0                      ' Led D2
    Toggle PORTB.1                      ' Led D3  
    Print At 1,1 ,"Hola Mundo"
    DelayMS 200
Loop

Ground

according to the datasheet ... 

IMG_0044.jpg

Gods

#16
There is two version of this board, old and new. The RA3:RA1 lines is used on the old one. The last one only use PORTD.
gtvpic must check this PCB for DM163022 or DM163022-1 version...
(Also is i bit strange because 28Pins device don't have a PORTD and can't use the LCD.)

gtvpic

Working, thank you so much
The problem is that the board uses the pins of port A not those of Port D as it appears in the diagram of the board.
Checking the plate is a REV 5 version of the year 2002
This is what makes the forum great
I leave the code that works
The display still does not light up but I will keep searching.
Thanks
Device = 16F877
Declare Xtal = 20

Config FOSC_HS, WDTE_OFF, PWRTE_OFF, BOREN_ON, LVP_ON, CPD_OFF, WRT_OFF, DEBUG_OFF, CP_OFF

' Declaraciones del Display
Declare LCD_Lines        = 2            ' 2 linea de Display
Declare LCD_ENPin        = PORTA.1      ' 32 31 12 Linea EN del Display
Declare LCD_RWPin        = PORTA.2      ' 23 13 21 Linea R/W del Display
Declare LCD_RSPin        = PORTA.3      ' 11 22 33 Linea RS del Display
Declare LCD_DTPin        = PORTD.0      ' Puerto de Datos D.0 al D.4
Declare LCD_Interface    = 4            ' 4 Lineas de Datos
Declare LCD_Type         = 0            ' Tipo Alfanumerico
Declare LCD_CommandUs    = 10000        ' Espera Entre Comandos
Declare LCD_DataUs       = 200          ' Espera entre Datos

Symbol Luz_LCD PORTD.7                  ' Iluminacion del Display
TRISA = 0                               ' Puerto A como Salidas
TRISB = 0                               ' Puerto B como Salidas

Dim Cnt As Word

' Inicializa
Low PORTA.3                             ' R/W del LCD
High PORTA.7

Low Luz_LCD                             ' Luz Display
' Espera Inicial
DelayMS 20
Cls
Do
    Inc Cnt
    Toggle PORTB.0                      ' Led D2
    Toggle PORTB.1                      ' Led D3   
    Print At 1,1,"Hola Mundo"
    Print At 2,1,"Cnt = " ,Dec Cnt
    DelayMS 200
Loop

Gods

#18
Quote from: gtvpic on Mar 25, 2021, 07:11 PMThe display still does not light up but I will keep searching.

Great!  :) The diagram provided is not good. The power supply of the Light in the 2x16 LCD is on pins 15 and 16.
if it has only 14 pins, is not equipped with backlight.

top204

The compiler does not use the RW pin for an alphanumeric LCD, so the LCD_RWPin declare can be removed. That declare is for a graphic LCD.

Make sure the RW pin of the LCD is connected to Gnd.