Internal Eeprom/flash , what are you doing ?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ultiblade View Post
    Is there anyway i can make this work Darrel or Skimask ?
    I think so.

    Been looking through the 12F library, and it looks like the READ and WRITE commands still do the right thing. But there's no way (in PBP) to erase a block before writing.

    This might work. It's a macro that will erase 1 block at a time using a Constant for the address.

    To erase the first block (bytes 0-7), you can ...
    @ EraseFlash 0

    To erase the second block
    @ EraseFlash 8

    Put it right before the WRITE command.

    And put this macro somewhere near the top of the program.
    Code:
    ASM
    EraseFlash  macro Addr
      local EraseLoop
        MOVE?CB  (Addr & 0x38), EEADR
        BSF      EECON,FREE          ; SELECT ERASE
        BSF      EECON,WREN          ; ENABLE WRITES
        BSF      EECON,WR            ; INITITATE ERASE
    EraseLoop 
        btfsc    EECON, WR           ; Wait for the erase to complete
        goto     EraseLoop
      endm
    ENDASM
    DT

  2. #2
    Join Date
    Apr 2006
    Location
    GearSweaterMountain, The Netherlands
    Posts
    52


    Did you find this post helpful? Yes | No

    Talking

    You're both absolutely right.

    I forgot to mention I'm using Cree powerled's, that are driven by a supertex led driver. This driver uses a sense resistor to measure the current, if we influence the current ( by adding a resistor parallel to the sense resistor), we can influence the intensity of the powerled's.

    Darrel, i'm going to try the erase macro immediately, will post my findings ....

    Thanks Experts !

  3. #3
    Join Date
    Apr 2006
    Location
    GearSweaterMountain, The Netherlands
    Posts
    52


    Did you find this post helpful? Yes | No

    Thumbs up

    Hi Guys,

    I have tried your code Darrel, and erasing the blocks before writing does the trick !!! Thank you !
    Skimask, thank you for your quick replies and expert information !!



    Best regards,

    Ultiblade
    Last edited by ultiblade; - 20th October 2008 at 11:11.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Woohoo!

    Hope she's my prize.
    <br>
    DT

  5. #5
    Join Date
    Apr 2006
    Location
    GearSweaterMountain, The Netherlands
    Posts
    52


    Did you find this post helpful? Yes | No

    Default

    [loud laughter]

    I will ask her to contact you !

    [/loud laughter]

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. 12F683 internal pull up
    By hvacrtech in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th July 2008, 02:35
  3. Use internal program memory like DATA memory
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th December 2006, 18:38
  4. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41
  5. 12f675 internal osc question.....
    By Gabe@SPdFtsh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2004, 06:33

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