Moving the LCD


Closed Thread
Results 1 to 11 of 11

Thread: Moving the LCD

  1. #1
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73

    Unhappy Moving the LCD

    Hi all!

    I’ve got a 16F88 and I’m trying to free up a few A/D inputs by moving the LCD to portB only. The beginning of the code I am trying to use looks like this:

    DEFINE OSC 8
    OSCCON = %01110000 ' INTRC = 8MHz
    TRISB = 0

    '---------------- move LCD to portB---------
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    '------------------

    LCDOUT $FE, 1,"TEST"

    ----

    The LCD is hooked up like this: LCD – Pin. 4 – 11, 6 – 10, 11 – 6, 12 – 7, 13 – 8, 14 - 9
    Only thing I get on the LCD is blocks on the top row and it’s permanent.
    I could use some help here, I’m stuck.

    Thanks!

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Assuming everything else is well connected (R/W to gnd, contrast pot etc etc), i feel 2 possible mistakes.

    1. you haven't set your config fuses to use the Internal OSC.
    2. You haven't disable the LVP config fuses.

    One or the other.. or both.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Default

    Hi Steve,

    Thanks for the suggestions.
    Yes, the rest of the LCD wiring are “as usual”.

    However when I try to set the config fuses I get an error in MCS+ “Argument out of range (not a valid config register address)”

    Even with only “@ __config _INTRC_IO” I get the same error. I am new to the 16F88, previously I have used only the 16F628A and no such errors occurred.

    Thanks.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    This one is a little funky... open p16F88.inc file (in your MpasmSuite folder)... go at the end and... you'll discover those lines

    Code:
    ; To use the Configuration Bits, place the following lines in your source code
    ;  in the following format, and change the configuration value to the desired 
    ;  setting (such as CP_OFF to CP_ALL).  These are currently commented out here
    ;  and each __CONFIG line should have the preceding semicolon removed when
    ;  pasted into your source code.
    
    ;Program Configuration Register 1
    ;		__CONFIG    _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC
    
    ;Program Configuration Register 2
    ;		__CONFIG    _CONFIG2, _IESO_OFF & _FCMEN_OFF
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Smile

    Thanks Steve,

    I’ll try this and get back with the result later!
    Will try to figure out which bits I need and how the should be set.

    Thanks again!

  6. #6
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Question

    Hello again!

    I made a small change to the config bits (_INTRC_IO ) and get “Owerwriting previous address contents (2007)” from MCS+. The exact same message pops up with the config bits unchanged. I found a few differences in “P16F88.inc” compared to the datasheet, one example is “BODEN” vs “BOREN” and I am not sure what to make of this. Here’s how the code looks now:


    @ __CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_IO

    @ __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF

    DEFINE OSC 8
    OSCCON = %01110000 ' INTRC = 8MHz
    TRISB = 0

    '---------------- move LCD to portB---------
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    '------------------

    LCDOUT $FE, 1,"TEST"




    Thanks!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by PICante View Post
    Hello again!
    I found a few differences in “P16F88.inc” compared to the datasheet, one example is “BODEN” vs “BOREN” and I am not sure what to make of this. Here’s how the code looks now:


    @ __CONFIG _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_IO

    @ __CONFIG _CONFIG2, _IESO_OFF & _FCMEN_OFF

    DEFINE OSC 8
    OSCCON = %01110000 ' INTRC = 8MHz
    TRISB = 0

    '---------------- move LCD to portB---------
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 4
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    '------------------

    LCDOUT $FE, 1,"TEST"




    Thanks!
    Do it the way it is in the 16F88.inc file
    The configs liisted require you to use MPASM as the assembler.
    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.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Joe, he use MPASM already, hence why he got Argument out of range (not a valid config register address)”

    Picante, read this one...
    http://www.picbasic.co.uk/forum/show...75&postcount=5
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Default

    Hi Joe.

    I am using MPASM!


    Thanks.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by PICante View Post
    Hi Joe.

    I am using MPASM!


    Thanks.
    OK good. Seems I always get in trouble when using the Wife's computer . . .
    OK so all you have to do is open the 16f88.inc file in PBP and insert a semicolon before the config statement like so:
    ;__config _CONFIG1, _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF and it will compile.
    Last edited by Archangel; - 12th April 2008 at 22:55.
    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.

  11. #11
    Join Date
    Dec 2007
    Location
    Sweden
    Posts
    73


    Did you find this post helpful? Yes | No

    Talking

    Allright, I edited the PBP inc file by changing the oscillator to internal this way I don’t need the config fuses in the code. Right or wrong, it’s convenient when testing out things and I am on to the next step in the code, the ADCIN. We’ll see how that will develop, might need more help in the near future.

    Thanks for now Guys!

    You’re the best!

Similar Threads

  1. Is this code not initialising the LCD properly?
    By Platypus in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th January 2010, 19:14
  2. 16f688 LCD what have I done wrong
    By spitfiredriver in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th August 2009, 19:54
  3. LCD Problem
    By karenhornby in forum General
    Replies: 3
    Last Post: - 19th June 2008, 11:43
  4. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30
  5. Dedicated LCD Controller question
    By chuckles in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th February 2006, 14:44

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