Autor Tema: Lectura y escritura de eeprom 24lc256  (Leído 13708 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado cdlopez

  • PIC10
  • *
  • Mensajes: 39
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #15 en: 10 de Octubre de 2006, 10:55:51 »
Hola continuando un poco con el tema:

Intente hacer un circuito que lea valores analogicos y los almacene en la eeprom, tomando siempre como base los ejemplos de PBP, si bien la compilacion no me da errores cunado voy a simular el proteus me arroja el siguiente error:

SIMULATION LOG
==============
Design:   C:\Documents and Settings\INTERNET\Escritorio\Prueba de adquisicion analogia y almacenamiento en memoria eeprom.DSN
Doc. no.: <NONE>
Revision: <NONE>
Author:   <NONE>
Created:  10/10/06
Modified: 10/10/06

Compiling source files...
Build completed OK.
Compiling netlist...
Linking netlist...
Partition analysis...

Simulating partition 1 [ED85F880]...
PROSPICE Release 6.9 SP4 (C) Labcenter Electronics 1993-2006.
SPICE Kernel Version 3f5. (C) Berkeley University ERL.

Reading netlist...
Reading SPICE models...
Building circuit...
Instantiating SPICE models...
[U1] PIC16 model release 6.9 SP0 simulating PIC16877 device.
[U2] I2CMEM model release 6.8 SP4 (IR1).
[U2] 0          [STOPPED    ]: Loaded 32768 bytes of persistent memory data.
[U1] Loaded 256 bytes of persistent EEPROM data.
[U1] Loading HEX file 'lectura de valor analogico y almacenamiento en eeprom.hex'.
[U1] Read total of 758 bytes from file 'lectura de valor analogico y almacenamiento en eeprom.hex'.
[U1] Loaded 377 program words and 0 data bytes.
[SPICE] DELMIN increased to 4.94066e-324 due to lack of time precision
PROSPICE -  Internal Exception: access violation in module 'SPICESIM.DLL'.
Totaliters=0, Totalsteps=1, Goodsteps=1, Badsteps=0

PROSPICE -  Internal Exception: access violation in module 'SPICESIM.DLL'.

Real Time Simulation FAILED.


se produce un fallo en la simulacion, con el modulo de spice, hay algo mal en el circuito???


Desconectado Marioguillote

  • Moderador Local
  • PIC24H
  • *****
  • Mensajes: 1926
    • Servisystem
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #16 en: 15 de Octubre de 2006, 20:34:01 »
Hola a todos !

Has probado de cambiar la memoria ?
Me ha pasado al trabajar con simulación en I2C que hay memorias que no me funcionan. Me dan ese tipo de errores.
Puedes probar con la FM24C256F a ver que pasa. Esas me han funcionado.
DPIN sería SDA y CPIN sería SCL.
No dejes de poner WP a GND.

Saludos
Mario

Desconectado Necrobutcher

  • PIC10
  • *
  • Mensajes: 10
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #17 en: 19 de Octubre de 2006, 02:38:18 »
Colega, no creo q tengas malo el circuito, cuentame has simulado otros ejercicios con proteus? aparte de los samples que vienen con proteus.

Pues si es primera vez proteus, te recomiendo que busques un manual para su correcta configuracion con pbp, y asi solucionaras tu problema, si no tienes alguno me avisas y te lo mando encantado.

saludos

Desconectado kime90

  • PIC10
  • *
  • Mensajes: 4
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #18 en: 17 de Noviembre de 2010, 15:10:09 »
Amigos tngo el mismo problema pero yo necesito sacarlo en un LCD este es mi programa: Espero su ayuda


define OSC 4

DEFINE I2C_SDA PORTC,4 'Data pin for I2C (12-bit core only)
DEFINE I2C_SCL PORTC,3 'Clock pin for I2C (12-bit core only)
DEFINE I2C_SCLOUT 1 'Set serial clock to bipolar instead of open-collector

DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 0 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 2 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 1 'LCD read/write bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us

  'portc3 = reloj
  'portc4 = Dato
 
WR COn %10100000
RW COn %10100001
SCL VAR PORTC.3 
SDA VAR PORTC.4
dato var byte 


TRISC = 0
TRISB = 0
TRISA = 0
ADCON1 = 6


Esperar:

If porta.0 = 1 then inicio

goto esperar

Inicio:
  LCDOUT $FE,1,"  GRABANDO"
  LCDOUT $FE, $c0,"    EN MEMORIA"
  pause 1000
  LCDOUT $FE,1
 
       
i2cwrite sda,SCL,WR,0,["H"]
pause 10
i2cwrite sda,SCL,WR,1,["O"]
PAUSE 10
i2cwrite sda, SCL , WR,2, ["L"]
PAUSE 10
i2cwrite sda, SCL , WR,3, ["A"]
PAUSE 10


 LEER:
 
 
 LCDOUT $FE,1," LEYENDO ESPERE"     
 LCDOUT $FE, $c0,"  UN MOMENTO"
  pause 1000
   LCDOUT $FE,1
 
 
 
i2CREAD sda ,SCL, WR,0,[dato]
LCDOUT,  dato
pause 1000
i2CREAD sda ,SCL, WR,1,[DATO]
LCDOUT , dato
PAUSE 1000
i2CREAD sda ,SCL , WR,2, [dato]
LCDOUT , dato
PAUSE 1000
i2CREAD sda, SCL , WR,3, [dato]
LCDOUT , dato
PAUSE 1000
 
goto ESPERAR

 end

Desconectado ASTROCAR

  • PIC24F
  • *****
  • Mensajes: 666
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #19 en: 24 de Noviembre de 2010, 07:02:19 »
Amigos tngo el mismo problema pero yo necesito sacarlo en un LCD este es mi programa: Espero su ayuda


define OSC 4

DEFINE I2C_SDA PORTC,4 'Data pin for I2C (12-bit core only)
DEFINE I2C_SCL PORTC,3 'Clock pin for I2C (12-bit core only)
DEFINE I2C_SCLOUT 1 'Set serial clock to bipolar instead of open-collector

DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 0 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 2 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 1 'LCD read/write bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us

  'portc3 = reloj
  'portc4 = Dato
 
WR COn %10100000
RW COn %10100001
SCL VAR PORTC.3 
SDA VAR PORTC.4
dato var byte 


TRISC = 0
TRISB = 0
TRISA = 0
ADCON1 = 6


Esperar:

If porta.0 = 1 then inicio

goto esperar

Inicio:
  LCDOUT $FE,1,"  GRABANDO"
  LCDOUT $FE, $c0,"    EN MEMORIA"
  pause 1000
  LCDOUT $FE,1
 
       
i2cwrite sda,SCL,WR,0,["H"]
pause 10
i2cwrite sda,SCL,WR,1,["O"]
PAUSE 10
i2cwrite sda, SCL , WR,2, ["L"]
PAUSE 10
i2cwrite sda, SCL , WR,3, ["A"]
PAUSE 10


 LEER:
 
 
 LCDOUT $FE,1," LEYENDO ESPERE"     
 LCDOUT $FE, $c0,"  UN MOMENTO"
  pause 1000
   LCDOUT $FE,1
 
 
 
i2CREAD sda ,SCL, WR,0,[dato]
LCDOUT,  dato
pause 1000
i2CREAD sda ,SCL, WR,1,[DATO]
LCDOUT , dato
PAUSE 1000
i2CREAD sda ,SCL , WR,2, [dato]
LCDOUT , dato
PAUSE 1000
i2CREAD sda, SCL , WR,3, [dato]
LCDOUT , dato
PAUSE 1000
 
goto ESPERAR

 end

Hola colega estas usando pic basic, si es asi, te recomiendo que agregues este sector en tu codigo Include "modedefs.bas"          ' Include serial modes.

Saludos y espero tus comentarios.
Atten.
Alexander santana.
Venezuela-Barcelona.
EL APRENDER ES NADA; MEJOR ES COMPARTIR EL APRENDIZAJE

Desconectado kime90

  • PIC10
  • *
  • Mensajes: 4
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #20 en: 27 de Noviembre de 2010, 15:08:00 »

define OSC 4

DEFINE I2C_SDA PORTC,4 'Data pin for I2C (12-bit core only)
DEFINE I2C_SCL PORTC,3 'Clock pin for I2C (12-bit core only)
DEFINE I2C_SCLOUT 1 'Set serial clock to bipolar instead of open-collector
DEFINE I2C_SLOW 1

DEFINE LCD_DREG PORTB 'LCD data port
DEFINE LCD_DBIT 4 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTB 'LCD register select port
DEFINE LCD_RSBIT 0 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 2 'LCD enable bit
DEFINE LCD_RWREG PORTB 'LCD read/write port
DEFINE LCD_RWBIT 1 'LCD read/write bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 2 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us

  'portc3 = reloj
  'portc4 = Dato
 
WR COn %10100000
dir var word
SCL VAR PORTC.3 
SDA VAR PORTC.4
dato var byte
cont VAR BYTE
 


TRISC = 0
TRISB = 0
TRISA = 0
ADCON1 = 6
dir = 0



Esperar:

If porta.0 = 1 then Grabar
IF PORTA.1 = 1 THEN LEER
LCDOUT $FE,1, "  UNIVERSIDAD "
LCDOUT $FE, $c0,"         MODELO"
PAUSE 2000
LCDOUT $FE,1, "    PROYECTO    "
LCDOUT $FE, $c0,"GRABADOR DE VOZ"
PAUSE 2000
goto esperar

Grabar:
  LCDOUT $FE,1,"  GRABANDO"
  LCDOUT $FE, $c0,"    EN MEMORIA"
  pause 1000
  LCDOUT $FE,1

   FOR DIR = 0 TO 3
 
PAUSEUS 5
i2cwrite sda, SCL, WR, DIR,["H"]
i2cwrite sda, SCL, WR, DIR,["O"]
i2cwrite sda, SCL, wr, DIR,["L"]
i2cwrite sda, SCL, wr, DIR,["A"]
 
NEXT DIR 

loop:

if porta.1 = 1 then leer
LCDOUT $FE,1,"LEER 24CL256"
LCDOUT $FE, $c0,"PRESIONE BOTON 2"
 PAUSE 500                                 


goto loop
 LEER:
   
  LCDOUT $FE,1," LEYENDO ESPERE"     
  LCDOUT $FE, $c0,"  UN MOMENTO"
  pause 1000
  LCDOUT $FE,1
 
    FOR DIR = 0 TO 3
 
i2CREAD sda ,SCL, WR, DIR,[dato]
LCDOUT,  dato
pause 1000

nEXT DIR


 end



No utilizo el "modedefs.bas" porque no utilizo el puerto RX y TX del pic 16f877A.. yo lo k kiero es mostra lo grabado en mi eeprom "24LC256" a un LCD
Este es mi codigo corregido en proteus anda de maravilla me graba la palabra "HOLA" y la muestra pero en mi circuito real me graba toda sino solo la letra H.

Desconectado Chrisbaf

  • PIC16
  • ***
  • Mensajes: 178
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #21 en: 27 de Noviembre de 2010, 22:40:44 »
revisa esta parte en anterior post

WR COn %10100000
RW COn %10100001

Desconectado kime90

  • PIC10
  • *
  • Mensajes: 4
Re: Lectura y escritura de eeprom 24lc256
« Respuesta #22 en: 30 de Noviembre de 2010, 14:32:01 »
Ya lo revise Chrisbaf.. (:
t digo q aora el codigo funciona (correctamente este ultimo q puse)
solo que en mi circuito real no funciona si no solo imprime en el LCD la letra H aunque en el
proteus si me aparece la palaba Hola. Ya he echo que me grabe numeros por medio de un contador
y ese si me andubo de maravilla en proteus como en mi circuito real.
Todo esto es solo para que aprenda el manejo del 24lc25,
que mi proyecto final es hacer un grabador de voz, Mi idea es en vez de almacenar letras i numeros
es dirigir estos datos en mi puerto A ya que el dato sera analogico sacarlo del PIC pasarlo por un DAC para convertir la señal digital
en analoga y se pueda reproducir la voz.
Si tuvieran por alla un codigo o idea del grabador de voz seria bien recibida.. SALUDOS.