93c46 Eeprom Writing/reading Help


Results 1 to 4 of 4

Threaded View

  1. #1
    EDWARD's Avatar
    EDWARD Guest

    Default 93c46 Eeprom Writing/reading Help

    I WAS AT THIS Thread just a minute ago and i wish i knew if dark solved his problem.
    http://www.picbasic.co.uk/forum/showthread.php?t=1214

    93c46 datasheet:
    http://leonardo.caltech.edu/~ee5x/ee.../hw6/93c46.pdf


    i have the same problem, but i dont know whether its my reading or writing that is flawed. I am trying to write 3 different byte sized variables to the 93c46. i have attached a pic that shows how it is all connected. I dont think that there are any pull up resistors on the CLK or CS line, not sure if this is a problem. I simply need someone to correct my subs.

    here are my eeread and eewrite subs.

    include "modedefs.bas"
    DEFINE SHIFT_PAUSEUS 500

    CS var PORTB.1 ' Chip select pin
    SCK var PORTB.2 ' Clock pin
    SI var PORTC.6 ' Data in pin
    SO var PORTC.7 ' Data out pin

    B0 var byte '<------- data to be written
    addr var BYTE '<------ eeprom memory location 1,2,3

    d var byte
    t var byte
    ed var byte

    ADCON1=7 ' set all analog pins to digital
    TRISA=%011000 'PORT A
    TRISB=%11110001 'PORT B
    TRISC=%10100000 'PORT C




    eeread:

    for addr = 1 to 3 'eeprom address


    CS = 1
    Shiftout SI, SCK, MSBFIRST, [%110\3, addr\6]
    Shiftin SO, SCK, MSBPOST, [B0]
    CS=0


    if addr = 1 then
    d = B0
    endif

    if addr = 2 then
    t = B0
    endif

    if addr = 3 then
    ED = B0
    endif

    pause 10
    next addr
    return







    ewrite:
    for addr = 1 to 3

    if addr = 1 then
    B0 = D
    endif

    if addr = 2 then
    B0 = T
    endif

    if addr = 3 then
    B0 = ED
    endif

    CS = 1 ' Enable serial EEPROM
    Shiftout SI, SCK, MSBFIRST, [%10011\5, 0\7] ' Send write enable command
    CS = 0

    PAUSE 10

    CS = 1 ' Enable
    Shiftout SI, SCK, MSBFIRST, [%101\3, addr\6, B0] ' Send address and data
    CS = 0
    pause 10
    next addr
    Return



    the ports that the CLK and CS are connected to (portb.1 and portb.2) have programmable weak internal resistors if necesary (Option_reg.7) BUT SI and SO dont. they are on port C.6 and c.7
    Attached Images Attached Images  

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