Problem with LCD and Start Up


Closed Thread
Results 1 to 14 of 14
  1. #1
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302

    Default Problem with LCD and Start Up

    I have a problem with below code and i don't know how to solve it.
    When start the power on all works ok.But if power of for 1-3 sec and again power on the LCD show chinese and the program not work.If the power of is largest from 3 secs all works ok.
    The pic is 16f84a.

    Code:
    	DEFINE LCD_DREG	PORTB	'Selection of the port B
    	DEFINE LCD_DBIT 0	    'Selection one RB0 with RB3
    	DEFINE LCD_RSREG PORTA	'RS on port A
    	DEFINE LCD_RSBIT 2	    'RS on RA2
    	DEFINE LCD_EREG	PORTA   'E on port A
    	DEFINE LCD_EBIT 3	    'E on RA3
    	DEFINE LCD_BITS 4		'Mode 4 bits
    	DEFINE LCD_LINES 2	    '2 lines    
    	DEFINE I2C_SCLOUT 1
    	
    ' ** DEFINITION OF THE ENTREES - EXITS
    
    ' Exits I2C
    
    	SCL var PORTA.1     ' SCL on RB1 (pine 18)
    	SDA	var	PORTA.0		' SDA on RB0 (pin 17)
    
    ' Boutons
    
    	UP	    var	PORTB.6		'increase the frequency (on RB6)
    	DOWN	var	PORTB.7		'decrease the frequency (on RB7)
    	CH_PAS	var	PORTB.5		'Change the step of synth (on RB5) 
    
    	Input	UP			'Up and Down are entries
    	Input	DOWN
    	Input	CH_PAS
    
    ' ** DECLARATION OF THE VARIABLES
    
        b1	var Byte
        b2	var Byte
        b3	var Byte
        b5	var	Byte
    
        F1	var	Word
        F2	var	Word
        F3	var	Word
    	
    	
        ADDR1   VAR	Byte
        ADDR2	VAR	Byte
    	LOCK	VAR	Byte
    	BAND	VAR	BYTE
    	TMP	    VAR	WORD
    	TMP_LO	VAR	TMP.LOWBYTE
    	TMP_HI	VAR	TMP.HIGHBYTE
    	PLLBASE	VAR	WORD
    	PLL	    VAR	WORD
    	RXPLL	VAR	WORD
    	LO	    VAR	RXPLL.LOWBYTE
    	HI	    VAR	RXPLL.HIGHBYTE
    	PAS	    VAR	BYTE	        	'1=125kHz, 2=250kHz,  4=500kHz, 8=1MHz   
    	
    		
        '*** INITIAL DATA ***	
    	
    	ADDR1=$C2
        ADDR2=$C3		            'adress I2C of SDA5055 (ADDR1=$C0 , adress I2C of TSA5511)
            PLLBASE=720            'beginning with 45 MHz : 45 / 0,0625 = 720
            PAS = 2                 'pas of 0.0625 MHZ by defect
    	PAUSE 100
    	
                  	
    	LCDOUT $FE, 1   		    ' Clear LCD screen
                    LCDOUT "TUNER 45-890 MHZ"   ' post text during 2 second    
               	PAUSE 1000   
               	           	 
        EEPROM 0,[$70,$1c]      'initial data  TMP =7280 ($1C70) corresponds to F = 500 MHz

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    After defining the lcd you must place a pause of about 500 msec.
    This is nessesary to give the lcd a chanche to setup and set all registers insite ok, before receiving de lcd data for the screen.

  3. #3
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mat janssen
    After defining the lcd you must place a pause of about 500 msec.
    This is nessesary to give the lcd a chanche to setup and set all registers insite ok, before receiving de lcd data for the screen.
    I have test this :
    Pause 250 ' Delay for LCD to power up
    and this :
    Pause 1000 ' Delay for LCD to power up
    but nothing.
    The problem is the same.
    I understand , that my problem is the reset on pin 4 (i test 4.7k-10k-33k)
    If i delay the reset on pin 4 for 4 and up secs all work ok.
    Last edited by savnik; - 19th October 2006 at 12:42.

  4. #4
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    if at the top of code before define add the follow code

    Code:
    pause 2000
    @ reset
    it's ok

  5. #5
    Join Date
    Aug 2006
    Location
    Iran
    Posts
    94


    Did you find this post helpful? Yes | No

    Default

    Hi,
    please try this:

    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTB
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 1
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 0
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    pause 100
    lcdout $fe,1,"Hello"
    end


    LCD Connection
    Pin1=Vss: connect to ground
    Pin2=Vdd: connect to Vcc=5V
    Pin3=Vo: connect to middle pin of the POT(20K) to control brightness
    Pin4=RS(register select): connect to micro pins that specify in the software(RB1)
    Pin5=RW(Read/Write): connect to ground because we want to only write
    Pin6=E(Enable): connect to micro pin that specify in the software(RB0)
    Pin7 to 10: No connection
    Pin 11 to 14: connect to RB4 to RB7
    Pin15: connect to Vcc with a resistor(100 or 200 ohm resistor is good)
    Pin16: connect to ground.
    pin 16 and pin 16 are for backlights

    the other two pins of pot should connect to VCC and ground and you should connect the MCLR with a 4.7K or 10K resistor to the VCC.

    if your problem is not solve with this program you have another problem in other parts.

  6. #6
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    thank you for answer , but i have make the circuit on pcb and i can't make changes

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


    Did you find this post helpful? Yes | No

    Default

    be sure you set LVP to OFF, BOD to ON, PWRT to ON in your config fuses.

    I doesn't do magic, but it help in most cases.
    Steve

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

  8. #8
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    be sure you set LVP to OFF, BOD to ON, PWRT to ON in your config fuses.

    I doesn't do magic, but it help in most cases.
    My pic is 16f84a not pic16F628a

  9. #9
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Paul's Theory - It sure sounds like to me that during the 0-3 second period after you turn off the power (and before you turn it on again), the power supply voltage drops low enough to reset the pic but not low enough to reset the LCD. After 4 seconds off, I am guessing the voltage decays enough to reset the processor AND the LCD - the LCD might be in the brown area until 4 seconds passes. You can:

    1)Use a scope to measure the voltage after you turn off the power and see what it does.
    2)Reset the LCD in software as partially described earlier in the week here
    http://www.picbasic.co.uk/forum/showthread.php?t=4851
    3)Change your power supply so that the voltage decays faster when the power is removed.
    4) Board change – move the power for the LCD (not backlight if you have one) to an open pin on the PIC and control it there. (I know your board is does but ... if you need to make a change later)

    the LCD show chinese
    Oh, I am guessing it is japanese you are seeing and not chinese - most controllers have japanese as a second set of data characters built in.

    Just my 2 cents worth
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

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


    Did you find this post helpful? Yes | No

    Default

    chinese or japanese, it's greek to me
    Steve

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

  11. #11
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Smile

    Quote Originally Posted by mister_e
    chinese or japanese, it's greek to me
    maybe japanese

  12. #12
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default now work

    I change the pic16f84a with 16f628a and now work OK
    why this difference;
    my config is
    Attached Images Attached Images  
    Last edited by savnik; - 21st October 2006 at 11:11.

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


    Did you find this post helpful? Yes | No

    Default

    Brown out detect is the answer.

    Maybe the power-up timer could help on your grandpa F84. But more than likely, a capacitor between MCLR and gnd will work... have a look to the F84 datasheet. i'm pretty sure they show you some RESET circuit there.

    It's no coincidence why most PIC have a Brown-Out detect feature now

    I usually set both to ON
    Last edited by mister_e; - 21st October 2006 at 19:29.
    Steve

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

  14. #14
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e
    Maybe the power-up timer could help on your grandpa F84.
    I test but no help.

    Quote Originally Posted by mister_e
    a capacitor between MCLR and gnd will work
    I have capacitor.

    The only solution for me is to replace the 16f84a with 16f628a , or to use a MCP100-101
    Last edited by savnik; - 21st October 2006 at 20:25.

Similar Threads

  1. Newbie? Problem with LCD
    By lew247 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th December 2009, 19:48
  2. Play with LCD on PICDEM
    By The IceMan in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd August 2008, 16:56
  3. PIC HSERIN problem
    By shaiqbashir in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 20th July 2008, 11:08
  4. Need help with LCD number display.
    By Steve Matson in forum mel PIC BASIC
    Replies: 8
    Last Post: - 26th June 2007, 23:07
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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