LCD Data on portA and portB


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default lcd data on 2 ports

    thanks for all the help so far.

    >>"Of course you could, even without using a PIC by simply having some DIP-Switches on the Data Lines and a PushButton on the Clock Line."

    would it work for only 4 dips for data(d7,d6,d5,d4) plus 1 "clock" button?
    is the clock the E or R/S?

    how many times would the "clock" have to cycle to get a
    command? because only 4 DIPS would mean only 16 combinations.

    or

    does it(lcd) recive a byte of data through a means of 4 bits on 1 clock and the next 4 bits on the second clock?

    if the second is true then i think i can manage a work around.


    yes i agree that the lcdout command would be the best method. unfortunatly im not sure if the original code for this board was written in c or assembly er somthing which may not even matter how it is interfaced.

    '-------


    i know i could design a board to make this eaiser to code, but the whole idea behind this project is to utilize what has already been manufactured and improve on its functionality. in short... No Hardware Mods i really do appreciate all the help i have recived. and i am doing a lot of research before posting.

  2. #2
    G8RPI's Avatar
    G8RPI Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Edward,
    I don't know what type of data you are sending to the LCD, but you need to consider the amount of memory you have available and the time to send it to the display. Your LCD routine will have you convert your byte data into two 4 bit nibbles, and then set the 4 individual output pins to correspond to the correct bits in sequence. This will take time and code space.
    The customer will not pay you more for all this effort. I'd tell him that he should upgrade to a "better" processor, then put a SOIC package 16F876 (or even '877) on an adaptor board (like a Stamp or the Pic 10F "hobby kit") with the pin swap incorporated. You can impress the customer with the "latest surface mount technology" and save yourself a lot of trouble. At 1000 off quantities the board cost should not be bad. You could even include ICSP for field upgrades.

    Robert G8RPI.

  3. #3
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Edward,

    Edward>>2. to use four 1 byte variables (one byte for each data line on lcd) and output serially each byte at the same time

    or

    1. pick what bit holder in a byte to output on a specifed port.
    <<

    You can load up those 4 bits... and they will not affact your LCD, until you trigger the clock on the chip... Which refers to your #2. Since you already have 4 lines going to your LCD anyhow...this could be a nice software option. Personally I like Ralphs idea of cut a and paste a wire... (nice and slick).

    #1 in conjunction with number 2 would work slick as snot. My only question would be, when assigning the output to the port, will it affect the ports that are not supposed to be LCD controllers? Only you know that.

    For example... PortB.3 is not used as a LCD data pin... what is it used for? would changing its value by using a quick byte assignment affect your outcome? or is it better to Assign Bits 0-2, separately with a shift, and assign port A.3 separately to ensure proper operation of the circuit.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  4. #4
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default lcd on both ports

    thanks for the update guys. wow this is a great forum!

    g8rpi- yes a simple HW change would do but thats not and option also, in case you forgot there is a 256 byte eeprom on board along side of the pic16f73, which my best gues was that they store the lcd data in that and call it serially.

    dwayne - i am interested in how many clock cycles does it take to send a single command to the lcd. i have saved the hd44780 commands page that someone gave me.

    could i do this for example:

    'on the lcd
    1. make pin D7,D6,D5,D4 be a number %0000 to %1111 (0 to 15)
    2. send a clock signal from the pic
    3. make pin D7,D6,D5,D4 be a number %0000 to %1111 (0 to 15)
    4. send another clock signal from the pic
    5. and the screen whould diplay something?

    i know that R/W is grounded to make it only in write mode.

    im not sure on the E and r/s bit.
    R/S lets the LCD know if its ascii data or a command it is receiving, right?
    1.should E (enable) be high all the time, since i want my lcd on all the time?
    2.WHERE DO I SEND THE CLOCK PULSE TOO?? (Enable ?)
    3. Is the data ascii? if so do i send the upper half or lower half of the byte first?

    when you made your switch controlled lcd did you have to initialize it?
    Last edited by EDWARD; - 6th May 2005 at 06:07.

  5. #5
    EDWARD's Avatar
    EDWARD Guest


    Did you find this post helpful? Yes | No

    Default answer your own questions

    well it sure is embarssing when you answer your own questions.

    1. E is the "Clock" line
    2. R/S tell the LCD whether the incomming data is intruction data or diplay data.
    3. all display data is in ascii format.

    A. initalization sequence before using the lcd.

    B. i send the upper half (4 bits), make E go from high to low to high, send the lower half (4 bits), make the E go from high to low to high.



    If any of these statements are wrong then please correct me. this is what i have gathered and not 100% on it all.

  6. #6
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Edward,

    Edward>>If any of these statements are wrong then please correct me. this is what i have gathered and not 100% on it all.<<

    I do it to myself all the time.... <g> Looking good.

    Hey BRIAN!!!!! I have been working with you on the LCD via Email, can you send me that LCD routine? So that I have it at work?? I think Edward could use it.

    Edward... I am at work, and I logon to this forum at work. I do not have equipment to test or anything like that, so I have to go my memory. Brian is working on a LCD routine that is "Manual" almost exactly like what we are talking about... I uploaded him a copy of my routine... It is very simple, and acts almost exactly like the LCDout. I hope he will post it here if he sees it.

    It is something like this:

    Loop:
    Serin porta.0 Data

    if Data<>254 then
    (assign the pins of your LCD)
    (Toggle the Clock)
    LCDcommand=0
    endif

    if Data==254 then
    LCDcommand=1 'Hey! lets input a command like clear screen!
    endif
    goto loop

    If you look at this, if a $FE is sent, your program will turn on the command part of your LCD, and the following character will be your command...like
    $FE $01 Clear the screen...just like the LCDout.
    after the clear screen, the LCDcommand toggle is automatically turned back to DATA input, not command input.

    The difference is, a 4 bit machine will have to have 2 sets of 4 bits sent... not one large 8 bit of data.

    Now about the speed.. the speed *can*actually be MUCH faster than LCDout... you can control the speed to your LCD...You do this by the pause command. You can adjust a pause, to where it will printout on the LCD correctly. And if you make the pause to short, the data will not completely be displayed on the LCD. What I did on my project, was start with a long pause, and slowly made the pause shorter and shorter, until my display data was incorrect. the data zips across the LCD now <g>. No flashing, waiting, or scrolling... It appears out of nowhere <g>. You may want to set your pause to a safer level, especially since you have 1000+ LCD's that make work better at different speeds.

    Dwayne
    Last edited by Dwayne; - 6th May 2005 at 16:26.
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  7. #7
    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