New user frustration (16F688 + LCD)


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Feb 2010
    Location
    USA, New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default Re: New user frustration (16F688 + LCD)

    You can use the DEFINE statements as in the manual. E.g.,

    ' Set LCD Enable port
    DEFINE LCD_EREG PORTX
    Also, have a look at the LCD_AnyPin thread.

    Best Regards,
    Paul
    The way to avoid mistakes is to gain experience. The way to gain experience is to make mistakes.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: New user frustration (16F688 + LCD)

    Hi,
    The 16F688 has both an ADC and a comparator connected to some of its pins. These peripherals can interfere when trying to use the pin as digital I/O. On some devices these peripherals are disabled by default, on some they are not. On the 16F688 they are NOT disabled so you need to turn them off. How to turn them off also varies across chips but it's quite easy to find in the datasheet. For the the 16F688 you'd do:
    Code:
    CMCON = 7  'Disable both comparators
    ANSEL = 0   ' Set all analog pins to digital
    Then Paul showed you how to remap the pins used by the LCDOUT command. I suggest you do it the standard way with the DEFINE directive as shown in the manual before starting to play with special stuff like the LCD_AnyPin code. If you can't get it to work can you post a schematic of your setup?

    /Henrik.

  3. #3
    Join Date
    Feb 2013
    Posts
    7


    Did you find this post helpful? Yes | No

    Default Re: New user frustration (16F688 + LCD)

    Thank you Paul and Henrik, for trying to help.

    Henrik, I tried the CMCON = 7 command, but it generated a syntax error and wouldnt compile. I searched the web for similar topics, and it was suggested to use CMCON0 = 0, and that compiled without any error. However, the LCD still doesnt work.

    In my search, I found this thread http://www.picbasic.co.uk/forum/arch...hp/t-4896.html , which mentions a patch for PBP, which fixes 16F688 register issues. I wonder if thats what I need to do?

    Here is my current program, which only produces a line of black boxes on the LCD. The LED does blink, as expected....


    CMCON0 = 7 'Disable both comparators
    ANSEL = 0 ' Set all analog pins to digital

    ' Set LCD Enable port
    DEFINE LCD_EREG PORTC

    ' Set LCD Enable bit
    DEFINE LCD_EBIT 0

    LED VAR PORTC.1 ' Pin-9 on 16F688

    Pause 500 ' Wait for LCD to startup

    mainloop:
    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "Hello" ' Display Hello

    high LED

    Pause 500 ' Wait .5 second

    Lcdout $fe, 1 ' Clear LCD screen
    Lcdout "World"

    LOW led

    Pause 500 ' Wait .5 second

    Goto mainloop ' Do it forever

    End



    Thanks for any other further help or ideas.

    Bill

Similar Threads

  1. Interfacing with Arduino I2C LCD
    By norohs in forum Documentation
    Replies: 47
    Last Post: - 30th May 2017, 18:53
  2. PICbasic and 40X4 lines LCD
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th January 2013, 22:42
  3. LCD using 4 data lines, Lab X1
    By queenidog in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th January 2013, 23:10
  4. LCD Low Power
    By kduck63 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th December 2012, 00:05
  5. forum posting frustration
    By Heckler in forum Forum Requests
    Replies: 8
    Last Post: - 16th March 2012, 11:31

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