Jump to content

Stefan-F

Members
  • Posts

    4
  • Joined

  • Last visited

Stefan-F's Achievements

  1. Thank you @attila, your solution does the trick. All that needs to be done is to adjust the length of the pulse patterns so that an integer number fits into the entire memory. Best regards, Stefan
  2. Hi, I want to output a complex but periodic pattern (like the PWM signal of a sine wave), with more than 64k samples / period. I want to define the data points for a period and output this pattern endlessly. I tried to use playback mode, like in DigitalDiscovery_PlayRecord.py, which works fine for a single period. But I have not found a way to repeat the pattern. I tried setting FDwfDigitalOutRepeatSet() to a value other than one, but the data point address doesn't seem to start over at 0 for each new period, but keeps increasing and outputting random memory contents after the first period. Is there an other way to solve this problem? Or is it possible to make FDwfDigitalOutRepeatSet() work for values other than one? Best regards, Stefan
  3. OK, I found the solution myself: Pin DIO31 has the address 7, not 31. So the following code does the trick: // Pmod DA1 - AD7303 DIO.Set(31-24,1); // <-- DIO31 has address 7 for(var i = 0; i < 50 & wait(0.1); i++){ var va = 128+sin(2*PI*i/50)*127; var vb = 128+cos(2*PI*i/50)*127; Start(); Write(16, 0x0100 | (va & 0xFF)); // Update DAC A input register from shift register // Stop(); // Start(); Write(16, 0x2400 | (vb & 0xFF) ); // Load DAC B input register from shift register and update both DAC A and DAC B DAC registers outputs. Stop(); // output latch pulse: DIO.Set(31-24,0); // <-- DIO31 has address 7 // wait(0.0001); // without wait(), pulse with is approx. 0.9 ms DIO.Set(31-24,1); // <-- DIO31 has address 7 } return "done"
  4. Hello, to load data into a serial DAC, a separate latch pulse is needed at the end of an SPI transfer. I tried to achieve this using a Custom SPI protocol and adding control for an extra output pin. According to help file: I modified an example script, but adding DIO.Set(31, 1) results in "Data transfer error", and WaveForms has to be restarted to recover from it. // Pmod DA1 - AD7303 // DIO.Set(31,1); // <-- uncommenting this line results in "Data transfer error", need to restart WaveForms to recover for(var i = 0; i < 50 & wait(0.1); i++){ var va = 128+sin(2*PI*i/50)*127; var vb = 128+cos(2*PI*i/50)*127; Start(); Write(16, 0x0100 | (va & 0xFF)); // Update DAC A input register from shift register Stop(); Start(); Write(16, 0x2400 | (vb & 0xFF) ); // Load DAC B input register from shift register and update both DAC A and DAC B DAC registers outputs. Stop(); // DIO.Set(31,0); // <-- uncommenting this line results in "Data transfer error", need to restart WaveForms to recover wait(0.0001); // DIO.Set(31,1); // <-- uncommenting this line results in "Data transfer error", need to restart WaveForms to recover } return "done" Any suggestions to generate the desired signal? Any help is appreciated!
×
×
  • Create New...