PIC to LCD interface


Closed Thread
Results 1 to 2 of 2
  1. #1
    smooth's Avatar
    smooth Guest

    Question PIC to LCD interface

    Hi,
    Anyone know how to interface a 4x20 DMC20481 backlite LCD to a PIC16F84?
    I have tried almost everything... here is my code below, anyone see anything wrong?

    org 0x00
    goto start

    start

    movlw 0x00
    tris PORTB

    movlw 0x00
    movwf PORTB

    call Delay_5ms ; 5ms delay
    call Delay_5ms
    call Delay_5ms
    call Delay_5ms

    call LCD_Init

    ;------------------------------------------

    LCD_Init

    movlw 0x33 ; function set
    movwf DispTemp
    call LCD_Cmd

    movlw 0x32 ; now in 4-bit mode
    movwf DispTemp
    call LCD_Cmd

    movlw 0x28
    movwf DispTemp ; sending 2 lines (2x40) 5x7 chars
    call LCD_Cmd

    movlw 0x08 ; display off
    movwf DispTemp
    call LCD_Cmd

    movlw 0x01 ; cls
    movwf DispTemp
    call LCD_Cmd

    movlw 0x06 ; entry mode shift lcd left
    movwf DispTemp
    call LCD_Cmd

    movlw 0x0F ; display on, cursor/blink on
    movwf DispTemp
    call LCD_Cmd

    call Delay_5ms
    call Delay_5ms
    call Delay_5ms

    return
    ;------------------------------------------
    LCD_Cmd
    swapf DispTemp,0
    andlw b'00001111'
    movwf PORTB
    bsf PORTB,7
    call Delay_5ms
    bcf PORTB,7
    call Delay_5ms

    movfw DispTemp
    andlw b'00001111'
    movwf PORTB
    bsf PORTB,7
    call Delay_5ms
    bcf PORTB,7
    call Delay_5ms

    return

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default check this out

    Hey Smooth,
    that's all assembly, no picbasic pro. Some here can do it, not all. PBP forum, if you want to do it in basic check out the post listed or use the search button or check Picbasic manual page 95 and 96. Be alert to the fact that not all LCD modules are wired the same, as some switch power and ground pins acording to brand.




    http://www.picbasic.co.uk/forum/showthread.php?p=19331
    Regards
    JS

Similar Threads

  1. Interface Pic --> Max232 --> GSM Modem
    By SangkiMangki in forum GSM
    Replies: 1
    Last Post: - 28th September 2013, 12:57
  2. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  3. How to interface PIC to Optrex 81852
    By misterPIC in forum Schematics
    Replies: 4
    Last Post: - 25th May 2008, 07:22
  4. 3-wire LCD interface?
    By atomski in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 10th June 2007, 03:08
  5. 16f877, pic and lcd
    By logem2005 in forum General
    Replies: 1
    Last Post: - 2nd November 2005, 12:27

Members who have read this thread : 1

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