Spectrum Brands MI.61XX 用户手册

下载
页码 79
48
MI.61xx Manual
Programming
Standard generation modes
Standard mode
Writing data to the memory is really easy, if a replay mode is used, that stores non multiplexed data in the dedicated memory channels. The 
next example shows, how to write the data before replaying two channels without multiplexing to both memory channels.
If you use two channels for replay using only one memory channel, the data in the memory channel(s) has to be multiplexed and needs to be 
sorted by the user. The following example shows how to sort the data for the replay of two channels using memory channel 0.
Sample format
The 8 bit samples in twos complement are always stored in memory 16 bit integer values. This leads to a range of possible integer values 
from -128…0…+127.
 
for (i = 0; i < 2; i++)                                       // both memory channels have been used
    pbyData[i] = (ptr8) malloc (lMemsize);                    // allocate memory for the data pointers
                                                              // with the maximum size (lMemsize)
// generate or load data into pbyData[0..1]
SpcSetData (hDrv, 0, 0, lMemsize, (dataptr) pbyData[0]);      // no multiplexing is necessary on channel 0
SpcSetData (hDrv, 1, 0, lMemsize, (dataptr) pbyData[1]);      // neither it is on channel 1
for (i = 0; i < 2; i++)                                       // two channels to write to memory channel 0
    pbyData[i] = (ptr8) malloc (lMemsize);                    // allocate memory for the data pointers
                                                              // with the maximum size (lMemsize) per channel
// generate or load data into pbyData[0..1]
pbyTmp = (ptr8) malloc (lMemsize * 2);                        // allocate temporary buffer for copy
for (i = 0; i < lMemsize; i++)                                // combine data of the two channels
    {
    pbyTmp[2*i]   = pbyData[0][i];
    pbyTmp[2*i+1] = pbyData[1][i];
    }
SpcSetData (hDrv, 0, 0, 2 * lMemsize, (dataptr) pbyTmp);      // write both channels to memory channel 0
free (pbyTmp);                                                // free the temporary buffer
Bit
Standard Mode
D7
DAx Bit 7 (MSB)
D6
DAx Bit 6
D5
DAx Bit 5
D4
DAx Bit 4
D3
DAx Bit 3
D2
DAx Bit 2
D1
DAx Bit 1
D0
DAx Bit 0 (LSB)