Shop OBEX P1 Docs P2 Docs Learn Events
Question regarding Stampworks experiment #11: basic LCD demonstration — Parallax Forums

Question regarding Stampworks experiment #11: basic LCD demonstration

almost_humanalmost_human Posts: 7
edited 2007-08-27 22:33 in Learn with BlocklyProp
Hello,
I'm an electronics hobbyist and new to microcontroller programming. Currently I'm working on Stampworks experiment #11. The experiment is a simple program to control the 2x16 parallax LCD display. I read and understand most of the source code but i have a few questions. The time duration argument of the PULSOUT command being used for the Enable pin is sometimes 3 and sometimes 1. The book offers no explaination on this. I would like to know why sometimes 3 is used and sometimes 1 is used. I know it has something to do with instruction execution time stated in the datasheet of the Hitashi HD44780U LCD driver but i come up with a different number for the PULSOUT duration argument when calculating instruction execution time of the LCD.

Also another question I have is, when initializing the LCD by instruction for 4 bit interface, the datasheet says to pause for more than 100us but the code doesn't pause for that. Why doesn't the code pause for this and how will this affect the initialization of the LCD?

I hope someone that's familiar with programming the LCD can clear this up for me. Any help would be greatly appreciated.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-08-26 14:30
    I haven't read the data sheet or activity but my guess is that 100us is such a short time to the stamp that it is absorbed in the time it takes to formulate the commands needed until the next one to the display

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-08-26 17:40
    It's simply easier to for the LCD to recieve the code instructions by sending enable over a greater time period.

    I am attaching what I think is a more usefull example and it only uses the PULSOUT pin, 3 when it is actually sending data or a command. Also learning how to send data or a command require RS to be hi or low, look for it in the program. The code example is by Ken Gracy.

    Also the data sheet says you need to send the initial command 3 times, but that command· remains on the pins until they are changed. So after the command all that is required, is the initial Enable, the initial long pause and 2 more Enables.

    Post Edited (Capt. Quirk) : 8/26/2007 5:50:56 PM GMT
  • almost_humanalmost_human Posts: 7
    edited 2007-08-26 22:44
    I was thinking the same thing Franklin. The BS2 takes roughly 250us to execute one instruction and that's enough time to absorb the required delay.

    Thanks for the example code Capt. Quirk, it's helpful to see another program written for the LCD. Are you saying that 3 was used arbitrarily just so the LCD will have plenty of time to execute the instruction? But why 3, why not 2, 5 or 10?
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2007-08-27 06:27
    I think Franklin has it more right than I do, but most of my LCD experience with the SX. With the SX a 4mhz resonator, longer pauses work fine without the Busy Flag. But with a 50mhz resonator @ 20ns/cycle the Busy Flag helps. Most of the web sites I read, suggest to set your timming to max values instead of min.


    Post Edited (Capt. Quirk) : 8/27/2007 6:32:34 AM GMT
  • almost_humanalmost_human Posts: 7
    edited 2007-08-27 22:33
    Ok I'm beginning to understand how this works now. So before sending the next instruction to the LCD, you either have to: 1) check the busy flag; or 2) make sure the pause or delay is long enough for the LCD to complete its command? But so far i haven't seen the code to check the BF in a program for the LCD. I'm guessing that's not a very popular option. It'll probably take more time to have the microcontroller check the BF with an if-then statement than to just pause for max value?
Sign In or Register to comment.