button ,eeprom,read


Closed Thread
Results 1 to 1 of 1
  1. #1
    mike12's Avatar
    mike12 Guest

    Default button ,eeprom,read

    Hello I want to modify this routine of reading and writing of an external eeprom 24lc515 i2c to write 40 bytes, and to repeat this operation with each time the buffer contains the 40 bytes (MagMax idiot 40) which will be has to write in the eeprom. The reading of the eeprom and sends it data read towards on the port série.Pour a Série connection and to visualize with hyper final. How to make to activate the reading of the eeprom and the transmission of the data towards the port series, once the peak to program and place on the circuit? Does a pushbutton activate the reading and sends it on the port series? Pin SHORT PROP I am beginner and can you help me has to correct this source code if there are errors.

    I thank you Merci Mike

    I2C_OUT VAR BYTE[ ] '
    GOSUB I2CTX
    I2CTX: ' Transmit I2C Routine
    GOSUB I2C_Stop ' Issue Stop Command
    RETURN



    '********************************** VAR ************************************************** **

    '( MagMax con 40' Max Buffer Size )

    addr VAR WORD ' Memory Address
    data_array VAR BYTE '
    MagMax VAR BYTE[40] ' Data array with location for checksum
    i VAR BYTE ' Loop counter


    '****************************** button ************************************************** ******

    SO con 0 ' Define serial output pin
    B con 5 ' Define Button input pin
    N2400 con 4 ' Set serial mode
    B0 var byte

    B0 = 0 ' Zero Button Working Buffer
    loop: Button B,1,10,5,B0,0,notp ' Check Button (Skip if Not Pressed)
    Serout SO,N2400,["Press",13,10] ' Indicate Button Pressed
    notp: Serout SO,N2400,[#B0,13,10] ' Show Working Variable
    Pause 100 ' Visual Pause
    Goto loop ' Foreve

    '******************************* I2CWrite ************************************************** *****

    For addr = 0 To 65535 Step 64 ' Store $00 to all locations (for testing)
    I2CWrite sda,scl,$A0,addr,[STR MagMax\64] ' Send a 64-byte page
    HSerout ["."] ' Indicate progress
    Pause 10 ' Pause 10mS to let the write complete
    Next addr

    '********************************* I2CRead ************************************************** ***

    ' Spot-check the data on the terminal screen
    i = 0 '
    Hserout [10,13, 10,13, "checking", 10,13] '

    For addr = 0 to 65535 Step 257 '? ' read every ? th 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

    End
    Attached Files Attached Files

Similar Threads

  1. Sony SIRC IR Issue
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 8th August 2015, 08:10
  2. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. Button Push within 3 second Window
    By Tissy in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd December 2005, 10:06
  5. Button subfunction 16F628
    By Jųan in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th August 2005, 16:44

Members who have read this thread : 1

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