Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I can not write and read from the EEPROM by the SPI port

Status
Not open for further replies.

George.M

Newbie level 3
Joined
Apr 13, 2005
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,302
Hello,
I have a problem reading and writing to 25C080. I tried to read and write the 25C080 eeprom with PIC18F452 but not work. So I used the next code on 25C080 but did not work. Can any one help me on what to do? Please

movlw 90h
movwf 0xF94 ; set input TRISC ( RX and SDI)
movlw 80h
movwf 0xFC7 ; SMP=1 from SSPSTAT
movlw 31h
movwf 0xFC6 ; SSPEN=1, ckp=1, FC/16 from SSPCON1

write_10
bcf 0xF83, 1 ; low chip select
movlw 01h ; write status register (WRSR)
call output
movlw 06h ; enable write operation (WREN)
call output
movlw 02h ; write data to memory array... (WRITE)
call output
movlw 00h ; write MSB address
call output
movlw 0Ah ; write LSB address
call output
movlw 33h ; write data
call output
bsf 0x F83, 1 ; high chip select
bcf 0xF83, 1 ; low chip select
movlw 04h ; disable write operation (WRDI)
call output
bsf 0xF83,1 ; high chip select
call delay ; 5ms delay
return

read_10
bcf 0xF83, 1 ; low chip select
movlw 05h ; read status register (RDSR)
call output
movlw 03h ; read data from memory (READ)
call output
movlw 00h ; read MSB address
call output
movlw 0Ah ; read LSB address
call output
movwf label ; RAM memory
bsf 0xF83,1 ; high chip select
return

output
movwf 0xFC9 ; SSPBUF register
loop
btfss 0xFC7, 0 ; test buffer full status bit
bra lop
retlw 0

Thank you
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top