PRELIMINARY
VS1063a Prog. Guide
4
INTERFACING WITH VS1063A USING A MICROCONTROLLER
4.1.2
SCI Bus Access Example
Now that the needed support functions have been presented, below is a very simple program
that reads register SCI_STATUS, then sets SCI_VOL to 0x0a0a.
#define SCI_STATUS 0x1 // Definitions from VS10xx Datasheet
#define SCI_VOL
0xB //
Chapter "SCI Registers"
void main(void) {
unsigned short st;
// Initialize SPI pins for VS10XX communication
CONFIGURE_AS_INPUT(PIN_MISO);
CONFIGURE_AS_OUTPUT(PIN_MOSI);
CONFIGURE_AS_OUTPUT(PIN_SCK);
CONFIGURE_AS_OUTPUT(PIN_XCS);
OUT_SET_LOW(PIN_SCK);
OUT_SET_HIGH(PIN_XCS);
st = VsReadRegister(SCI_STATUS);
VsWriteRegister(SCI_VOL, 0x0a0a);
}
4.2
The SDI (SPI) Bus
Like SCI, also SDI is an SPI bus. However, SDI is meant for simple, unstructured bitstream
transfer for e.g. MP3 files.
Below is a pseudocode example of how to send 32 bytes of data to SDI:
// VsSendSDI sends 32 bytes of data to VS10xx
void VsSendSDI(const unsigned char *d) {
int i;
while (!IN_IS_HIGH(PIN_DREQ)) { // Cannot send data if DREQ is low
WaitFor10MSec();
}
for (i=0; i<32; i++) {
SpiTransfer(*d++); // Transmit byte
}
}
Version: 0.40, 2011-09-02
9