Internal Eeprom/flash , what are you doing ?


Closed Thread
Results 1 to 14 of 14

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Thanks for your replies guys !

    I could'nt get back to you any sooner, cause the forum was offline.

    The reason i would like to use the 519 is because it's the cheapest and smallest
    pic micro that has memory on it. I did some projects on the 12F635, and that works
    like a charm, however, it's more expensive and isn't available in a MSOP package ...

    OK, so read and write is not going to work then ?

    Is there anyway i can make this work Darrel or Skimask ?

    The project is very small step up dimmer for small led lights. It uses a i2c digital potentiometer to influence a sense resistor. Each time the pic get Vdd it reads the previous value and adds 1 to it and applies the setting to the digital pot. So, by switching the lights on and off a few times the dimmer state can be influenced ...

  2. #2
    skimask's Avatar
    skimask Guest


    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 ?
    The project is very small step up dimmer for small led lights. It uses a i2c digital potentiometer to influence a sense resistor. Each time the pic get Vdd it reads the previous value and adds 1 to it and applies the setting to the digital pot. So, by switching the lights on and off a few times the dimmer state can be influenced ...
    Using a digital pot for LEDs (i.e. varying the current) isn't the way to go with LEDs. Sure, it'll work, but the results won't be very linear at the lower light levels. Best bet with an LED is to use PWM of some sort of another. If you look at the datasheet for whatever LED you've got, you'll notice that the color/intensity/etc are all referenced to a normalized current drive (or at least a range of current). Go outside of that range and the performance drops. If you use PWM, you drive the LED at an efficient level, with a varying duty cycle. And it saves power too...

    As far as the FLASH in the 12F519? I didn't realize it was 64 bytes of FLASH either, I thought it was EEPROM. I don't have a 519 handy, and I haven't tried it either, so I don't know if PBP supports it in the same way it supports the other PICs with EEPROMs or not. You might end up writing an assembly subroutine to handle read, modifying, and re-writing the FLASH in 8 byte rows.

  3. #3
    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

  4. #4
    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 !

  5. #5
    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.

  6. #6
    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

  7. #7
    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