@ scientiapotentiaest (Gast)
>ich denke, daß Du recht hast. Aber: Ich muss die Blöcke explizit nutzen
>können.
Daran hindert dich keiner.
> D.h. ersten Block lesen von der SD-Card und anschließend diesen
>Block schreiben auf DSP, nächsten Block lesen und auf DSP schreiben,
>nächsten Block lesen u.s.w.
Kein Problem.
>Dazu muss ich nach jedem Block "anhalten"
>können und zudem wissen, wo im Arduino-RAM ein Block eingetragen ist.
>Meine Dateien sind viel größer als das Arduino-RAM.
Ach was? ;-)
RTFM?!?
https://www.arduino.cc/en/Reference/SD
Ok, die SD-Klasse hat keinen Blockzugriff (Deppen!), wohl aber gibt es
https://www.arduino.cc/en/Reference/StreamReadBytes
Das sollte auch mit der SD-Klasse funktionieren. Muss man mal ein wenig
probieren. Etwa so, ist aber nur mal hingeschrieben, nicht getestet!
1 | /*
|
2 | SD card file dump
|
3 |
|
4 | This example shows how to read a file from the SD card using the
|
5 | SD library and send it over the serial port.
|
6 |
|
7 | The circuit:
|
8 | * SD card attached to SPI bus as follows:
|
9 | ** MOSI - pin 11
|
10 | ** MISO - pin 12
|
11 | ** CLK - pin 13
|
12 | ** CS - pin 4
|
13 |
|
14 | created 22 December 2010
|
15 | by Limor Fried
|
16 | modified 9 Apr 2012
|
17 | by Tom Igoe
|
18 |
|
19 | This example code is in the public domain.
|
20 |
|
21 | */
|
22 |
|
23 | #include <SPI.h>
|
24 | #include <SD.h>
|
25 |
|
26 | const int chipSelect = 4;
|
27 |
|
28 | uint8_t my_buffer[512];
|
29 |
|
30 | void setup() {
|
31 | // Open serial communications and wait for port to open:
|
32 | Serial.begin(9600);
|
33 | while (!Serial) {
|
34 | ; // wait for serial port to connect. Needed for native USB port only
|
35 | }
|
36 |
|
37 |
|
38 | Serial.print("Initializing SD card...");
|
39 |
|
40 | // see if the card is present and can be initialized:
|
41 | if (!SD.begin(chipSelect)) {
|
42 | Serial.println("Card failed, or not present");
|
43 | // don't do anything more:
|
44 | return;
|
45 | }
|
46 | Serial.println("card initialized.");
|
47 |
|
48 | // open the file. note that only one file can be open at a time,
|
49 | // so you have to close this one before opening another.
|
50 | File dataFile = SD.open("datalog.txt");
|
51 |
|
52 | // if the file is available, write to it:
|
53 | if (dataFile) {
|
54 | while (dataFile.available()>=512) {
|
55 | dataFile.read_bytes(my_buffer, 512);
|
56 | // sent data to DSP HERE
|
57 | // TODO!
|
58 | }
|
59 | dataFile.close();
|
60 | }
|
61 | // if the file isn't open, pop up an error:
|
62 | else {
|
63 | Serial.println("error opening datalog.txt");
|
64 | }
|
65 | }
|
66 |
|
67 | void loop() {
|
68 | }
|