LCDOUT Question


Closed Thread
Results 1 to 5 of 5

Thread: LCDOUT Question

  1. #1

    Default LCDOUT Question

    Hi,

    This may be something that I am simply overlooking but I have spent too much time trying to figure it out. I have 4 lcds. Two are using the KS0066U controller and the other two are using the Hitachi 44780 which I believe are the same anyways. One is built in a Picdem 2 plus board and the others I have wired to the board. The built in one uses port d and a 4 bit data bus. I can get it to work no problem. I wire the other three to port b the exact same way as the built in lcd as I have the schematic to the picdem board and they will not work at all. What I am hoping is some insight on what may be going wrong for me. My exact code is below. The first set of defines is for the picdem board lcd and the other is for the wired lcd.

    I am obviously missing something and any advice or suggestions would be greatly appreciated.

    DEFINE OSC 4

    ' TRISD = %00000000
    ' Pause 500 ' Wait for LCD to startup
    ' DEFINE LCD_DREG PORTD
    ' DEFINE LCD_DBIT 0
    ' DEFINE LCD_RSREG PORTD
    ' DEFINE LCD_RSBIT 4
    ' DEFINE LCD_EREG PORTD
    ' DEFINE LCD_EBIT 6
    ' DEFINE LCD_BITS 4
    ' DEFINE LCD_LINES 2
    ' DEFINE LCD_COMMANDUS 2000
    ' DEFINE LCD_DATAUS 50
    ' Low Portd.5 'r/w low
    ' High Portd.7 'power on the lcd

    TRISB = %00000000
    PORTB = %00000000
    TRISC = %00000000
    PORTC = %00000000
    'High Portc.1 'turn on the led
    'High Portc.2
    Pause 500 ' Wait for LCD to startup
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 4
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 5
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    startup:
    'High Portc.1 'status led
    High Portc.1 'lcd light
    Lcdout $fe, 1
    Lcdout "Hello"
    Pause 1000
    Lcdout $fe, 1
    Lcdout "World"
    Low Portc.1
    Pause 4000
    goto startup

    end

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT Question

    Hi,
    You don't say which PIC you're using so it's hard to check but it's probably a peripheral, like ADC, comparator or something else that is interfering with the port operation when used in digital mode. Check the datasheet regarding what functions are multiplexed onto the pins being used and if anything needs to be turned off.

    /Henrik.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT Question

    Hi Hendrik,

    Thanks for the response. I should have mentioned what I was using. Sorry. I tried with two micros. The 18F252 and 18F452. I will try some things in regard to any interference on those pins.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT Question

    Haha! I figured it out! The problem was that I had the first bit of the lcd 4 bit bus connected to portb bit 2. I overlooked the fact that one can only start the bus at bit 0 or 4 on the ports.

    Thanks Hendrik for your assistance!

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: LCDOUT Question

    And even if you COULD start at bit 2 your DEFINE still said bit 0 so it wouldn't have worked anyway.
    I'm glad you figured it out - sometimes it helps to just step away from it for a while. Well done!

    /Henrik.

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