16f88 to parallax 2x16 lcd


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2008
    Posts
    29

    Default 16f88 to parallax 2x16 lcd

    to get a small test picbasic program to write to this LCD, what port/pin should one use on the 16f88? this LCD has on a Rx pin to receive data. i was thinking the pin would be RB5/PORTB.5.

    would that be correct?

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    You can use just about any pin as long as it is not configured for analog for the serial output.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default 16f88 to parallax 2x16 lcd

    ok, thanks!

  4. #4
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default code to display a string to the parallax lcd

    should this code work to get the parallax to display a string?




    '===============================
    '' pic16f88

    INCLUDE "modedefs.bas"


    'DEFINE OSC 10 ' 4MHz doesn't work try others

    TRISB = %00000000 ' PORTB all outputs
    ADCON1 = %00000111 ' Disable A/D converter
    ANSEL = %00000000 ' all analog pins to digital

    '================================

    PinOut VAR PORTB.5 ' Tx on RB5
    Led3On VAR PORTB.3 ' turn on LED if Tx

    '================================

    BAUD con 16780 ' 2400 Baud, inverted, NoParity: conservative for testing

    '================================
    PinOut = 0 ' set to a norm state
    PAUSE 100 ' a little wait time

    HIGH PinOut
    HIGH Led3On

    Pause 5000 ' LCD start up delay
    SEROUT2 PinOut, BAUD,["STR-1 012345678",13,10]
    LOW Led3On
    PAUSE 5000

    '================================

    Loop:

    HIGH Led3On
    SEROUT2 PinOut, BAUD, ["STR-2 012345678",13,10]
    PAUSE 5000
    LOW Led3On
    SEROUT2 PinOut, BAUD, ["STR-3 012345678",13,10]
    goto Loop

    END

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    No, you are missing a bit here and there. Serial LCDs have their own command set. I went to this page and think these are the ones for you.
    http://www.parallax.com/Store/Access...%2cProductName

    Code:
    LcdBkSpc        CON     $08             ' move cursor left
    LcdRt           CON     $09             ' move cursor right
    LcdLF           CON     $0A             ' move cursor down 1 line
    LcdCls          CON     $0C             ' clear LCD (use PAUSE 5 after)
    LcdCR           CON     $0D             ' move pos 0 of next line
    LcdBLon         CON     $11             ' backlight on
    LcdBLoff        CON     $12             ' backlight off
    LcdOff          CON     $15             ' LCD off
    LcdOn1          CON     $16             ' LCD on; cursor off, blink off
    LcdOn2          CON     $17             ' LCD on; cursor off, blink on
    LcdOn3          CON     $18             ' LCD on; cursor on, blink off
    LcdOn4          CON     $19             ' LCD on; cursor on, blink on
    LcdLine1        CON     $80             ' move to line 1, column 0
    LcdLine2        CON     $94             ' move to line 2, column 0
    LcdCC0          CON     $F8             ' define custom char 0
    LcdCC1          CON     $F9             ' define custom char 1
    LcdCC2          CON     $FA             ' define custom char 2
    LcdCC3          CON     $FB             ' define custom char 3
    LcdCC4          CON     $FC             ' define custom char 4
    LcdCC5          CON     $FD             ' define custom char 5
    LcdCC6          CON     $FE             ' define custom char 6
    LcdCC7          CON     $FF             ' define custom char 7
    This should work.
    Code:
    SEROUT2 PinOut, BAUD,[LcdBLoff, LcdOn1, LcdCls]
    SEROUT2 PinOut, BAUD,["HELLO WORLD"]
    Try a test program with all of the above.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default follow up

    thanks for the tip. i dl'd two of the code samples from that page, mixed and matched and it still didn't work. i looked too at the melabs pages for the diff's of BS2 and PBP, just in case. but i did get it to work ,,,

    0. without setting the values for these, OSC and OSCCON, could not get anything written to the LCD. i set them for 8MHz, as 4MHz would not work. so i looked at section 4.6.1 of the datasheet and set the following...

    DEFINE OSC 8
    OSCCON= %01110100 ' internal RTC Oscillator freq select
    ' [bits 6-4 = 8MHz], [bit 2] INTOSC freq stable bit set

    1. configuration was set as HS, WDT_ON, PWRT_ON, BOD_ON, MCLR_OFF, PROTECT_OFF

    2. the baud rate set using these values, "396 or 16780" didn't work for me. but t2400 does.

    thanks for your help!!!!

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I do not have the same LCD as you have to test, so I am not positive the commands are correct.

    BUT...I now see some other problems.
    First, with out changing any of your settings make an LED blink at say one second on and one second off and see if the timing is correct.
    Code:
    LOOP:
    HIGH PORT?.?
    PAUSE 1000
    LOW PORT?.?
    PAUSE 1000
    GOTO LOOP
    When you see it is not, here is why.
    In your config settings HS is for an external OSC, you need "_INTRC_IO"

    Wait a minute ... Did you get it working???
    2. the baud rate set using these values, "396 or 16780" didn't work for me. but t2400 does.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    yes, i did get it to work. and yes, i am able to get a LED to blink from PORTB.3 and get string of char's to display on the LCD now.

    and, this is whether i set INTRC_OSC or EXTRC_OSC. although i am not using an external OSC!

    for my current code, at least from the process of elimination, having these two values, "DEFINE OSC x" and "OSCCON= x" set correctly made the difference along with the baud rate.

    thanks!

  9. #9
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Hey Mackrackit,

    forgot to mention this...SEROUT2 vs SEROUT. i.e., SEROUT2 didn't work for me. once i switched to SEROUT, along with the other modifications, it has worked well. looks like some diff with the "true" or "inverted" mods with baud?? as i'm new to this hard to say for sure...

    thanks!

  10. #10
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rdxbam View Post
    Hey Mackrackit,

    forgot to mention this...SEROUT2 vs SEROUT. i.e., SEROUT2 didn't work for me. once i switched to SEROUT, along with the other modifications, it has worked well. looks like some diff with the "true" or "inverted" mods with baud?? as i'm new to this hard to say for sure...

    thanks!
    Just for fun now that it is working, try the SEROUT2 again.
    SEROUT is 8N1 so SEROUT2 396 should work. But maybe that is why MELABS has SEROUT so it works with Stamp stuff??
    Dave
    Always wear safety glasses while programming.

  11. #11
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    SEROUT2 396 worked

    >>But maybe that is why MELABS has SEROUT so it works with Stamp stuff??

    they are similar to the BS2 commands according to the PBP docs:

    http://www.melabs.com/resources/pbpmanual/5_61-5_64.htm

    i think, in my case, not getting the OSC & OSCCON defined correctly was throwing my troubleshooting off, and thus, at times, incorrectly thinking SEROUT2 was not working.

Similar Threads

  1. 2x16 lcd not working with pic16f72
    By vu2iia in forum Schematics
    Replies: 4
    Last Post: - 16th February 2011, 14:59
  2. 2x16 lcd problem
    By k3v1nP in forum mel PIC BASIC
    Replies: 11
    Last Post: - 30th October 2008, 04:46
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  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