News:

;) This forum is the property of Proton software developers

Main Menu

Easypic7 LCD

Started by charliem, Sep 18, 2024, 09:30 AM

Previous topic - Next topic

charliem

Hello everyone,
 I'm using a 16F877a Pic on a Easypic7 board. All I want to do is display something on the LCD .
Here is my code any help is appreciated. I don't see what I did wrong here.


Device = 16F877A

Config FOSC_HS, WDTE_OFF, PWRTE_OFF, BOREN_OFF, LVP_OFF, CPD_OFF, WRT_OFF, DEBUG_OFF, CP_OFF

;**** End of Fuse Configurator Settings ****
;-------------------------------------------------------------------------------
Xtal = 8


    Declare LCD_Type = alpha
    Declare LCD_Interface 4
    Declare LCD_Lines = 2
    Declare LCD_CommandUs 50000
    Declare LCD_DataUs 255
    Declare LCD_DTPin = PORTB.0
    Declare LCD_RSPin = PORTB.4
    Declare LCD_ENPin = PORTB.5
    Cls
    DelayMS 500
  main:
  Print At 1,1"HelloWorld"
   DelayMS 200

GoTo main

John Lawton

I assume the PIC is running?

There may be other code issues, but don't you get a syntax error with:

Print At 1,1"HelloWorld"

Comma missing.

Also, correct syntax is:

Declare Xtal = 8

John

kcsl

I don't know that board, but have you tried fiddling with the contrast control. Been there... done that :(
There's no room for optimism in software or hardware engineering.

Stephen Moss

As far as I can tell from cheick hte board schematic you are using the correct Port pins and the LDC they provide/suggest uses the standard Hitachi interface so it should work.
If the board has been tested befoer shipping I would expect the brightness setting for the display to be adequate but as @kcsl stated it may be worth checking anyway.

Other theing to try are to comment out the Declare LCD_CommandUs 50000 and Declare LCD_DataUs 255, genreally I don't use them as the defualt values usually work, but you CommandUs value is a lot longer that the default work so maybe your chosen vlaues are creating an issue.

Also you do not appear to have a TRISB = $00 setting to make the Port Pins output as the power on default is input and so with out that you may not be sending any data to the display.   

evoortman

Declare LCD_DTPin = PORTB.0 means you are using an 8 line data interface. So the whole PORTB.
Therefore the LCD_RSPin and LCD_ENPin cannot be set to PORTB.4 and PORTB.5.

top204

#5
Incorrect evoortman.

Declare LCD_DTPin = PORTB.0 does 'not' mean the LCD is using an 8-bit interface.

It means that if an 8-bit interface is set by the Declare LCD_Interface = 8, the LCD will use pins PORTB.0 to PORTB.7 for the data lines.

However, if a 4-bit interface is set by: Declare LCD_Interface = 4, it means that the LCD will use pins PORTB.0 to PORTB.3 for the data lines. So the other pins of PORTB are free to use for other things.

charliem

QuoteI assume the PIC is running?

There may be other code issues, but don't you get a syntax error with:

CodeSelect
Print At 1,1"HelloWorld"

Comma missing.

Also, correct syntax is:

CodeSelect
Declare Xtal = 8

Thanks John for the reply. No there are no compiler errors. I even see the port B leds flicker. Just nothing on the display.

QuoteAlso you do not appear to have a TRISB = $00 setting to make the Port Pins output

Thanks Stephen for the reply. I had TrisB = 0 however I got the same results.

charliem

I added Declare Xtal and Also TrisB = 0, but I still get the same results. I see the PortB leds flicker once and nothing on the display.

John Lawton

Print At 1,1"HelloWorld" is incorrect.

It should be:
Print At 1,1,"HelloWorld" as per the manual.

Have you read Les's message about the port B lines for the LCD?

"However, if a 4-bit interface is set by: Declare LCD_Interface = 4, it means that the LCD will use pins PORTB.0 to PORTB.3 for the data lines. So the other pins of PORTB are free to use for other things."

But you are trying to also use PORTB.0 for LCD_DTPin which surely won't work?

John

charliem

Hi John,
 Turns out that the comma I missed before the Quotes was the issue. I add the comma and now it works. Funny though, the code compiled fine. Thanks for the help.