|The information in this article applies to:
The RC8660 chipset includes integrated flash memory for the storage of audio recordings. This application note explains how the flash memory can be used as general-purpose file storage for your applications.
Depending on the recording memory option, the RC8660 includes 512KB to 7.5MB of integrated recording memory, which is used to store sound libraries and recordings. Sound files can be downloaded, uploaded, and deleted from the recording memory through the RC8660's serial interface. The number of files is limited only by the amount of available recording memory.
General-purpose data files can be stored in the recording memory, if they are properly disguised as sound files. These files can even co-exist with real sound files, allowing you to download and/or record sound files alongside your data files.
Convincing the RC8660 to swallow a data file without complaining is simply a matter of adding a short header to the data file, and using the Download Sound File command (236W) to transfer the file. The header should contain the following eight bytes:
0xc0 0xdb n n n 0x00 t t
where "n" is the length of the data (24 bits, least-significant byte first) and "t" is an optional 16 bit tag (set to zero if not used). Note that the number of data bytes must be an even number; add an extra "padding" byte to your file if necessary.
As a simple example, assume you wanted to write the string "hi" to recording memory, and give it a tag value of 5. The header and data would look like this:
0xc0 0xdb 0x02 0x00 0x00 0x00 0x05 0x00 0x68 0x69
# bytes (n) tag (t) 'h' 'i'
It is generally a good idea to make use of the tag field, as it simplifies the retrieval of the file (see "Recording & Playback" in the RC8660 Userís Manual for a discussion of the benefits of using tags, as well as details on using the RC8660 recording memory). You can think of the tag value as a file handle that uniquely identifies the file, which can be subsequently used to read and/or delete the file from memory.
Retrieving or deleting a data file from memory is no different than the way you would retrieve or delete a sound file. To retrieve a file, use the Upload Sound File command (245L), keeping in mind that the header (minus the 0xc0 0xdb) will be included with the data. You can use the 24 bit length field to immediately determine how many bytes to expect; the tag field can be used to confirm the fileís identity, if desired. Retrieving the data in the example above would yield the following:
0x02 0x00 0x00 0x00 0x05 0x00 0x68 0x69
To determine how much recording memory is available/remaining, use the RC8660ís Interrogate command (12?). That's all there is to it!