Custom configuration for LCD module


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Location
    Paris
    Posts
    101

    Default Custom configuration for LCD module

    Hi everyone,
    I'm actually experiencing troubles interfacing a 2x16 LCD module to a PIC18F2550 using a custom connexion scheme on port A.

    However it seems to me that I did everything right, but can't get anything to display on my LCD.

    I am using 4bit addressing mode, with:

    PortA.0 to PortA.3 = D4 to D7
    PortA.4 = E
    PortA.5 = RS
    R/W = GND

    (hardware connexion was triple checked!!!)

    -The LCD seems to initialize correctly after the first delay (when powered on the first line is darker, after the init. command is sent the LCD contrast is even on both lines), however nothing is displayed.

    -I tried 3 different LCD's, 2 are displaying nothing, the first one a blinking cursor on the first character that just stay there

    -contrast is likely not the issue as I can see caracter positions

    -I also checked the signals with my oscilloscope, data is being sent on every lines (D4-D7, E and RS) at a 1/2s interval, corresponding to what my code should actually do.

    Here is my code (that was started with easyHID, as I plan to use USB comm later on):

    DEFINE OSC 48
    DEFINE LOADER_USED 1

    ' Set ADC pins to digital operation
    ADCON1 = 7

    ' Define pin function
    'TRISA = %00000011
    'TRISB = %10001111
    'TRISC = %01111100

    ' set LCD pin configuration
    DEFINE LCD_DREG PORTA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    ' Define pin names
    BACKLIGHT VAR PORTC.0
    USBPOWER VAR PORTC.1
    CLK VAR PORTC.7
    DAT VAR PORTC.6
    CANCEL VAR PORTB.7
    DOWN VAR PORTB.6
    UP VAR PORTB.5
    ENTER VAR PORTB.4
    POWER VAR PORTB.3
    RESET VAR PORTB.2
    SDA VAR PORTB.0
    SCL VAR PORTB.1

    USBBufferSizeMax con 8 ' maximum buffer size
    USBBufferSizeTX con 8 ' input
    USBBufferSizeRX con 8 ' output

    ' the USB buffer...
    USBBuffer Var Byte[USBBufferSizeMax]
    USBBufferCount Var Byte

    usbinit ' initialise USB...

    ' output state initialisation
    LOW BACKLIGHT
    LOW POWER
    LOW CLK
    LOW DAT
    LOW RESET

    ' ************************************************** *********
    ' MAIN PROGRAM
    ' ************************************************** *********
    Pause 1000

    ' writing custom characters in the LCD display memory
    ' character 0 tuning fork ($40)
    LCDOUT $FE,$40,$0a,$0a,$0a,$0a,$0a,$04,$04,$00
    ' character 1 diËze ($48)
    lcdout $FE,$48,$0a,$0b,$0e,$1b,$0e,$1a,$0a,$00
    ' character 2 bÈmol ($50)
    lcdout $FE,$50,$08,$08,$0a,$0d,$09,$0a,$0c,$00
    ' character 3 hertz ($58)
    lcdout $FE,$58,$14,$14,$14,$1f,$15,$16,$17,$00
    ' character 4 cent ($60)
    lcdout $FE,$60,$02,$02,$02,$0b,$12,$12,$0d,$00

    programstart:

    lcdout $FE, 1
    lcdout "abcdefghiklmnop"
    pause 500
    LCDOUT $FE, 1
    lcdout "qrstuvwxyz"
    pause 500

    USBSERVICE

    goto programstart



    I'm running out of ideas about what can be wrong. Ideas anyone? thanks for the help
    Last edited by aberco; - 23rd December 2007 at 16:31.

  2. #2
    Join Date
    Dec 2007
    Location
    Paris
    Posts
    101


    Did you find this post helpful? Yes | No

    Default

    Just tried again without the USB code, only with the strict minimum.

    I remember that a friend couldn't get his LCD working with a PIC18F4550, whereas the same code was working perfectly on a 16F877...

    Is there an issue with interfacing LCD's to USB PIC?

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Have looked at the comparators?
    The16F877 did not have them.
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Dec 2007
    Location
    Paris
    Posts
    101


    Did you find this post helpful? Yes | No

    Post

    Hahaha fast and efficient! you saved my day!

    The ADC was actually on...

    Had to add
    ADCON1 =%00001111
    CMCON = %00000111

    Thanks a lot, and sory for this newbie question

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by [email protected] View Post
    Thanks a lot, and sory for this newbie question
    No problem, we all had/have them at some point.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 09:54
  2. Version Control
    By btaylor in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 16th October 2011, 17:12
  3. Replies: 1
    Last Post: - 27th July 2008, 06:14
  4. Vinculum VNC1L Vdrive2 module problems
    By the_virus in forum Serial
    Replies: 9
    Last Post: - 21st July 2008, 07:01
  5. Crystalfontz LCD
    By jman12 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 9th February 2007, 15:04

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts