Dedicated LCD Controller question


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2006
    Posts
    5

    Default Dedicated LCD Controller question

    Hi,

    I'm fairly new to PICS and have been working on making my own LCD controller out of a PIC16F84A(I had both the PIC and the 2x16 parallel lcd arleady, and couldn't see spending the $$ on a Serial LCD). I've got my circuit board built, using an 8-bit interface to the LCD. The pic runs at 20MHz.
    I am using PBP v2.46, Microcode Studio, and the Melabs USB Programmer
    My code for the 16F84A is:

    @ DEVICE PIC16F84A, HS_OSC, PWRT_ON, WDT_OFF, PROTECT_OFF

    DEFINE OSC 20 ' Set speed to 20MHz
    TRISB = %00000000 ' All PORTB pins are outputs

    ' LCD DEFINES
    DEFINE LCD_BITS 8
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4 'PORTB.0 is first data
    DEFINE LCD_LINES 2 'Number of lines on LCD to be used
    define LCD_RSREG PORTA 'Port used for LCD RS Pin
    define LCD_RSBIT 3 'Port Pin used for LCD
    define LCD_EREG PORTA 'Port used for LCD E pin
    define LCD_EBIT 4 'Port Pin used for LCD E Pin
    define LCD_COMMANDUS 2000 'Delay between sending lcd commands
    define LCD_DATAUS 50 'Delay time between data sent

    SerData VAR word
    SerPin VAR PORTA.2
    TRISA.2=1

    pause 1000
    LCDOut $FE, 1 'Clear LCD
    pause 20
    lcdout $FE, 2 'Return to home position
    pause 20

    GOTO Start

    Start:
    SERIN SerPin,6,SerData 'receive data
    LCDOut Serdata ' Send to LCD
    GOTO Start
    END

    I have another PIC (16F690) that I have hooked up to my "homemade lcd controller", using serout commands, and I can send data form the 16F690 to the lcd controller without any problems, but one thing that I cannot seem to figure out is how do I send the clear screen command , or any of the other commands that are listed in the PBP manual($FE, ) from the 16F690 to the 16F84A LCD controller?

  2. #2
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Lightbulb My LCD with Pic16f688 (Work good)

    INCLUDE "modedefs.bas"
    OSCCON=$70
    DEFINE OSC 8
    define LCD_DREG PORTC
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTA
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 0
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    BO VAR byte


    ANSEL=0
    CMCON0=7
    LOW PORTA.4
    LCDOUT $FE,1,"LCD 1.0v"
    pause 500
    HIGH PORTA.2 'Back LED
    LCDStart:
    serin PORTC.5,N2400,BO
    lcdout BO
    goto LCDStart

  3. #3
    Join Date
    Jan 2006
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Thank you for responding, however that is not what I was looking for. Since the PIC16F84A is dedicated to the Parallel LCD module ONLY, I needed a way to send control codes from any other pic to the PIC16F84A via serout commands, in effect I was trying to make my own serial backpack without have to go out and buy it.

    For anyone else who reads this thread please ignore the post as I have found my own answers.

  4. #4
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default You problem was the same as mine

    Except I am still having trouble making my unit work and a day has passed without anybody contributing significantly to my inquiry.

    Perhaps you would be so kind as to share your success.

    My post was made to this forum on 22 Feb. 06

  5. #5
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Hope this helps

    Hi,

    I got this code from the PICBASIC list on the melabs site. I have posted this before here. Posting again. Adapt your code to your specific requirements.

    Regards

    Sougata
    Attached Files Attached Files

  6. #6
    Join Date
    Aug 2005
    Posts
    95


    Did you find this post helpful? Yes | No

    Default Try this

    @ DEVICE PIC16F84A, HS_OSC, PWRT_ON, WDT_OFF, PROTECT_OFF

    DEFINE OSC 20 ' Set speed to 20MHz
    TRISB = %00000000 ' All PORTB pins are outputs

    ' LCD DEFINES
    DEFINE LCD_BITS 8
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4 'PORTB.0 is first data
    DEFINE LCD_LINES 2 'Number of lines on LCD to be used
    define LCD_RSREG PORTA 'Port used for LCD RS Pin
    define LCD_RSBIT 3 'Port Pin used for LCD
    define LCD_EREG PORTA 'Port used for LCD E pin
    define LCD_EBIT 4 'Port Pin used for LCD E Pin
    define LCD_COMMANDUS 2000 'Delay between sending lcd commands
    define LCD_DATAUS 50 'Delay time between data sent

    SerData VAR word
    SerPin VAR PORTA.2
    TRISA.2=1

    pause 1000
    LCDOut $FE, 1 'Clear LCD
    pause 20
    lcdout $FE, 2 'Return to home position
    pause 20

    GOTO Start

    Start:
    SERIN SerPin,6,SerData 'receive data
    LCDOut Serdata ' Send to LCD
    If serdata =5 then gosub clearlcd
    GOTO Start
    END

    clearlcd:
    lcdout $FE,$80," "
    lcdout $FE,$C0," "
    return

    So if you send number 5 to your pic it will clear the lcd. From your code ive asumed you have use a 2 line lcd.

    Hope it helps
    Sphere

    lcdout $FE,$80," "
    lcdout $FE,$C0," "
    when I post the above it has 20 spaces between " " but it is only showing about 4 so add about 20 in your program
    Last edited by Sphere; - 24th February 2006 at 17:25.

  7. #7
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Lcd

    Thank you for your replies.

    I looked over many of the previous posts by searching this site and realized that my problem was most likely due to trying to use DEBUGIN for input. None of the code examples I saw utilized DEBUGIN. Finally I scrapped the 16F84 as processor, cut 4 data lines from my hardware interface and used a 16F628 with a USART. Using HSERIN (on RB1) as my input and LCDOUT with the 4 line mode, I had success last night.

    It looks like the SERIN command was used in one of the examples. Perhaps I will work with it and see what happens.

    I think a faulty crystal also complicated my debug process.

    In this exercise I learned what a huge amount of information is available on this forum but it helps to search on the correct terminology. Once I discovered that what I am trying to do is referred to as a "backpack", I had a lot of good material to look over.

Similar Threads

  1. LCD with T6963C controller
    By Demon in forum Off Topic
    Replies: 9
    Last Post: - 22nd May 2022, 20:11
  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. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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