Problem with Newhaven LCD on 18LF66K80


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    May 2014
    Location
    Stone, Staffordshire, UK
    Posts
    3


    Did you find this post helpful? Yes | No

    Default Re: Problem with Newhaven LCD on 18LF66K80

    Hello, my code for the LCD is as follows:

    Code:
    ' ------------------------------------------------------
    ' MiniCon Motherboard LCD Test
    ' Kris Douglas 23/05/14
    
    ' ------------------------------------------------------
    ' We will run at 64MHz once the PLL is started up
    Define OSC 64
    
    'LCD Definitions
    DEFINE LCD_DREG PORTA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTF
    DEFINE LCD_RSBIT 2
    DEFINE LCD_REREG PORTF
    DEFINE LCD_RWBIT 3
    DEFINE LCD_EREG PORTA
    DEFINE LCD_EBIT 5
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2100
    DEFINE LCD_DATAUS 500
    
    ' ------------------------------------------------------
    ' PIC18LF66K80 Configuration Bit Settings
    
    ' Basic source line config statements
    
    #CONFIG
        CONFIG RETEN = OFF
        CONFIG INTOSCSEL = HIGH
        CONFIG SOSCSEL = DIG
        CONFIG XINST = OFF
        CONFIG FOSC = INTIO2
        CONFIG PLLCFG = ON
        CONFIG FCMEN = OFF
        CONFIG IESO = OFF
        CONFIG PWRTEN = ON
        CONFIG BOREN = SBORDIS
        CONFIG BORV = 1
        CONFIG BORPWR = ZPBORMV
        CONFIG WDTEN = ON
        CONFIG WDTPS = 1048576
        CONFIG CANMX = PORTB
        CONFIG T0CKMX = PORTB
        CONFIG T3CKMX = PORTG
        CONFIG MSSPMSK = MSK7
        CONFIG MCLRE = ON
        CONFIG STVREN = ON
        CONFIG BBSIZ = BB2K
        CONFIG CP0 = OFF
        CONFIG CP1 = OFF
        CONFIG CP2 = OFF
        CONFIG CP3 = OFF
        CONFIG CPB = OFF
        CONFIG CPD = OFF
        CONFIG WRT0 = OFF
        CONFIG WRT1 = OFF
        CONFIG WRT2 = OFF
        CONFIG WRT3 = OFF
        CONFIG WRTC = OFF
        CONFIG WRTB = OFF
        CONFIG WRTD = OFF
        CONFIG EBTR0 = OFF
        CONFIG EBTR1 = OFF
        CONFIG EBTR2 = OFF
        CONFIG EBTR3 = OFF
        CONFIG EBTRB = OFF
    #ENDCONFIG
    
    ' ------------------------------------------------------
    ' Alias definitions
    
        'Alias the LED on the board
        localLed var PORTA.7
    
        'Alias the LCD control pins
        LCD_Backlight var PORTB.5
        LCD_E2 var PORTF.1
    
        'Alias the buzzer on the board
        buzzer var PORTC.1
    
        'Alias the watchdog
        mbWatchDog var PORTF.7
    
    ' ------------------------------------------------------
    ' Variables
    
        'LCD Variables
        lcdData var byte
        bla var byte
    
    ' ------------------------------------------------------
    ' Set Phase-Locked Loop to Enabled
    
        'OSCCON = OSCCON | %01110000
        'OSCTUNE = OSCTUNE | %01000000
    
    ' ------------------------------------------------------
    ' Port configuration
    
        'Port D needs setting to digital
        ADCON1 = %01101111
    
    ' ------------------------------------------------------
    ' Program code to flash LED and display text on LCD
    LCDOut $fe,1:FLAGS=0:Pause 250
    Main:
        LCDOUT $fe,1, "Hello World"
        pause 1000
    goto Main
    Kris Douglas

  2. #2
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Problem with Newhaven LCD on 18LF66K80

    I am NOT familiar with the chip you are using, but just yesterday I was near to pulling out my few remaining hairs before realizing that I had not set my TRIS registers to output. Is this necessary on the 18LF66K80?

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Problem with Newhaven LCD on 18LF66K80

    Try adding this:
    http://www.picbasic.co.uk/forum/showthread.php?t=18529

    Then check the warnings during compile. It will tell you how to make all pins digital.

    You set port D to digital but I see nothing for port A.

    Robert

Similar Threads

  1. Problem with GOSUB/GOTO and Newhaven OLED question
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th April 2013, 10:24
  2. Newhaven Serial COG 2X16 LCD
    By Neosec in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th March 2013, 06:09
  3. Newhaven 4x40 LCD, issues!
    By MOUNTAIN747 in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 18th October 2012, 22:23
  4. Replies: 36
    Last Post: - 14th March 2011, 18:38
  5. LCD Problem!
    By uaf5000 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th May 2010, 23:06

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts