16x2 lcd with pic16f690

Discussion in 'Embedded Systems and Microcontrollers' started by gpm, Nov 23, 2011.

  1. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    hi all
    its my first wisit to this site my project is ac voltmter on 16x2 lcd using pic16f690
    my problem is..as
    project is working well at my test bench but when i installed it on stablizer few digits of lcd get changed with viltage change(when relay operates) am using 4 bit mode in c, i don't connected remaining 4 free pins of lcd to ground
    is my prob. due to not grounding free 4 pins or some other problem
    pl. help any one
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    You have to pinpoint where the error is being made. Try to determine if the error is in the reading from the ADC or the LCD being at fault.

    You can begin by writing a test program that slowly displays on the LCD values counting upwards from zero. This is let you know if the LCD is working properly.
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Can you post your schematic. What is the relay controlling?
     
  4. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    special thanks to Sir
    what happend is i wrote on lcd
    '' Voltage = xxx V '' (xxx is voltage read by ad & displayed on lcd )
    what happend when relay make break
    '' Voltage 2 xxx V ''
    then
    '' Voltage $ xxx V ''
    or
    '' Voltage 2 xxx w ''
    something like that...
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    As I suggest, forget the ADC reading for now. Can you display numbers incrementing by 1?
    You will need to use this feature in order to find the rest of your problem.
     
  6. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    four relays r there for controlling stablizer voltage
    before prob. was of resetting controller then i replaced .1 cap to 22uf at pin vcc and vss
     
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Sorry for asking. But to be sure. Is it the ADC reading (value)that change. Or is it the characters shown in the display that change
     
  8. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    every thing ok at my test bench prob. occurs only when i connect it to field perhap transiant disturbing lcd
     
  9. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    adc is reading voltage on xxx, updating xxx every 1/2 sec rest are written once
     
  10. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    can u tell me is it compulsory to ground free pins of lcd when used in 4 bit mode from preventing malfunctioning?
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    The answer is NO.

    Please do as I suggest. Anything can change from one test situation to another. I suspect that your problem is in the ADC/analog/power supply filter/ section.

    But before we go any further we have to confirm what is working. We will need a working LCD to test any further. Have faith in me. I have been doing this sort of thing a few days longer than you have been.
     
    gpm likes this.
  12. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    i think prob. not in adc nor in analog it is in power filtring cos lm7805 is aprox. 10 cm away from pic16f690' s vcc pin it was resetting earlier when relay make break, then i put 22uf cap at pin 1 and 20 of microcontroller resetting prob sorted but lcd prob starts....
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,449
    3,365
    Ok, I guess you don't need my help.
     
    gpm likes this.
  14. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Re the unused pins of the LCD, you can leave them unconnected. It's standard for the pins to have built-in pullups to Vcc.
     
    gpm likes this.
  15. gpm

    Thread Starter New Member

    Nov 23, 2011
    10
    0
    sorry if u mind my any word, actually it is my 2 project first was of ammeter (aprox. 50 pcs. ), that is working well, i dont change either adc or software setting except volt insted of ampere ,
    i made changes in pcb design according to fitting, then resetting of controller starts than i put 22 uf cap. there now lcd prob starts.
     
  16. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Make sure you have a snubber diode across the relay coils, pointed 'backwards', pointed toward V+.

    Put a 1k resistor in series between the voltage source and the ADC input pin. Also add a 0.01uF cap on the ADC pin to ground as well to prevent transients from being measured.

    This is, of course, assuming the LCD is functioning without issues in the field, as MrChips has pointed out. At this point, we don't have enough information, and can only throw guesses out, and if you don't act on them, it makes it extremely difficult to assist you.

    So make a loop to run the LCD through it's paces, both fast and slow, and look for any glitches in the field/wherever the problem shows up, using strings and counts from code, not from the ADC.

    If not, try adding the cap and input resistor to protect the PIC from surges and to filter out high frequency noise (the capacitor isn't large enough to filter frequencies the PIC can distinguish at 15μS-30μS (roughly) total sampling & read time and only 10 bits.
     
    gpm likes this.
  17. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    It is reason for why we asked for your schematics you know.
     
Loading...