The abstract under the Matlab/Simulink environment, designs the DSP procedure with the presente in figures and diagrams way, but reduced program design. Using Embedded Targetfor T1 C2000 the DSP tool bag, designs DSP the ADC conversion routine; Using the Simulink digital signal processing tool bag, designs the FIR filter clamour to carry on filter processing; Gives when the revision production C language procedure how to enable DSP to move correctly. The design procedure moves correctly on the TM$320LF2407A processor.
Key word digital signal processing Matlab Embedded Target for TI C2000 toolbox FIR filter
TMS320LF2407 is one kind of high performance which, the low price DSP processor the TI Corporation hosts push, its processing speed achieves 30 MIPS, internal processing integrates outside RAM, Flash and the timer, but also integrated modules and so on A/D switch, PWM controller and CAN bus control unit, especially qualify in electrical machinery, power source transformation and so on real-time request high control system. But usually designs the DSP procedure the method is, in DSP integrated development environment CCS with the C language design, needs to spend the massive time to use for to compile and the input routine code. Designs DSP in Matlab with the presente in figures and diagrams way the procedure, can reduce the product the development time.
1 Embedded Target for T1 C2000 DSP introduction
At present, the new edition’s Matlab software (Matlab7.O) already integrated TI Corporation C2000, C5000, C6000 the series DSP development tool bag, may carry on DSP in the Matlab/Simulink environment with the presente in figures and diagrams way the design and the simulation confirmation. And can the graphic file which designs (.mdl) transform directly the C language procedure. And the C2000 series’s development kit is EmbeddedTarget for TI C2000 DSP. This tool bag is the product which TI Corporation and Math-Works Corporation develops together, has inserted the eXpressDSP toolbox in Matlab/Simulink, supports C24x and C28x the series DSP processor. In C24x in the series DSP toolbox, contains in the DSP processor’s mold/number to transform modules and so on (ADC), CAN transmission and receive, PWM control. The user may transfer these presente in figures and diagrams in Matlab in the functional module and the Simulik other module establishment digital signal processing model, and may carry on the simulation confirmation to the model, then produces TMS320C2000 the C language code and the CCS engineering project document, in CCS after revision, translation may download to the DSP goal board in moves.
2 ADC transformations and FIR filter disposal procedure design
The following is tool bag designs the ADC transformation and the FIR filter’s step with Embedded target for TI the C2000.
The step 1, in the newly built Simulink document (.mdl), puts in C2000 Target Preferences LF2407 the eZdsp function block, uses in the parameter the initialization establishment. Dialog box establishment as shown in Figure 1. And the DSP timer’s clock proportionality factor (Timer Clock Prescaler), may choose I~128, then the corresponding timer sampling time is:
In the formula Timer Period is the DSP biggest clock count cycle, LF2407 is 16 fixed-point processors, therefore Timer the Period number is 216-1. In Figure 1 establishes Timer Clock the Prescaler value is 2, when the LF2407 operating frequency (CPU Clock Speed) is 40MHz, calculates scaler’s sampling time based on the above equation is 0.003 2 S. Because the data processing needs to take certain running time, must therefore through the experimental choice suitable timer sampling time.

Realizes the function block which A/D transforms is C24x ADC, its parameter establishment as shown in Figure 2. A/D transformation channel may choose in module A, B any channel, may also choose many channels, the sampling time establishment which A/D transforms is 64/80 000.

The step 2, design the FIR filter. In the Simulink signal processing toolbox (Signal Processing Bloekset), (FDAToo1) puts in the filter design special-purpose tool in the document, the double click chart symbol, springs the filter design dialog box which shown in Figure 3.
In Figure 3, the selective filter type is the FIR low pass filter, the sampling frequency is 6kHz, the low pass frequency is 1kHz, up to the frequency is 2 kHz. Clicks on the dialog box first Design Filter, then clicks on Figure 3 to realize the model again (Realize Model) the icon to enter the model to realize the dialog box, chooses Over-write generated “filter” block, produces a name is “Filter” the FIR filter’s function diagram in the design diagram, then originally will put in the FDATool icon deletes, connects in the chart Filter, completes design as shown in Figure 4.

In Figure 4 increases gain module (Gain) is to realize the data type transformation. What because ADC transformation output is 16 trueing data, but filter’s input needs the double precision floating-point data, therefore the Gain data type parameter (Signal datatypes) supposes is float (”double”). Gainl is transforms the floating number into the trueing number, therefore the data type parameter supposes is uint(16). In Figure 4 increases the register (C24x To Memory) the module is to cause the design to be complete. In the production C procedure, the gain module Gainl output is rth-Gainl, may by other application procedure transfer.
The step 3, produce the graphic file the C procedure. In Figure 4, moves under Simulation menu Configuration the Parameters item, springs the disposition dialog box, choice Real-Time the WorkShop item, clicks on the Build button, Figure 4 diagram transformation is the TI C2000DSP C language code, and transfers CCS2 software compilation run this procedure automatically. The production C language procedure includes: Interrupt vector document vectors.asm, interrupt service MW_c24xx_csl.C, ADC switching control testADC.c, master routine TestADC_main.c and so on.
3 revisions and perfect procedure
Can realize the ADC transformation and the digital filtering function by the Matlab direct production’s procedure, but because in the procedure has used many default establishments, also has some problems in the movement process. With in the above method production’s procedure, in the interrupt handling routine only carries on processing to the timer interrupt. when the unwanted signal causes other interrupts, will create the DSP engine off, must therefore in the interrupt vector definition invalid interrupt (_nothing), and increases the interrupt service in the interrupt response procedure. After the revision procedure, the italics part is the revision code. The updated program is as follows:
Interrupt vector document vectors.asm:


In the ADC transformation disposal procedure, after each time the ADC transformation had ended, has not repositioned DSP the sorting indicator. What although in the procedure establishes only carries on a channel’s A/D transformation, but the result is actually 16 channel’s circulation transformations, causes the digital filter to lose the person data not to be correct, therefore the procedure needs to make the revision, increases in testadc_c:
TestADC_B.C24xADC=MMREGS[RESULT0]>>6; /*A/D transformation result right lateral 6 */
MMREGS[ArN2TRL2]=MMREGS[ADCTRL2]l0X4242; the/* replacement sorting indicator and eliminates a/D interrupt to symbolize */
If needs through the t/o port output result, then may define one in testadc_c I/o(portl00), after then FIR filter’s data rtb-Gainl output, the procedure is as follows:

4 test results and conclusion
By the above methods design’s procedure on the TMS3201LF2407A processor can the normal operation. The test result proved that after using the FIR filter, ADC transforms antijamming ability had the distinct enhancement. Establishes TI fast with Matlab the DSP model and produces the C language procedure directly the method, simplified the DSP software’s development. Toolbox also contains other tools in Embedded target for TI in the C2000, like PWM control, CAN main line control and general I/O control and so on. Unify using in these tools and Simulink other tools, can complete the complex function the DSP programming, and only need make the few revisions, may realize the function correct C language procedure design, saves the procedure the compilation and the input time.