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

    Hello,

    Yesterday I tested it with an 12F675 at 4 Mhz intOSC and till now it runs stable and fast.
    When I less busy, I will test it out with other frequencies.

    But i have yet again an comprehension question to this code:

    Code:
    LCDsend:
          @  MOVE?AB  _TempChar                 ; Get char sent by LCDOUT, in WREG
          if !LCD_Initialized then LCD_Init     ; Make sure LCD was Initialized 
      LCDAfterInit:
          if TempChar = $FE then RSS=0 : goto LCDsendDone   goto DONE ; next char is Command 
          Char = TempChar
      LCDsendCOM:  
          Goto ShiftLoop_Char
      After_ShiftLoop_Char:
          IF RSS = 0 then                       ; Is a Command
              IF Char = 1 then CommandDelay     ; Long delay for Clear Screen
              IF Char = 2 then CommandDelay     ; Long delay for Home
              @  DelayUS   _LCD_DATAUS          ; Short delay for everything else
              goto DelayDone
          else                        
              @  DelayUS   _LCD_DATAUS          ; Short delay for Data
              goto DelayDone
          endif
      CommandDelay:
          @  DelayUS   _LCD_COMMANDUS
      DelayDone:
        if LCD_Initialized then RSS = 1       ; Set RS to Data next time
      LCDsendDone:
      bsf     STATUS, C       ; Set no timeout for Serout2mod  
    return
    When i compare these steps with them in pbppic14.lib, than i note that in the upper code some parts (Red marked) not exist, like in the library code.

    @ Darrel:
    Are these Commands not necessary or why didn't you include them?


    Further I would shrink this code to this:

    Code:
    LCDsend:
          @  MOVE?AB  _TempChar                 ; Get char sent by LCDOUT, in WREG
          if !LCD_Initialized then LCD_Init     ; Make sure LCD was Initialized 
      LCDAfterInit:
          if TempChar = $FE then RSS=0 : goto LCDsendDone ; next char is Command 
          Char = TempChar
      LCDsendCOM:  
          Goto ShiftLoop_Char
      After_ShiftLoop_Char:     
        if LCD_Initialized then RSS = 1       ; Set RS to Data next time
      LCDsendDone: 
    return
    Because of the fact, that the shifting time of 1 byte needs about 2 - 4ms, it is not nessesary to include extra Delays for Data or Commands.

    Can I do it in this way?



    Thanks in advance!

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


    Did you find this post helpful? Yes | No

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

    If you use GOTO DONE, it limits the use of your include to 14-bit devices.
    In the 18F library, it's called DUNN.

    There's no need to use DONE, since the FSR hasn't been changed, and RETURN resets the BANK to 0 anyhow.

    The bsf STATUS, C is only required if the end user is using the SEROUT2 command with a Flow Control Pin.
    My observations have concluded that nobody uses that function. Or if they understand how to use Flow Control, they probably aren't using LCD_AnyPin.

    However, to cover ALL the bases ... you are correct! bsf STATUS, C should be there. But it needs an @ sign.

    As for removing the delays ... I don't think that's a good idea.
    The measurement I took previously was 1.8 mS per byte.
    Most good LCD's take 1.6 mS for a Clear Screen, so it would be fine (with a good LCD).
    But there are LCD's that take longer, 2.4 mS is not uncommon.

    You could remove the LCD_DATAUS part since it will always be under 1.8 mS.

    But I think the ability to add delays for LCD_COMMANDUS should remain in the program.
    You can easily set LCD_COMMANDUS to 0 in the main program for normal displays.
    For slower LCD's, just set it to the difference of say 2.4 mS - 1.8 ms = 0.6 mS or 600 uS.
    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