12f629 Eeprom


Results 1 to 6 of 6

Thread: 12f629 Eeprom

Threaded View

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


    Did you find this post helpful? Yes | No

    Default

    O.K. the 12F629 have 128 bytes of EEPROM, so the address range is between 0 and 127. PBP WRITE handle the PIC address for you.

    try this
    Code:
    <font color="#000000">        <font color="#008000">'
            '       Pic Configuration
            '       =================
            </font>@ __CONFIG _INTRC_OSC_NOCLKOUT &amp; _WDT_ON &amp; _PWRTE_ON &amp; _MCLRE_OFF &amp; _BODEN_ON        
            
            <font color="#008000">'
            '       Hardware configuration
            '       ======================
                    '
                    '       I/Os
                    '       ----
                    </font>TRISIO = %11111110  <font color="#008000">' GP0 As output, others TO input
                    
                    '
                    '       Comparator
                    '       ----------
                    </font>CMCON = 7           <font color="#008000">' Disable comparator      
            
            '                      
            '       Hardware assignment
            '       ===================
                    '
                    '       User control
                    '       ------------
                    </font>PB1     <font color="#000080">VAR </font>GPIO.1
                    LED     <font color="#000080">VAR </font>GPIO.0
    
            <font color="#008000">'   
            '       Software variables
            '       ==================
            </font>AddressCounter  <font color="#000080">VAR BYTE
    
            </font><font color="#008000">'
            '       Software/Hardware initialisation
            '       ================================
            </font>AddressCounter = 0
            LED = 0
            <font color="#000080">PAUSE </font>100   <font color="#008000">' osc settle time
            
                    
            '------------------------------&lt; Main program &gt;-----------------------------------
            '
    </font>Start:
            <font color="#000080">WHILE </font>AddressCounter!=128
                <font color="#000080">IF </font>PB1 = 1 <font color="#000080">THEN     
                    WRITE </font>AddressCounter,AddressCounter
                    LED = 1        
                    <font color="#000080">WHILE </font>PB1 : <font color="#000080">WEND
                    PAUSE </font>100
                    LED = 0
                    AddressCounter = AddressCounter + 1
                    <font color="#000080">ENDIF
                WEND
            </font>LED = 1
    
    SpinHere:   
            <font color="#000080">GOTO </font>SpinHere        
            <font color="#008000">'
            '---------------------------------------------------------------------------------
    </font>
    Each time you'll press on the push-button attach to gpio.1, it will write to the EEPROM. Once the EEPROM is full, the LED will stay ON.

    Once done, if i read the pic, the EEPROM show...
    <IMG SRC="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=1609&stc=1&d=117864751 5">

    Sucessfull!
    Attached Images Attached Images  
    Steve

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

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. How to define constants that specify eeprom addresses
    By DwayneR in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th December 2009, 04:07
  3. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  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 : 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