Driving a 2x16 LCD with only One Pin and 74HC595


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Jan 2014
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Driving a 2x16 LCD with only One Pin and 74HC595

    Awesome, Darrel

    Yes, that's it!!

    Can I also write:

    B = Char
    B = B << 4

    I tested it once more with the Pauseus...it also runs.
    Would you still recommend to use the DelayUS Command in whole code?

    Thanks in advance!
    Last edited by struppi81; - 25th January 2014 at 22:02.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Most definitely, you must not use PAUSEUS.

    And no, you cant use B = B << 4
    The CPU can only shift one bit at a time. So it requires a loop and a variable to count the number of shifts.
    That uses a SYSTEM variable.

    And there are two more issues that cause instability.

    1) The reason I had to change the capacitors is the @ NOP which changes timing with different oscillator frequencies.
    It should be replaced with ...
    Code:
    @ DelayUS 1
    And the capacitors should be left at 4.7nF
    That way it will work with all PBP OSC frequencies.
    .
    2) And this statement also affects System variables, for the same reason as B =B << 4 ...
    Code:
    D = B >> E
    It could be replaced with ...
    Code:
    F  var byte
    G  var byte
    
    ;D = B >> E
    F = E
    G = B
    ShiftLoop
        G = G >> 1
        F = F - 1
    IF F != 0 THEN ShiftLoop
    D = G.0
    Although I have a feeling it can be reduced somehow.
    .
    I think that should give a stable include file.
    At least it works well here.

    But I'll add that you are using common variable names in the include like ...A, B, C etc.
    That means that when someone uses your include, they cannot use those variable names.
    It's better to make unique variable names that are unlikely to be used by the person using your code.
    Descriptive names are the best. Try to use a name that describes what the variable is used for.
    DT

Similar Threads

  1. 2x16 LCD Graphics :)
    By Art in forum General
    Replies: 51
    Last Post: - 13th June 2015, 12:02
  2. Need advice with LCD 2x16
    By fratello in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th April 2011, 07:58
  3. LCD via 74HC595
    By helloo in forum General
    Replies: 7
    Last Post: - 31st October 2010, 21:49
  4. 2x16 lcd problem
    By k3v1nP in forum mel PIC BASIC
    Replies: 11
    Last Post: - 30th October 2008, 05:46
  5. small 2X16 LCD
    By Ron Marcus in forum Off Topic
    Replies: 2
    Last Post: - 26th October 2007, 21:37

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