PIC18F4525 & LCD problem - external resonator ?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Check the data sheet for this PIC. Several PORTB pins are analog intputs at power-up, and
    you'll need to write to OSCCON to configure it for 8MHz internal.

    The default value in OSCCON at reset is for 1MHz.
    I have defined Port B as output port in my code by using TRISB=0.

    And by using the command:
    @_CONFIG_CONFIG1H_OSC_INTIO67_1H

    the internal oscillator is working fine at 8 MHz.

    The LCD is now displaying text messages, but when I try to display a numerical value of a variable or a constant, it doesnt show anythin as the screen remains blank.

    Please Help !!







    DEFINE OSC 8

    '******Setting up the LCD display******

    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50


    @_CONFIG_CONFIG1H_OSC_INTIO67_1H

    TRISB=0 'Set Port B as output



    PAUSE 1000

    LCDOUT $FE, 1
    LCDOUT "PIC - LCD Test "
    LCDOUT $FE, $C0
    STOP

  2. #2
    Join Date
    Sep 2006
    Location
    Mexico
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    Hello, you need to use DEC command, for example:

    b0 var byte

    b0=100

    loop:
    LCDOut $fe, 1
    LCDOut "LCD TEST" 'Display line1
    LCDOut $fe, $c0 'Move to line 2
    LCDOut Dec b0 'Display b0 on LCD
    Pause 500 'Wait .5 second
    goto loop

    end

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    OK. Sorry. You're probably right, but give this a shot just for the heck of it.;o}

    1. Edit your 18F4525.INC file in your PBP directory. Change this line;
    __CONFIG _CONFIG1H, _OSC_XT_1H

    to this; __CONFIG _CONFIG1H, _OSC_INTIO67_1H

    Save the file.

    Note this line: __CONFIG _CONFIG3H, _PBADEN_OFF_3H saves you from having to
    manually disable A/D for several PORTB pins. Just FYI.

    2. Change your code to something like this;

    Code:
    DEFINE OSC 8
    
    '******Setting up the LCD display******
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    
    '@_CONFIG_CONFIG1H_OSC_INTIO67_1H ; this does nothing & it is not a command
    
    TRISB=0 'Set Port B as output
    OSCCON = %01110010
    
    a VAR BYTE
    
    Loop:
      LCDOUT $FE,1,"PIC - LCD Test "
      PAUSE 1000  
      FOR a = 0 TO 255
       LCDOUT $FE, $C0," A = ", #a
       PAUSE 1000
      NEXT a
      GOTO Loop
      
      END
    Does it work now?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. LCD problem with 16F628
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 19th September 2016, 08:28
  2. Newbie? Problem with LCD
    By lew247 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th December 2009, 19:48
  3. LCD Problem
    By karenhornby in forum General
    Replies: 3
    Last Post: - 19th June 2008, 11:43
  4. Migrating from PIC16F690 to PIC18F4525 and having LCD issues
    By jblackann in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th June 2008, 20:05
  5. PIC18F4525 & LCD simple code problem
    By aggie007 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd November 2007, 16:29

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