The AnalogBinLogger.ino file of SdFat library says the following:
Each 512 byte data block in the file has a four byte header followed by up to 508 bytes of data. (508 values in 8-bit mode or 254 values in 10-bit mode). Each block contains an integral number of samples with unused space at the end of the block.
I was wondering why only 254 values can be stored in 10-bit mode instead of (508*8 bits/ 10 bits ~ 406 values ).
- Is this because of the memory being byte-addressable and hence does a 10-bit value take up 2 bytes?
- If so, how will a file-reader differentiate between a 10-bit value taking 2 bytes and two 8-bit values?
- The AnalogBinLogger.ino says:
The logger will use SdFat's buffer plus BUFFER_BLOCK_COUNT additional buffers.
BUFFER_BLOCK_COUNT is 1 for the Arduino Uno since it has 2KB of SRAM. Each buffer is 512-byte long. Is SdFat's internal buffer also in SRAM? If I am not wrong, the libraries the program uses and the program code reside in the Flash memory, can SdFat write into a buffer in Flash memory?