LUT to DAC transfer without DMA

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
greg79
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Dear all,

The goal of this project is to be able to place samples from a LUT to DSC without DMA and triggered by a clock signal. 

However I don't see anything with the scope. I am certain the interrupt is triggered but somehow the LUT values are not placed in the DAC register. The DAC is strobed by the same clock as per suggestion of the VDAC8 documentation. What am I missing?

clkinter.PNG

#include "project.h"

uint8_t tableIndex;

uint8_t sineWaveLUT[100] = {0x80,0x88,0x8f,0x97,0x9f,0xa7,0xae,0xb6,
0xbd,0xc4,0xca,0xd1,0xd7,0xdc,0xe2,0xe7,
0xeb,0xef,0xf3,0xf6,0xf9,0xfb,0xfd,0xfe,
0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf9,0xf6,
0xf3,0xef,0xeb,0xe7,0xe2,0xdc,0xd7,0xd1,
0xca,0xc4,0xbd,0xb6,0xae,0xa7,0x9f,0x97,
0x8f,0x88,0x80,0x77,0x70,0x68,0x60,0x58,
0x51,0x49,0x42,0x3b,0x35,0x2e,0x28,0x23,
0x1d,0x18,0x14,0x10,0xc,0x9,0x6,0x4,
0x2,0x1,0x0,0x0,0x0,0x1,0x2,0x4,
0x6,0x9,0xc,0x10,0x14,0x18,0x1d,0x23,
0x28,0x2e,0x35,0x3b,0x42,0x49,0x51,0x58,
0x60,0x68,0x70,0x77};

CY_ISR(clock_interrupt){
    VDAC8_SetValue(sineWaveLUT[tableIndex]);
    if(tableIndex == 99){
        tableIndex=0;
    } else {
    tableIndex++;
    }
}

int main(void)
{
    VDAC8_Start();
    clock_interrupt_StartEx(clock_interrupt);
    CyGlobalIntEnable; /* Enable global interrupts. */
    
    for(;;)
    {
        /* Place your application code here. */
    }
}

 

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

greg,

Another easy fix.

You forgot to Start() the Opamp_1.

I placed Opamp_1_Start() after starting the VDAC.

Once I did, I received 120 Hz sinewave.

Note:  If you're using an Opamp output to Analog pin, I recommend using P0.0, P0.1, P3.6 or P3.7.   These pins are more directly connected to the Opamp output with lower routing resistance (<100 ohms).  It will then allow sourcing/sinking up to 25 mA.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

2 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

greg,

Another easy fix.

You forgot to Start() the Opamp_1.

I placed Opamp_1_Start() after starting the VDAC.

Once I did, I received 120 Hz sinewave.

Note:  If you're using an Opamp output to Analog pin, I recommend using P0.0, P0.1, P3.6 or P3.7.   These pins are more directly connected to the Opamp output with lower routing resistance (<100 ohms).  It will then allow sourcing/sinking up to 25 mA.

Len
"Engineering is an Art. The Art of Compromise."
greg79
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

Hah, thank you!

0 Likes