ich such nach einer lösung wie ich auf zwei SD-Karten in 4 partitionen und mehrere Dateien gleichzeitig bearbeiten kann.
1. Nutzung mehrerer Dateien auf einer partitionen auf einer SD gleichzeitig.
Code: Alles auswählen
OBJ
fat0: "DS1307_SD-MMC_FATEngine.spin"
fat1: "DS1307_SD-MMC_FATEngine.spin"
PUB main | errorString
' "fatEngineStart" wird nur einmal aufgerufen. Jedes Treiberobjekt kann es aufrufen.
fat0.fatEngineStart( _dopin, _clkpin, _dipin, _cspin, _wppin, _cdpin, _rtcdatpin, _rtcclkpin, _rtcbuslck)
fat0.mountPartition(0)
fat1.mountPartition(0)
' Try to create a new file.
errorString1 := \fat0.newFile(string("Profile1.txt"))
errorNumber1 := fat0.partitionError ' Returns zero if no error occurred.
errorString2 := \fat1.newFile(string("Profile2.txt"))
errorNumber2 := fat1.partitionError ' Returns zero if no error occurred.
fat0.openFile(string("Profile1.txt"), "W")
fat1.openFile(string("Profile2.txt"), "W")
fat0.writeString(string("### SD Card Profile 1 ###", 13, 10, 13, 10))
fat1.writeString(string("### SD Card Profile 2 ###", 13, 10, 13, 10))
fat0.unmountPartition
fat1.unmountPartition
Code: Alles auswählen
fat0.mountPartition(0)
fat1.mountPartition(1)
Eventuell kann man dem treiber dazu bewegen auf unterschiedlichen Pins zu wackeln.
Eventuell ist ein Swap der daten möglich?
Code: Alles auswählen
PUB FATEngineStart(DOPin, CLKPin, DIPin, CSPin, WPPin, CDPin, RTCDATPin, RTCCLKPin, I2CLock) '' 15 Stack Longs
....
dataOutPin := (|<DOPin)
clockPin := (|<CLKPin)
dataInPin := (|<DIPin)
chipSelectPin := (|<CSPin)
writeProtectPin := ((|<WPPin) & (WPPin <> -1))
cardDetectPin := ((|<CDPin) & (CDPin <> -1))
...
' /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' SDC Driver
' /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
' //////////////////////Pin Masks//////////////////////////////////////////////////////////////////////////////////////////////
dataOutPin long 0
clockPin long 0
dataInPin long 0
chipSelectPin long 0
writeProtectPin long 0
cardDetectPin long 0
' //////////////////////Addresses//////////////////////////////////////////////////////////////////////////////////////////////
blockPntrAddress long 0
sectorPntrAddress long 0
WPFlagAddress long 0
CDFlagAddress long 0
commandFlagAddress long 0
errorFlagAddress long 0
CSDRegisterAddress long 0
CIDRegisterAddress long 0
' //////////////////////Driver Variable Array//////////////////////////////////////////////////////////////////////////////////
cardBlockAddress long 0 ' Address of the data block in memory to read bytes from and write bytes to.
cardSectorAddress long 0 ' Address of the sector on the memory card to write bytes to and read bytes from.
cardWriteProtectedFlag byte 0 ' The secure digital card driver write protected flag.
cardNotDetectedFlag byte 0 ' The secure digital card driver not card detected flag.
cardCommandFlag byte 0 ' The secure digital card driver method command flag.
cardErrorFlag byte 0 ' The secure digital card driver method result flag.
CSDRegister byte 0[16] ' The SD/MMC CSD register.
CIDRegister byte 0[16] ' The SD/MMC CID register.
CIDPointer long 0 ' Pointer to the SD/MMC CID register copy to compare.