Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 EEPROM - eigentlich einfach, aber geht nicht! Kategorie: Programmierung Basic (von Markus - 8.09.2008 19:29)
Markus nutzt:  CC1-Station V1.1
Hallo Kollegen,

ich habe zwei Programme geschrieben:
1. 4 Zahlen ins EEPROM schreiben
2. 4 Zahlen aus dem EEPROM lesen und im Display anzeigen

(ich möchte diese Funktionen natürlich dann in ein größeres Programm integrieren)
Innerhalb eines Programmes kann ich ohne Probleme lesen und schreiben und es kommen immer die richtigen Werte. Spiele ich aber das read-Programm auf, so wird mir aber das hier ausgegeben:

7686 -1 -1 -1

Ich habe übrigens die C-Control I, Station 2.0 - konnte ich oben nicht anhaken.

Kann mir da jemand weiterhelfen?

Schöne Grüße
Markus


PROGRAMM1 ++++++++++++++++++++++++++++++++++++++++++++++++

'--------------------------
'------ I/O PORTS ---------
'--------------------------
define SDA          as port[9]
define SCL          as port[10]
define EXTPORT      as byteport[4]

define BPORT1       as byteport[1]
define LIGHT        as port[16]

'--------------------------
'---- SYSTEM MEMORY -------
'--------------------------
define STATION_IO   as  byte[3]

{BYTEOFFSET 3}

'-- BEGINN USERVARIABLEN -----
define i               as byte

define gesamt          as word
define today           as word
define gesamt2         as word
define today2          as word
 
import "....\LIB\SHOW_BINARY.BAS"
import "....\LIB\PULLUP1_ENABLE.BAS"
import "....\LIB\GET_KEY.BAS"

PULLUP1_ENABLE()
LIGHT=off
LCD.INIT

SDA=on
SCL=on

#start

gesamt2 = 22
gesamt =  1111
today2 =  33
today =  4444

schreiben
end

function schreiben()
EEPROM.WRITE gesamt2, gesamt, today2, today
'EEPROM.CLOSE

#show_werte
PRINT"#CLR";
LCD.POS 1,1
LCD.PRINT "write gesamt - today"
LCD.POS 2,1
LCD.PRINT gesamt2 & " " & gesamt & " " & today2 & " " & today
end function


PROGRAMM2 ++++++++++++++++++++++++++++++++++++++++++++++++

'--------------------------
'------ I/O PORTS ---------
'--------------------------
define SDA          as port[9]
define SCL          as port[10]
define EXTPORT      as byteport[4]

define BPORT1       as byteport[1]
define LIGHT        as port[16]

'--------------------------
'---- SYSTEM MEMORY -------
'--------------------------
define STATION_IO   as  byte[3]

{BYTEOFFSET 3}

'-- BEGINN USERVARIABLEN -----
define i               as byte

define gesamt          as word
define today           as word
define gesamt2         as word
define today2          as word

import "....\LIB\SHOW_BINARY.BAS"
import "....\LIB\PULLUP1_ENABLE.BAS"
import "....\LIB\GET_KEY.BAS"

PULLUP1_ENABLE()
LIGHT=off
LCD.INIT

SDA=on
SCL=on


EEPROM.READ gesamt2, gesamt, today2, today
'EEPROM.CLOSE

#show_werte
PRINT"#CLR";
LCD.POS 1,1
LCD.PRINT "read gesamt - today"
LCD.POS 2,1
LCD.PRINT gesamt2 & " " & gesamt & " " & today2 & " " & today
end

 Antwort schreiben

Bisherige Antworten:

Re: EEPROM - eigentlich einfach, aber geht nicht! (von joergm6 - 8.09.2008 20:02)
    Re: EEPROM - eigentlich einfach, aber geht nicht! (von Achim - 10.09.2008 11:01)
    Re: EEPROM - eigentlich einfach, aber geht nicht! (von Markus - 9.09.2008 13:04)
        Re: EEPROM - eigentlich einfach, aber geht nicht! (von ManfredW - 9.09.2008 18:42)
            Re: EEPROM - eigentlich einfach, aber geht nicht! (von Markus - 11.09.2008 10:24)
                Re: EEPROM - eigentlich einfach, aber geht nicht! (von joergm6 - 11.09.2008 11:03)