• Module outputs the high frequency sine wave with DSP56F805 the PWM

        Cannot have the high frequency sine wave shortcoming in view in the Motorola DSP56F805 PWM module, according to the SPWM principle, by imitations and so on direct area, calculates the corresponding pulse the initial station and the end point, then the programming realizes, modulates the sine wave after the debugging discovery to have the good characteristic.
        DSP56F805 is one kind uses for to control electrical machinery’s microprocessor specially, the interior has each kind of functional module, for example, a/D transformation module, the PWM module, the timer module and so on, provided for the development based on the DSP system have been very greatly convenient. In view of the development system, Motorola was we have provided corresponding software development tool CodeWarrior and SDK, caused us to develop based on the Motorola DSP system is more convenient quickly.

    1 question description
        Motorola embedded SDK (Software Development Kit) is API, the storehouse, the service, the rule aggregate, it has accelerated the DSP development work. But, its timer is realizing the small time aspect accuracy actually not to be fixed time high, to realizes the high frequency sine wave (10~100kHz) to have certain difficulty. Therefore, may use the software time delay the method steering impulse sequence output, this to realize the high frequency sine wave to lay the foundation. Moreover, because DSP56F805 has provided the PWM module, mainly uses in the motor control, the output is PWM 1 WM5 six groups outputs, has provided conveniently for the motor control. But this module cannot provide the high frequency output, is realizing the high frequency sine-wave modulation aspect is a difficulty. Therefore, the author has not used the PWM module, but uses the general I/0 mouth achievement output.

    2 pulse width solution principles

        Imitations and so on direct area presently available chart 1 explains originally. Picks in the sine wave between a plot △t, the sine wave area is S1, must produce PWM pulse area S2 and S1 and so on. In the sine wave and the pulse height know under the condition, may calculate the arteries width ζi. Thus `obtains the corresponding switchpoint, calculates in a sine wave period to correspond all pulse height known condition, may calculate in a sine wave period to correspond feared that has the pulse train to be relatively seasonable the position.

        According to the concrete formula, may calculate in the pulse train using the C language programming each pulse relative width and the position, as follows shows:
        main()
        {
        unsignedinti;
        float del, del2, x[20], xz[20], xl[20], xr[20], y[20];
        unsigned int xy[34];
        if (fp=fopen (”d600″, “w”) ==NULL)
        {pfintff “can’t openthisfile \ n”; exit(O);}
        del=3.14159/8;
        del2=3.14159/16;
        x[O]=O;
        xl[O]=O:
        for (i=1; i<17; i )
        {
        x[i]=i*3.14159/8;
        xz[i]=x[i-1] del2;
        y[i]=del cos(x[i-1]) cos(x[i]);
        xl[i]=xz[il y[i] /4;
        xr[i]=xz[i]-y[i]/4;
        xy[2*i-1]=(xT[i]-xl[i-1])*50000/6 28318;
        xy[2*i]=(xl[i] xr[i]) *50000/6.28318;
        printff “y[%d]=%f%f%f \ n”, i, y[i], xr[i], xl[i]);
        printf (”xy [%d=%d", i i-1, xy[i i-1]); printf (”xy[%d]=%d \ n”,
        i i, xy[i i]);
        }
        for (i=l; i<9; i ) fprintf (fp, “%u,”, xy[i]); fprintf (fp, “n”);
        for (i=9; i<17; i ) fprintfp. “%u,”, xy[il); fprintf (fp, "n"):
        for (i=17; i<25; i ) fprintf (fp, "%u,", xy[i]); fprintf (fp, “\ n”);
        for (i=25; i<33; i ) fprintf (fp, “%u,”, xy[i]); fprintfffp, “n”);
        fclose(fp);
        The computed result is:
        xy[321={1562,1865,979,2425,485,2853,155,3085,39,3085,155,2853,485,2425,979,1865,1562,1259,2145,699,2639,27l,2969,39,3085,39,2969,27l,2639,699,2145,1259};
        From this then obtains in one cycle to correspond 16 pulse trains relative position xy[1]~xy[31]. If wants to obtain the frequency which needs, but also needs to imitation and so on direct area principle available charts 1 to explain. Picks it to carry on the corresponding transformation.

    3 hardware circuits
        Uses general outlet PB0 to take the pulse outlet, then matches by the simple resistive-capacitive circuit carries on the filter, then may realize each kind of frequency high frequency sine wave which needs. Sine wave output circuit as shown in Figure 2.

    4 software designs
        According to pulse switch time spot which calculates, controls each pulse through the software time delay’s method the switching time, completes the pulse output the procedure. But, if wants to obtain the corresponding frequency, must make the corresponding transformation to xy[i].
        Take one cyclical 16 pulse as the example, calculates in a datum cycle each pulse to stop position xy[1]~xy[31], if needs other frequency value, may obtain through the corresponding value transformation.
        For example, must obtain 6OOHz the sine wave, makes the following transformation:
        for (i=0; i<33; i )
        SinDataF2[i]=(UWord32)xy[i]*237/(10*Fs)
        And Fs-600.
        Therefore, outputs one cyclical sine wave algorithm flow chart as shown in Figure 3.

        Realizes the procedure to be as follows specifically:
        void SpwmGenerate (UWordl6 FI, UWordl6 F2) {
        intl;
        UWordl6j;
        UWordl6*pSinDataFlF2;
        asm(bfclr#$8101, x:(PWMA_BASE $3))
        while(SpwmRun) {
        pSinDataFlF2=pSinDataFlF2reg;
        for (i=0; i<32; i , pSinDataFlF2 ) {
        for (j=1; J<*pSinDataFlF2; j );
        asm(bfchg#$8101, x:(PWMA-BASE $3));
        }
      }
    }

    5 conclusions
        After the debugging discovery, the output sine wave has the very good characteristic, may say generates the different frequency the sinusoidal signal, has certain reference value in the DSP other application aspect.

    Share/Save/Bookmark

    Thursday, August 21st, 2008 at 12:36
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TOP
Copyright © 51 Research and Design, Electronic Engineers website - Embedded Systems, MCU, DSP, EDA, Test and Measurement, Components, Communications, Power, Microelectronics, Semiconductors
Powered by WordPress | Theme by mg12 | Valid XHTML 1.1 and CSS 3