EEPROM writes and reads


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    Thanks for the reply,

    I figured that the first time through, there would be no value, but after any use of the device, from there to eternity, there would be a value to work with. Subsequent tries are still not working as expected.

    In light of your advice, I will look at it again and see where I can get something out to determine what I'm missing.

    Darrel, If you looked at the whole thing, you may have noticed that there was a block in there that you suggested for the RX. I haven' completely understood it yet so I haven't implemented it yet. I like what I understand and I will get to it, so please don't feel your efforts were in vain.

    Thanks again
    Bo

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Boroko

    Here's an example of what I usually do ...

    Code:
    	mesure 		VAR WORD
    	duree  		VAR WORD
    	dureeprog  	VAR WORD
    	dureeral	VAR WORD
    	dureesafe	VAR WORD
    	echantillon	VAR WORD
    	lastok		VAR WORD
    
    	delay    	VAR BYTE
    	wrong 		VAR BYTE
    	ohoh		VAR BYTE
    	
    	side 		VAR BIT
    	flagbougie 	VAR BIT
    	battok		VAR BIT
    	dejavu		VAR BIT
    	 	 
    	PORTA = 0
    	PORTB = 0
    
    'Pour 16F628
    
    	CMCON = 7
    	CCP1CON = 0
    
    ' End of Config.
    
    '******************************************************************************
    '  EEPROM checking
    '******************************************************************************
    
    
    	Read 2,dureeprog.lowbyte
    	Read 1,dureeprog.highbyte
    	Read 3,side
    	Read 5,dureesafe.lowbyte
    	Read 4,dureesafe.highbyte
    	Read 7,dureeral.lowbyte
    	Read 6,dureeral.highbyte
    '	Read 8,flagbougie 		'Seulement si déverrouillé, sinon 0
    
    	IF ( dureeprog <> $FFFF ) AND ( dureesafe <> $FFFF ) AND ( dureeral <> $FFFF ) Then 
    	
    	lastok     = dureesafe ' If memory programmed
    	flagbougie = 0         ' Start on locked position ... for safety.
    
    	GoTo locked            ' Starting address
    
    	EndIF
    	
    
    '******************************************************************************
    ' Measure of programming pulse
    '******************************************************************************
    
    
    	IF reset = 0 Then mesurepro   ' If jumper ON jump to programming mode
    
    '******************************************************************************
    ' Check if programming jumper ON and lock if not
    '******************************************************************************
    
    
     oubli: 
    
    	error = 1
    	Pause 50
    	error = 0
    	Pause 50
    
    	GoTo oubli
    
    	
    '********************************************************************
      mesurepro: ' Programming mode
    
    	led = 1 : error = 1
    
    
     mesurepro1:
    
    	Pause 50
    	led = 0 : error = 0
    
    ...
    ...
    Looks EXACTLY what Darrel told you ... no ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    Hi Alain,

    I see that you have given an example of what Darrel was saying (thanks), but I don't understand why you needed to READ the data in that order. Obviously to get .lowbyte and then .highbyte,but why is that necessary?

    Is that just for your application or is that something that I need to pay attention to?

    Is there anything wrong with just storing it in order in the first place?

    My understanding is that you cut this example out of one of your existing apps and the rest of the code doesn't necessarily apply to mine, right?

    For mine, I believe that I would do the IF/THEN to check for $FFFF, and if it were blank, give it a start value.


    Darrel,
    Thanks for your feedback. I didn't see that I wasn't getting to the first "call DlyTime" just before main been executed.

    Guys, thanks for looking at. Sometimes the finer points are the ones that are hard to catch. "codeblind" has a nice ring to it ;-}

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by boroko View Post
    Hi Alain,

    I see that you have given an example of what Darrel was saying (thanks), but I don't understand why you needed to READ the data in that order. Obviously to get .lowbyte and then .highbyte,but why is that necessary?
    Is that just for your application or is that something that I need to pay attention to?

    Is there anything wrong with just storing it in order in the first place?
    Hi, Boroko

    Here, it's on your own ... you place your variables in the order you want ... just always use the same order, not to mix them ...



    My understanding is that you cut this example out of one of your existing apps and the rest of the code doesn't necessarily apply to mine, right?

    For mine, I believe that I would do the IF/THEN to check for $FFFF, and if it were blank, give it a start value.
    YES, of course ... may be you already have noted I'm suddently a bit lazy when giving "already cooked" food ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default

    Alain,
    Thanks for the answer. I was pretty sure that I understood it, but I still remember when I would hang on every word of advise that came from someone that I respected. I remember trying to figure out every possible meaning of a suggestion and feeling frustrated. Now, because of those memories, I try and close the loop and give a conclusion so that everyone can gain from the advise. Thank you for offering it so that we could learn.

    Bo

Similar Threads

  1. Serial EEPROM
    By William in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 10th July 2009, 18:09
  2. PIC16F690 - 24LC08B: they won't talk...
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 24th May 2008, 22:32
  3. Multiple Pics accessing single EEPROM
    By Atom058 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd February 2008, 17:22
  4. Replies: 5
    Last Post: - 16th February 2006, 23:43
  5. Writing / Reading EEPROM 24LC256 Problem
    By schmoddel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th February 2004, 18:55

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