PDA

View Full Version : microwire eeprom 93c06, 14,46.....



darkman
- 9th February 2005, 13:55
I need help. this codes for 93C56 but I cant use this code for other microwire eeprom

where change this code for 93C06,93C14,93C46,93C66,93C76, 93c86



codes :

eeread:
CS = 1 ' Enable serial EEPROM
Shiftout DI, CLK, MSBFIRST, [%1100\4, addr93c] ' Send read command and address
Shiftin DO, CLK, MSBPOST, [data93c] ' Read data
CS = 0

'============================================
eewrite:
' Subroutine to enable writes to serial EEPROM
eewriteen: CSslave = 1 ' Enable serial EEPROM
Shiftout DIslave, CLKslave, MSBFIRST, [%10011\5, 0\7] ' Send write enable command and dummy clocks
CSslave = 0 ' Disable
' Subroutine to write data at addr in serial EEPROM
eewrite: CSslave = 1 ' Enable serial EEPROM
Shiftout DIslave, CLKslave, MSBFIRST, [%1010\4, addr93c, data93c] ' Send write command, address and data
CSslave = 0 ' Disable
Pause 1000 ' YAZDIKTAN SONRA BEKLE

mister_e
- 9th February 2005, 16:57
Did you set the TRIS register at least for those CS and Cslave pin.??? Did you disable them at the begining of your program before access to them.

There's some slight difference between every 93C familly when you want access to them...

93c06 93C46


'read from eeprom
CS = 1
Shiftout DI, CLK, MSBFIRST, [%110\3, addr\6]
Shiftin DO, CLK, MSBPOST, [B0,B1]
cs=0


93c56


'Read from EEPROM
CS = 1
Shiftout DI, CLK, MSBFIRST, [%110\3, addr\8]
Shiftin DO, CLK, MSBPOST, [b0,b1]
CS = 0

darkman
- 9th February 2005, 17:58
This my microwire eeprom copier project with pic

I working now microwire eeprom reading after I' m working microwire eeprom writing complate my code :


CS var PORTB.0 ' Chip select pin
CLK var PORTB.1 ' Clock pin
DI var PORTB.2 ' Data in pin
DO var PORTB.3 ' Data out pin

addr93c var byte ' 93C Address
data93c var byte ' 93C Data
size93c var byte ' 93c MEMORY SIZE

Low CS ' Chip select inactive


size93c=15 ' MEMORY SIZE


p93c1:

For addr93c=0 To size93c ' Loop 16 times
Gosub eeread ' Read from SEEPROM
Lcdout $fe,1,"ADRES: ",#addr93c ' Display
Lcdout $fe, $c0,"DATA: ",Hex2 data93c
PAUSE 1000
Next addr93c
GOTO son
' Subroutine to read data from addr in serial EEPROM
eeread:
CS = 1 ' Enable serial EEPROM
Shiftout DI, CLK, MSBFIRST, [%1100\4, addr93c] ' Send read command and address
Shiftin DO, CLK, MSBPOST, [data93c] ' Read data
CS = 0
RETURN

son:

END




this code working with 93c 56 but not works others

I try your codes but I' cant read 93C46...

mister_e
- 9th February 2005, 18:18
mmm, this is the one i use everyday to read from 93c06 and 93c46.. it has to work...

what about if you add this before reading from eeprom



low cs
pause 50
addr = $01
CS = 1
Shiftout DI, CLK, MSBFIRST, [%100\3, addr\6]
CS = 0


some have memory organization pin(ORG)... pin 6 if my memory is good. Should be tie to VCC.

darkman
- 9th February 2005, 18:25
I try now please wait

darkman
- 9th February 2005, 18:27
my org pin connected to Vss

mister_e
- 9th February 2005, 18:35
must be vdd

the number after the "\" is really important. Case you don't add this \ stuf... nothing will work as you expected

darkman
- 9th February 2005, 19:18
@mister_e please read your pm box

rod27cn
- 10th March 2009, 14:27
Hi,

I download the code from Melabs and it is the code for writing to 93C56, i use this code for 93C46 but it is not working. Anybody can please help to advise what could I change to make this code work for 93C46?

For more information the ORG pin is short to the ground or VSS. Meaning byte size address organization.

Please help. Thanks!

Here is the code below:



' PicBasic Pro program to read and write to Microwire SEEPROM 93LC56A
'
' Write to the first 16 locations of an external serial EEPROM
' Read first 16 locations back and send to LCD repeatedly
' Note: for SEEPROMs with byte-sized address

' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
Define LOADER_USED 1
Define OSC 4

' Define LCD registers and bits
Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1

include "modedefs.bas"

CS var PORTA.5 ' Chip select pin
CLK var PORTC.3 ' Clock pin
DI var PORTC.4 ' Data in pin
DO var PORTC.5 ' Data out pin

addr var byte ' Address
B0 var byte ' Data

Low CS ' Chip select inactive

ADCON1 = 7 ' Set PORTA and PORTE to digital
Low PORTE.2 ' LCD R/W line low (W)
Pause 100 ' Wait for LCD to start up


Gosub eewriteen ' Enable SEEPROM writes

For addr = 0 To 15 ' Loop 16 times
B0 = addr + 100 ' B0 is data for SEEPROM
Gosub eewrite ' Write to SEEPROM
Pause 10 ' Delay 10ms after each write
Next addr

loop: For addr = 0 To 15 ' Loop 16 times
Gosub eeread ' Read from SEEPROM
Lcdout $fe,1,#addr,": ",#B0 ' Display
Pause 1000
Next addr

Goto loop

' Subroutine to read data from addr in serial EEPROM
eeread: CS = 1 ' Enable serial EEPROM
Shiftout DI, CLK, MSBFIRST, [%1100\4, addr] ' read comd and add
Shiftin DO, CLK, MSBPOST, [B0] ' Read data
CS = 0 ' Disable
Return

' Subroutine to write data at addr in serial EEPROM
eewrite: CS = 1 ' Enable serial EEPROM
Shiftout DI, CLK, MSBFIRST, [%1010\4, addr, B0] ' write cmd add, data
CS = 0 ' Disable
Return

' Subroutine to enable writes to serial EEPROM
eewriteen: CS = 1 ' Enable serial EEPROM
Shiftout DI, CLK, MSBFIRST, [%10011\5, 0\7] 'write enable cmd clk
CS = 0 ' Disable
Return

End