LCD and 16F88


Closed Thread
Results 1 to 19 of 19

Thread: LCD and 16F88

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    MI
    Posts
    33

    Default LCD and 16F88

    Hello all
    Recently made the to switch from MBasic to PBP.

    Here my trouble, my project is using a 16F88 with the 4MHz bootloader.
    (So cool you can now use a bootloader with a 16 pin PIC)
    Can download/read just fine with the hardware setup(Max232 chip,etc)
    Even did a test program to blink an LED to check bootloader function.

    However following the example in the book for LCDs (16f84) the LCD will
    only display a solid black line. All connections have checked, rechecked
    and then checked some more. Not a connection problem.

    Here is the section that defines port/pins used for PIC to LCD.
    Believe I has port A set to digital

    Define LOADER_USED 1

    Define LCD_DREG PORTA
    Define LCD_DBIT 0
    Define LCD_RSREG PORTA
    Define LCD_RSBIT 4
    Define LCD_EREG PORTB
    Define LCD_EBIT 3
    'Define LCD_BITS 4
    'Define LCD_LINES 2
    Define LCD_COMMANDUS 2000
    Define LCD_DATA

    ' Allocate variables
    command var byte ' Storage for command
    i var byte ' Storage for loop counter
    temp var word ' Storage for temperature
    DQ var PORTB.7 ' Alias DS1820 data pin
    DQ_DIR var TRISB.7 ' Alias DS1820 data direction pin

    CMCON = 7'<===========BELEIVE THIS TURNS THE COMPATOR OFF!!

    ADCON1 = 7 ' Set PORTA and PORTE to digital

    Low PORTA.4 ' LCD R/W line low (W)
    Pause 1000 ' Wait for LCD to start

    Lcdout $fe, 1, "Temp in degrees C"' Display sign-on message


    For some reason the "DEFINE" changed to "Define" when coping and pasting to
    this post. In my code they are all capitol, etc "DEFINE"
    What am I doing wrong.
    Gordon

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default 16f88 is not an 16f84

    Hello G-R-C,
    the 16f88 has more going on than a 16f84. you need all 3 of these for this chip:
    ADCON1 = 7 ' or ADCON1 = %00000111 'Disable A/D converter
    ANSEL=%00000000 ' set all analog pins to digital
    CMCON=7
    Hope this helps
    JS
    edit: also look at this currant thread and follow the VB Highlighted tags.
    http://www.picbasic.co.uk/forum/showthread.php?t=5646
    Last edited by Archangel; - 4th February 2007 at 04:21. Reason: add
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    May 2006
    Location
    MI
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Wow! Joe that was fast reply.

    I'm going to try your suggestion right now. The

    ANSEL=%00000000 ' set all analog pins to digital

    is what I think is the missing piece.
    Will let know how this goes.
    Thanks for your help.
    Gordon

  4. #4
    Join Date
    May 2006
    Location
    MI
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Tried the

    ANSEL=%00000000 ' set all analog pins to digital

    still no luck. Just the solid black line across the
    top of the LCD. Any other suggestions/ideas.

    Thanks in advance.

  5. #5
    Join Date
    May 2006
    Location
    MI
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Got going Joe.
    Thanks for the tips and the link to the thread. Found it was a huge
    help.

    Thanks again, now I can move forward with this project.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Yes a couple

    Hi Gordon,
    It's like being married, it's not that you did anything wrong, maybe sometimes just not enough
    I would add some housekeeping code like:
    Code:
    TrisA = %11110110    ' make port 0 and 4 outputs for lcd
    TrisB = %11110000    ' make lower 4 bits outputs for lcd
    I would add code to set the config fuses so as not to have to remember
    when programming. I would temporaraly add an lcdout to run once at startup, something like:
    Code:
    start: ' this goes after your defines and adcon, ansel etc . . . 
    Lcdout $fe, 1, "Gordon's Thermometer"
    pause 1000
    
    main:
    all of your other code goes here
    
    
    goto main
    end
    just to make sure the lcd is working and I would add a pause 1000 just before that to allow lcd time to initialize.
    If you do not see the splash screen, you won't see anything else, and then you know to check wireing, contrast etc . . .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Code:
    Low PORTA.4 ' LCD R/W line low (W)
    Pause 1000 ' Wait for LCD to start
    Delete the first line and add a pullup ressistor to RA4

Similar Threads

  1. LCD and HSEROUT do not mix well ?
    By Johan in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 17th November 2008, 16:38
  2. 16f88 to parallax 2x16 lcd
    By rdxbam in forum General
    Replies: 10
    Last Post: - 9th November 2008, 21:19
  3. 16f88 can't get lcd to work
    By nicjo in forum General
    Replies: 12
    Last Post: - 13th December 2006, 02:20
  4. Can't get LCD to work with 16F88
    By jswayze in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 10th September 2004, 11:05
  5. 4 line LCD with 16F88
    By anj in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 09:06

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