16f886 and LCDOUT


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2011
    Posts
    5

    Default 16f886 and LCDOUT

    HI ALL. WONDERING IF ANYONE HAS EXPERIENCE WITH 16F886 AND LCD OUT. I'M USEING A LUMEX LCD PART NUMBER LCM S01602DTR/A.
    MY CODE IS..
    '*************
    '************************************************* ***************
    'Configuration Bits
    @ __config _CONFIG1, _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF

    @ __config _CONFIG2, _WRT_OFF

    OSCCON = $71 'SET OSCILTOR TO INTERNAL 8 MHZ
    DEFINE OSC 8

    '------------------------------------------------------------------------------




    '_________________________________________________ ____________________________

    'INITIALIZE PORTS
    'PORT A
    ANSEL = 0 'PORT A DIGITAL
    TRISA = %11111111 'PORT A ALL INPUT

    'PORT B
    ANSELH = %00000000 'PORT B DIGITAL
    TRISB = %00000000 'PORT ALL OUTPUT
    IOCB.0 = 0
    CCP1CON = %00000000


    'PORT C OUTPUTS
    TRISC = %00001111 'PORTC 0-3 INPUT 4-7 OUTPUTS

    '_________________________________________________ ___________________________

    'SET LCD PARAMETERS
    DEFINE LCD_DREG PORTB 'SET LCD DATA PORT
    DEFINE LCD_DBIT 0 'SET STARTING LCD DATA BIT
    DEFINE LCD_RSREG PORTB 'SET LCD REGISTER SELECT PORT
    DEFINE LCD_RSBIT 4 'SET LCD REGISTER SELECT BIT
    DEFINE LCD_EREG PORTB 'SET LCD ENABLE PORT
    DEFINE LCD_EBIT 5 'SET LCD ENABLE BIT
    define LCD_BITS 4 'SET TO 4 BIT
    DEFINE LCD_LINES 2 'SET NUMBER OF LINES ON LCD

    DEFINE LCD_COMMANDUS 1500 'SET COMMAND DELAY TIME IN US
    DEFINE LCD_DATAUS 44 'SET DATA DELAY TIME IN US


    '_________________________________________________ ____________________________

    'DECLARE ALIAS'S

    LED VAR PORTC.4 'LED on a 330 High is on


    '_________________________________________________ ____________________________


    '_________________________________________________ ____________________________

    pause 1000
    LCDOUT $FE,1
    pause 1000
    AGAIN:
    LCDOUT $FE,1,"TO PLAYER"
    LCDOUT $FE,$C0, "FROM PLAYER"

    high led
    pause 1000
    low led
    pause 1000
    goto again

    end

    '''''''''''''
    I'M CONCERNED THAT I MAY HAVE MISSED A REGISTER SETUP ON PORT B.
    ANY INPUT WOULD BE APRECIATED.
    THANKS,
    BILL

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


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Hi BLUEBILL,
    You might look at those comparators and SR latch settings , and sspcon. . .I don't know the power up state of them.
    EDIT: Ok looks like sspcon affects PortC, CM2CON0,CM2CON1, CM2CON2, CM1CON0, somewhere in there I think.
    Last edited by Archangel; - 12th April 2011 at 19:49.
    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
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    BlueBill,

    Do you see anything on the LCD? Are you using a contrast resistor? Also, I think you should change the line

    IOCB.0 = 0

    to

    IOCB = 0

    I don't know if it would make a difference, but you want to disable all the PORB On-Change-Interrupts bits instead of just one.

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    "define LCD_BITS 4 'SET TO 4 BIT"


    "define" should be "DEFINE" all your others were uppercase.

    Manual states

    These definitions must be in all upper case. If not, the compiler may not recognize them. No error message will be produced for DEFINEs the compiler does not recognize

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Quote Originally Posted by aerostar View Post
    "define LCD_BITS 4 'SET TO 4 BIT"


    "define" should be "DEFINE" all your others were uppercase.

    Manual states

    These definitions must be in all upper case. If not, the compiler may not recognize them. No error message will be produced for DEFINEs the compiler does not recognize
    Good catch!! Yes the DEFINE must be all in upper case as stated in the manual.
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  6. #6
    Join Date
    Apr 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Quote Originally Posted by rsocor01 View Post
    BlueBill,

    Do you see anything on the LCD? Are you using a contrast resistor? Also, I think you should change the line

    IOCB.0 = 0

    to

    IOCB = 0

    I don't know if it would make a difference, but you want to disable all the PORB On-Change-Interrupts bits instead of just one.

    Robert
    Hi Robert.

    The LCD is blank which leads me to think i'm not initializing it. I'm using a 20k variable contrast resistor. I made the change IOCB.0 =0 to IOCB = 0 with no change. I will keep experimenting and post my results.
    Thanks again.

  7. #7
    Join Date
    Apr 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Quote Originally Posted by aerostar View Post
    "define LCD_BITS 4 'SET TO 4 BIT"


    "define" should be "DEFINE" all your others were uppercase.

    Manual states

    These definitions must be in all upper case. If not, the compiler may not recognize them. No error message will be produced for DEFINEs the compiler does not recognize
    Sorry, Its cap in MicroCode Studio. It changed when I cut and pasted it.???

  8. #8
    Join Date
    Apr 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Quote Originally Posted by Joe S. View Post
    Hi BLUEBILL,
    You might look at those comparators and SR latch settings , and sspcon. . .I don't know the power up state of them.
    EDIT: Ok looks like sspcon affects PortC, CM2CON0,CM2CON1, CM2CON2, CM1CON0, somewhere in there I think.

    Hi. I replied a couple times but I'm a bit of a novice when it comes to FORUMS.
    I reviewed the registers and even cleared all applicable registers but still no luck.
    I tried manualy initializing by seting portb outputs and strobing the E bit but no joy. Hope this reply works.

  9. #9
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default Re: 16f886 and LCDOUT

    Quote Originally Posted by BLUEBILL View Post
    Hi Robert.

    The LCD is blank which leads me to think i'm not initializing it. I'm using a 20k variable contrast resistor. I made the change IOCB.0 =0 to IOCB = 0 with no change. I will keep experimenting and post my results.
    Thanks again.
    Hmmm, I haven't worked with these LCD displays in a while, but I think 20k is too high. The way I do it is by using a 10k pot and I play with it (change values from 0 to 10k) to find the optimum value. Give it a try and let us know....

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  10. #10
    Join Date
    Apr 2011
    Posts
    5


    Did you find this post helpful? Yes | No

    Smile Re: 16f886 and LCDOUT

    Quote Originally Posted by rsocor01 View Post
    Hmmm, I haven't worked with these LCD displays in a while, but I think 20k is too high. The way I do it is by using a 10k pot and I play with it (change values from 0 to 10k) to find the optimum value. Give it a try and let us know....

    Robert
    Thanks Robert. It is my contrast setting. The LCD works and I'm a bit more educated regarding the special function registers of a 16f886. I did check the setting on an earlier date but had no idea that the supply voltage would be so low. 800mv on pin 3 displays fine. I didn't adjust that far down until your suggestion. Thanks again and thanks for everyones input.

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