SOUND makes LCD quit working


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default SOUND makes LCD quit working

    I am using PORT B to supply power to the LCD and generate a tone.
    In the code below, when the SOUND command executes, the LCD goes blank.
    If I comment out the SOUND command, the LCD stays on. What's going on?

    TRISC = %00000000
    TRISA = %101100
    TRISB = %10000000

    @ DEVICE pic16f689,wdt_off

    HIGH PORTB.4 'Turn on power to LCD

    Define LCD_DREG PORTC 'Set LCD data port
    DEFINE LCD_DBIT 0 'Set LCD starting data bit
    DEFINE LCD_RSREG PORTC 'Set LCD register select port
    DEFINE LCD_RSBIT 4 'Set LCD register select bit
    DEFINE LCD_EREG PORTC 'Set LCD enable port
    DEFINE LCD_EBIT 5 'Set LCD enable bit
    DEFINE LCD_BITS 4 'Set LCD bus size
    DEFINE LCD_LINES 2 'Set LCD number of lines

    OPTION_REG = %00111000
    ANSEL = 0
    CM1CON0 = %00000000

    LCDOUT $fe,1
    LCDOUT DEC 9999

    PAUSE 1000

    SOUND PORTB.6,[118,200]

    END

    Thank you for your help.

  2. #2
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I'm not sure if that's your whole code or not. You should really have a small delay before your program starts to allow the Power supply to settle properly. There should also be a delay for the lcd to initialise properly before sending data to it. These are unlikely to be the cause of your problem but it's good practice. Try placing a PAUSE 500 before you send PORTB.4 high. 500ms delay before writing to the LCD should be enough time for the majority of LCDs to intialise correctly.

    When you say power the LCD from PORTB you're not talking about the backlight as well are you? The PIC pins can only supply 25mA and some LCDs can take a lot more than that to light.

    Just to check, PORTB.6 is not accidentally connected to one of the LCD pins is it?

    Cheers

    Rob

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


    Did you find this post helpful? Yes | No

    Default

    at the end of your program, you should or finish by a STOP command or with an endless loop, unless your PIC may behave in a weird way.
    Code:
    Here:   GOTO Here
    You may also need to check if ALL ADCs and comparators are disabled. Here i see 2 missing lines
    Code:
    ANSELH = 0
    CM2CON0 = 0
    And then what you drive and how, may help us to go deeper in our understanding.

    HTH
    Steve

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

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help! The ANSELH = 0 line fixed the problem! This is a small part of my program. As I use PORTC to control the LCD, it's a wonder this hasn't caused more problems before now. I thought I RTFDS enough, but apparently not! Thanks again.

Similar Threads

  1. 2x16 lcd not working with pic16f72
    By vu2iia in forum Schematics
    Replies: 4
    Last Post: - 16th February 2011, 14:59
  2. My LCD code is not working...
    By kvrajasekar in forum mel PIC BASIC
    Replies: 2
    Last Post: - 7th December 2008, 05:41
  3. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  4. Simple LCD code not working..
    By davewanna in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th April 2008, 13:55
  5. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07

Members who have read this thread : 1

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