Write and Read from eeprom


Results 1 to 24 of 24

Threaded View

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

    Default Write and Read from eeprom

    I have the below code (one part of code).
    My problem is when turn off the power and after turn on again , don't save the value P in the eeprom always.Why;
    I use 16f88
    Code:
        P VAR WORD	          'value of the divider
        FLAG VAR BYTE
    
    
        READ 3,FLAG
        IF FLAG = 55 THEN
        READ 1,P.BYTE0        ' Divider
        READ 2,P.BYTE1
        ELSE
    	P= 256	        	  ' value of the divider	
        ENDIF
        
    ..
    ..
    ..
    ..
    ..    
        
    '************************** CHOICE OF THE DIVIDER ***********************
    
    PREDIV:
    
    	LCDOUT $FE,1,"*    DIVIDER   *"
    	LCDOUT $FE,$C0,"     P = ",#P
    	
    LOOP:	
        BUTTON PLUS,0,10,5,B1,1,PICK	    ' Goes to PICK if press the button
    	BUTTON BMENU,0,255,0,B4,1,MEN	
    	PAUSE 100
    	GOTO LOOP
    	
    PICK:	
        IND = IND + 1
    	IF IND< 9 THEN CHOIX
    	IND= 0
    	GOTO CHOIX
    	
    CHOIX:	
        LOOKUP2 IND,[1,10,16,32,40,64,80,128,256],P
    
    	WRITE 3 , 55
    	WRITE 1 , P.BYTE0      	            ' SAVE The VALUE OF P
    	WRITE 2 , P.BYTE1
        PAUSE 100
    	
    	GOTO MAIN
    Last edited by savnik; - 19th March 2007 at 08:10.

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. write -read problem?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th August 2009, 13:06
  4. PIC16F684 + LCD to use the 256bytes of EEPROM - HELP
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th March 2008, 14:19
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

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