Menu

LCD problem with 16f887

2010-04-13
2013-05-30
  • David Stephenson

    I get a compiler problem if I try to use a LCD with a 16F887.

    I get this error

    lcd.h (291): Error: SYSLCDTEMP is not a valid I/O pin or port

    If I look at the ASM file it does indeed contain SYSLCDTEMP (see below)

    LCDNORMALWRITEBYTE
    clrf TRISSYSLCDTEMP
    movf LCDBYTE,W
    movwf SYSLCDTEMP

    If I replace these lines (in the ASM file) with the ones below it works ok.

    LCDNORMALWRITEBYTE
    banksel TRISB
    clrf TRISB
    banksel LCDBYTE
    movf LCDBYTE,W
    movwf PORTB

    The following is the GCBasic code I used to produce the error

    #chip 16F887,4
    #config OSC=INTRC_OSC_NOCLKOUT,MCLRE=OFF,WDT=OFF
    #define LCD_IO 8
    #define LCD_DATA_PORT_B
    #define LCD_RS PORTD.6
    #DEFINE LCD_NO_RW
    #define LCD_Enable PORTD.7
    jj=0
    dim jj as word
    start:
    wait 1 sec
    cls
    jj=readad10(an7)
    locate 0,0
    lcdword jj
    goto start

     
  • Nobody/Anonymous

    Oh no I've just realized I have made an error its should be
    LCD_DATA_PORT PORTB

    Now it works - was not a helpful error message though.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.