LCD Data on portA and portB


Results 1 to 32 of 32

Threaded View

  1. #17
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default thanks dwayne

    i think i got the data sturcture of the lcd all figured out and i have made my own routins to control the lcd. my last problem, i hope, is that i didnt realize my lcd is 5x8 pixel not 5x7. soooo.... i need to figure out how to initialize the lcd to 5x8 character size? my lcd wont auto init so i have a sub that does it. but the link below doesnt say how init for a 5x8 character.

    dwayne i havent used external memory before but i think it shouldnt be too hard. i know that i will most likely have to and i actually want to, i think
    yes please let me check that code out that ur buds working on sometime, sounds like ti could be very useful.




    just to update i have a tempory solotuon to my problem and i suggest this method if your hardware isnt designed well. meaning the d4-d7 data lines on the lcd are connected to random port pins.

    as im sure it says above somewhere, i am using 4 bit mode to control my hd44780 compatible LCD. it is a 2 line 8 character diplay with each characters resolutin at 5x8. my data pins are as follows:

    D7 = PORTA.0
    D6 = PORTA.1
    D5 = PORTA.2
    D4 = PORTB.3 (YES PORTB)
    RS = PORTC.0
    E = PORTC.1

    I should note just for clarity that the hd44780 lcd works on a byte by byte basis. meaning that you send it one byte at a time parallely(is that a word), in parallel. But if you are in 4 bit mode, which is recommended becuase you can free up 4 I/O lines, you need to send the same byte size command in 2 steps. firts send the upper half of the byte, clock the lcd, then send the second half, clock the lcd. then it will have recived 1 full command.

    in 8 bit mode i can send %01000001 to pins D0-D7 repectivly. clock E and that is 1 byte so the lcd will update.

    in 4 bit mode i would:
    send %0100 to pins D4-D7 respectivly (upper half)
    clock E
    send %0001 to pins D4-D7 respectivly (lower half)
    clock E
    and it should update.

    so basically just till i get creative with some formulas, im going to stick with the "brute force" method. which is as follow:

    'i want to send an A to the lcd

    lcd7 VAR PORTA.0 'DEClirations MAKES addressing the pins easier.
    lcd6 VAR PORTA.1
    lcd5 VAR PORTA.2 'the variabls should be self expl.
    lcd4 VAR PORTB.3
    lcdrs VAR PORTC.0
    lcde VAR PORTC.1
    '-------------------------------

    GOSUB lcdinit

    lcdrs = 1 'data mode
    pause 10

    lcd4=0
    lcd5=1
    lcd6=0 'upper half %0100
    lcd7=0
    GOSUB lcdtog

    lcd4=0
    lcd5=0 'lower half %0001
    lcd6=0
    lcd7=1
    GOSUB lcdtog

    END

    lcdtog:
    pause 5 ' added pauses to make sure i get the rise i need, i know its too slow
    lcde = 1
    pause 5 'set lcd enable line high
    lcde = 0 'set lcd enable line low
    pause 5
    Return




    lcdinit:
    'the lcd needs to be initialized once, usually early in your program. there a lots of different hardware set ups so youll need to figure thisout. goto:
    http://www.geocities.com/SiliconVall.../lcd/intro.htm
    read the intro section.
    then the command section.
    then get yourself an ascii table.
    and try to use the lcd simulator ( really cool!)
    Last edited by EDWARD; - 7th May 2005 at 08:31.

Similar Threads

  1. Matrix Keypad routine
    By mister_e in forum Code Examples
    Replies: 134
    Last Post: - 18th September 2022, 21:30
  2. PICs can do more if use others than delays instructions
    By hardcore in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 24th February 2010, 20:52
  3. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 15:50
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 21:10
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 6th May 2005, 00:29

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