eeprom 40 bytes


Closed Thread
Results 1 to 1 of 1

Thread: eeprom 40 bytes

  1. #1
    mike12's Avatar
    mike12 Guest

    Default eeprom 40 bytes

    Hello the program cleans the data in the eeprom, but it filled all the eeprom. The values which I want to write are a temporary file of 40 bytes, Which are to be written. I join an example of Merci writing


    '********************Initialize USART*******************************************
    DEFINE HSER_RCSTA 90h ' Set receive register to receiver enabled
    DEFINE HSER_TXSTA 24h ' Set transmit register to transmitter enable
    DEFINE HSER_BAUD 9600 ' Set baud rate

    data_array VAR BYTE
    addr VAR WORD
    i VAR BYTE ' Loop counter

    DEFINE I2C_SLOW 1
    DEFINE I2C_SCLOUT 1
    SCL var PORTA.0 ' Clock pin
    SDA var PORTA.1 ' Data pin
    '********************** RAM Assignments and Variables **************************
    CounterA var byte ' General purpose Variable
    CounterB var byte ' General purpose Variable
    CounterC var byte ' General purpose Variable
    CounterD var byte ' General purpose Variable
    '*********************** Data **************************************************
    MagData var byte [40] ' Data Array
    '***********************Program Constants***************************************
    MagMax con 40 ' Max Buffer Size
    '**************************Save byte to main buffer and increment pointer*******
    MagData(CounterB)=CounterD ' Good or Bad, Save the data byte to buffer
    CounterC=CounterC^CounterD ' Add received byte for LRC Check at end
    CounterB=CounterB+1 ' Increment to next byte in Data buffer
    '**************************Spot-check the data on the terminal screen **********
    For addr = 0 To 65535 Step 64 ' Store $00 to all locations (for testing)
    I2CWrite sda,scl,$A0,addr,[STR MAGDATA\40] ' Send a 64-byte page
    HSerout ["."] ' Indicate progress
    Pause 10 ' Pause 10mS to let the write complete
    Next addr
    i = 0 ' Spot-check the data on the terminal screen
    Hserout [10,13, 10,13, "checking", 10,13]
    For addr = 0 to 65535 Step 257 ' read every 257th address
    i = i + 1
    I2CRead sda, scl, $A0, addr, [data_array[0]] ' Read a single byte from memory
    Hserout [HEX2 data_array[0], " "] ' To terminal with hex value
    If (i & $0007) = 0 Then ' Break it into organized lines
    Hserout [10,13] ' 8 locations to a line
    Endif
    Next addr ' Go get the next test
    Pause 1000
    Goto ReadReadyLoop
    '************************** End*********************************************** *
    End
    Attached Files Attached Files

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