The DSP Emulator will function as follows first the DSP must be

By Benjamin Cruz,2014-11-26 12:38
7 views 0
The DSP Emulator will function as follows first the DSP must be

    I. Introduction

    The DSP Emulator will function as follows: first the DSP must be initialized; the Lab VIEW interface “” sends these initialization values to

    the UART, which will receive these values serially. The UART is in charge of buffering. The UART must be configured to have an input pin, through which it will receive the initialization values.

     Once it is initialized it can receive signals from the ADC. The ADC will be configured to receive an analog input from the data acquisition board (DAQ). After the analog signal is converted to its corresponding digital values, these values will be used along with the configuration values received from the UART to implement the CIS algorithm on the data, using equations for high, low and band pass filters a 16 bit command word will be generated, this command word will be sent later on through the SPI to the Hybrid Chip Lab VIEW interface to simulate electrode stimulation.

    The Serial Peripheral Interface SPI will establish communication between the microcontroller device and the data acquisition board and will be simulated by a Lab VIEW interface. The SPI will send the command word, which is a 16-bit pattern containing the information about the amplitude of the sound wave, the specific channel and site to be activated in order to stimulate the electrodes in the cochlear implant. This 16 bit sequence is sent through the peripheral in bytes, one byte at a time. The command word will be generated by a program running inside the microcontroller. The 16 bit pattern is sent through the


SPI to the DAQ one byte at a time, sending the amplitude of the sound to be

stimulated, and having in the second byte the channel and the site to be activated.


    II. Current Work and Accomplishments

A. UART Configuration

    In working on the intercommunication between the Lab VIEW interface

     microcontroller the following tasks have been completed: first, port and

    configuration is achieved by configuring the crossbar. This is done by first setting SFRPAGE to CONFIG_PAGE. Once this is done, we proceed in initializing the crossbar registers XBR0, XBR1, and XBR2 to the respective values for a particular setting desired for the UART. Then, we configure the port desired for the transmission pin and receive pin of the UART (the output pin and input pin, respectively).

    According to this setting, pins P0.0 and P0.1 are configured to be the output and input pins respectively.

    After setting the crossbar, the UART is initialized as followed: SFRPAGE must be set to UART0_PAGE. SCON, the serial control register is set to 0x10, which is 8-bit Shift Register Mode. This mode is based on the oscillator’s frequency. Next TR1, UART external interrupt bit, receive interrupt, and transmit interrupt bits (ES0, RI0, and TI0) are cleared to make sure that timer1 is off, and all UART interrupts are off.


    The serial baud rate must then be set, by initializing the timer in a particular way: first SFRPAGE is set to TIMER01_PAGE. TMOD, the timer mode register is set to 0x20. This places the timer mode for timer1 in 8-bit auto-reload. The timer1 low byte (TL1) will be the actual timer, and the respective high byte (TH1) will contain the reload value, for each time the low byte overflows from 255. Since the baud rate is determined by how frequently timer1 overflows, a faster overflow is desired. This is done by initializing PCON (power control register) to 0x80, CKCON (clock control register) to 0x10, and TH1 to 253. Each time TL1 reaches 255, timer1 will overflow and will reload to 253, and start counting from 253 to 255. Hence a faster overflow and baud rate is obtained. Once the timer set up is completed, the external interrupt bit (ET1) for timer1 is set.

    The UART and timer are now set for transmission and receiving. If we want to write to the serial buffer SBUF0, the TI0 (transmit interrupt) must be initially cleared. Timer1 and the external UART interrupt must be enabled. The value d is written to the buffer. The UART buffer will be receiving each bit of the


    value serially and saving each one in parallel, starting with the least significant bit.

    When 8 bits are finally transmitted to the UART (see fig. 1), the 8 bits will be

    written to the buffer in parallel. When 8 bits are transmitted, the microcontroller

    will set up the transmit interrupt bit, indicating that the value has been finally

    written to the buffer.

    Figure 1. UART Transmission


    When the UART buffer receives a byte, the receive interrupt will be set to

    one. This means that the value stored at the buffer should be read before another

    byte is written to the buffer. After reading a byte, the crossbar, the timer, port, and

    interrupts are disabled.


B. ADC Configuration

    The configuration of the microcontrollers ADC is crucial in the function of the Emulator. The ADC will be in charge of receiving an analog signal from the DAQ. The ADC will convert the signal using an internal reference voltage that will be configured using C code. The silicon LABS IDE has a configuration wizard that can be used to configure the different components of the 8051. See Figure 2.

    Figure 2: Analog to digital converter.


    First of all the ADC must be initialized, the ADC interrupts, timers and mode are initialized. The ADC will be configured with a resolution of 8 bits.

    To view the values that will be obtained we will store them temporarily in an array and then send them to a port, to view them using the silicon labs IDE. Since we do not know yet the voltage range that will be received from the DAQ, we do not know the voltage range of the signal that will be received; we cannot say what is the voltage resolution. ADC0 (P0) will be configured as the input port for the ADC, this ADC has an 8 bit resolution.

    For now we are using a sample rate of 100Khz which is the default rate that the wizard provides, when testing commences we will possibly change the sampling rate to meet the power and timing requirements.


The clock for the ADC is the default clock set by the configuration wizard

with a frequency of 18.42MHz.


C. SPI Configuration

    The SPI will be in charge of transmitting the data from the microcontroller to the Lab VIEW interface. We conducted some research in the microcontrollers support page finding some SPI examples. Using the supplied datasheets the SPI was configured to transmit some test data as shown in the Appendix in the test_SPI.c document code. The transmittal was tested in the laboratory using a Logic DART.

    I will be explaining some of the most important parts our SPI code:

    SPI_Transmit function receives the data to be sent and uses a while loop to wait until complete transmission is achieved, once achieved a complete indicator is set.

    Our implementation uses a wait_Delay in the main portion of our program which provides us a time delay after invoking the SPI_Transmit function to send the data.


Report this document

For any questions or suggestions please email