Can't get LCD to work with 16F88


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Jeff,

    > This code did the trick. Thing is, it was no different than my
    > previous attempts except for using B4-B7 instead of B0-B3.
    > There must be a trick I'm missing somewhere.

    I'm not sure why it wouldn't work for you assuming you had everything connected per your LCD DEFINE's.

    I'm sure if you look "very" carefully at how you had everything physically connected, then look at your previous LCD DEFINE's - you'll find your answer.

    For your A/D try this. It's using the previous 16F88 LCD example that's already working for you - so it should work as-is.

    Note: 1st measure your +Vref (ground & Vdd). If it's < or > 5V, then simply change the quanta value.

    Example: If you measure 4.95V from gnd & Vdd, then +Vref = 4.95V : Quanta=4.95V/1023*256=1.238=1238.

    The result is fairly accurate @ +/- ~0.01V.

    @ DEVICE INTRC_OSC, LVP_OFF, WDT_OFF, MCLR_OFF

    define OSC 8
    Define LCD_DREG PORTB
    Define LCD_DBIT 4
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 3
    Define LCD_EREG PORTB
    Define LCD_EBIT 2
    DEFINE LCD_COMMANDUS 2000
    Define ADC_BITS 10 ' Set number of bits in result
    Define ADC_CLOCK 3 ' Set clock source (3=rc)
    Define ADC_SAMPLEUS 50 ' Set sampling time in uS

    Quanta con 1251 ' +Vref = 5V : Quanta=5V/1023*256=1.251
    Line1 CON $80
    ADval var word ' Create ADval word-sized variable to store result

    TRISA = %11111111 ' Set PORTA to all input
    CMCON = %00000111 ' Disable analog comparators
    ANSEL = %00000001 ' Set PORTA.0 = A/D in, rest digital
    ADCON1 = %10000000 ' Right Justify A/D result
    OSCCON = %01110000 ' INTRC = 8MHz
    Pause 500 ' Wait for LCD to startup

    loop:
    ADCIN 0, ADval ' Read A/D on RA0
    ADval = (ADval*10) */ Quanta
    LCDOUT $FE, 1 ' Clear LCD
    LCDOUT $FE, Line1+3,dec ADval dig 4,".",dec4 ADval,"Vdc"
    Pause 1000
    Goto loop ' Do it forever

    Last edited by Bruce; - 5th September 2004 at 04:01.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  2. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  3. 16f88 can't get lcd to work
    By nicjo in forum General
    Replies: 12
    Last Post: - 13th December 2006, 02:20
  4. Why doesn't my code for 18f452 work on 18f252?
    By senojlr in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd December 2005, 02:42
  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