Hi, das Beispiel msp430xG46x_dma_07_CCE.c von TI beinhaltet 2 Lookuptables. Einmal für einen Sinus und einmal für einen cosinus. Schrittweite beträgt 32. Nun hab ich versucht, die Auflösung der Kurven zu verfeinern, in dem ich die LookUpTable vom Sinus um weitere 32 Werte hinzugefügt habe. Leider sieht es so aus, als ob der Code dennoch nur die erste 32 Werte durch den DAC schickt. Denn ich bekomme nur oberwellen des Sinus raus. Also alle Wellentäler sind nach oben geklappt. Was muss ich noch tun, um meine Schrittweite auf 64 zu erweitern? f+r die LookUpTable hatte ich auch in den Index auf 64 erweitert, daran liegts also nicht ;) Muss man vielleicht noch den Speicher anders zuweisen? Und was auch nicht klar ist, wieso die Zeile: TACTL = TACLR + MC_1 + TASSEL_2; // Up mode, SMCLK einmal mit Up_Mode ausgewiesen ist und weiter unten, wird der Timer nochmal eingestellt mit: TACTL = TASSEL_2 + MC_1; // SMCLK, contmode und wird hier als Continiousmode ausgewiesen. ??? Oder haben die sich da verschrieben? Hier mal der original Code: -------------------------------------------------------------- //********************************************************************** ******** // MSP430xG461x Demo - DMA0/1, Rpt'd Blk to DAC12_0/1, Sin/Cos, TACCR1, XT2 // // Description: DMA0 and DMA1 are used to transfer a sine and cos look-up // table word-by-word as a repeating block to DAC12_0 and DAC12_1. The effect // is sine and cos wave outputs. Timer_A operates in upmode with TACCR1 // loading DAC12_0 amd DAC12_1 on rising edge and DAC12_OIFG triggering next // DMA transfers. DAC12_0 and DAC12_1 are grouped for jitter-free operation. // ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz // //* An external watch crystal between XIN & XOUT is required for ACLK *// // // MSP430xG461x // ----------------- // /|\| XIN|- // | | | 32kHz // --|RST XOUT|- // | | // | DAC0/P6.6|--> ~ 10kHz sine wave // | DAC1/P6.7|--> ~ 10kHz cos wave // // A. Dannenberg/ M. Mitchell // Texas Instruments Inc. // October 2006 // Built with CCE Version: 3.2.0 //********************************************************************** ******** #include "msp430xG46x.h" //---------------------------------------------------------------------- -------- // 12-bit Sine Lookup table with 32 steps //---------------------------------------------------------------------- -------- const int Sin_tab[32] = { 2048, 2248, 2447, 2642, 2831, 3013, 3185, 3346, 3495, 3630, 3750, 3853, 3939, 4007, 4056, 4085, 4095, 4085, 4056, 4007, 3939, 3853, 3750, 3630, 3495, 3346, 3185, 3013, 2831, 2642, 2447, 2248, 2048 }; //---------------------------------------------------------------------- -------- // 12-bit Cosine Lookup table with 32 steps //---------------------------------------------------------------------- -------- const int Cos_tab[32] = { 1648, 1264, 910, 600, 345, 156, 39, 0, 39, 56, 345, 600, 910, 1264, 1648, 2048, 2447, 2831, 3185, 3495, 3750, 3939, 4056, 4095, 4056, 3939, 3750, 3495, 3185, 2831, 2447, 2048 }; void main(void) { volatile unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer FLL_CTL0 |= XCAP14PF; // Configure load caps ADC12CTL0 = REF2_5V + REFON; // Internal 2.5V ref TACCR0 = 13600; // Delay to allow Ref to settle TACCTL0 |= CCIE; // Compare-mode interrupt. TACTL = TACLR + MC_1 + TASSEL_2; // Up mode, SMCLK __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts TACCTL0 &= ~CCIE; // Disable timer interrupt __disable_interrupt(); // Disable Interrupts DMACTL0 = DMA0TSEL_5 + DMA1TSEL_5; // DAC12IFG triggers DMA0SA = (void (*)())Sin_tab; // Source block address DMA0DA = (void (*)())&DAC12_0DAT; // Destination single address DMA0SZ = 0x020; // Block size DMA0CTL = DMADT_4 + DMASRCINCR_3 + DMAEN; // Rpt, inc src, word-word DMA1SA = (void (*)())Cos_tab; // Source block address DMA1DA = (void (*)())&DAC12_1DAT; // Destination single address DMA1SZ = 0x020; // Block size DMA1CTL = DMADT_4 + DMASRCINCR_3 + DMAEN; // Rpt, inc src, word-word DAC12_0CTL = DAC12LSEL_2 + DAC12IR + DAC12AMP_5 + DAC12IFG + DAC12ENC + DAC12GRP; DAC12_1CTL = DAC12LSEL_2 + DAC12IR + DAC12AMP_5 + DAC12IFG + DAC12ENC; TACCTL1 = OUTMOD_3; // TACCR1 set/reset TACCR1 = 01; // TACCR1 PWM Duty Cycle TACCR0 = 025-1; // Clock period of TACCR0 TACTL = TASSEL_2 + MC_1; // SMCLK, contmode while(1) { __bis_SR_register(LPM0_bits + GIE); // Enter LPM0 } } #pragma vector = TIMERA0_VECTOR __interrupt void TA0_ISR(void) { TACTL = 0; // Clear Timer_A control registers __bic_SR_register_on_exit(LPM0_bits); // Exit LPMx, interrupts enabled } ------------------------------------------------------------------------
Und wieder einmal kann ich mir selber antworten :D In der Zeile: DMA1SZ = 0x020; // Block size muss man den Wert 0x020 auf den Indexwert der Table angleichen. Für 64 Werte entspricht das also 0x040. Bleibt noch offen, wieso MC_1 einmal als Up_Mode und einmal als Cont_Mode ausgewiesen ist?! Hat da jemand eine Idee?
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.