• Content Count

  • Joined

  • Last visited

  1. Hi Brian, We have to dig deeper into the data types we are using. The integer: 1048576 is binary: 0b100000000000000000000. it contains 20 zeroes and 1 one. This is what we want to send. Lets say we want to send at 100 khz, this means the width of high is 10 microsecond. To get this frequency out we need to divide the main frequency with a divider. This divider is hzSys.value/PrefferedFrequency. channel0 = c_int(0) enable = c_int(1) pulsesLo = 50 pulsesHi = 974 prefferedFrequency = 100e3 pulse = c_int( 0b1<<(math.floor((pulsesHi+pulsesLo)/pulsesLo)) ) pulseLength = c_int( 1+math.floor((pulsesHi+pulsesLo)/pulsesLo) ) hzSys = c_double() dwf.FDwfDigitalOutInternalClockInfo(hdwf, byref(hzSys)) dwf.FDwfDigitalOutEnableSet(hdwf, channel0, enable) dwf.FDwfDigitalOutTypeSet(hdwf, channel0, DwfDigitalOutTypeCustom) dwf.FDwfDigitalOutDividerSet(hdwf, channel0, c_int(int(hzSys.value/prefferedFrequency))) dwf.FDwfDigitalOutDataSet(hdwf, channel0, pulse, c_int(pulsesHi+pulsesLo)) dwf.FDwfDigitalOutConfigure(hdwf, enable)
  2. I try to receive data with an Analog Discovery Kit (AD) from a FPGA written with my own protocol. Three signals enter the AD: Clock, Trigger, and Data. At the rising edge of the trigger, I would like to sample 16 bits from the data synchronous to the clock (around 20 Mhz). How can this be done with an AD and SDK? With an FPGA writing this is a matter of minutes, but some how I cannot wrap my head around this. Below is the code I am using, but sadly it returns only 0x0000 or 0x000. How to receive data in this way? Cheer, VonPuffelen FDwfDigitalInConfigure(AnalogDiscoveryHandle, false, true); // start sampling STS sts; unsigned int timer = 0;// wait for receiving do{ if(!FDwfDigitalInStatus(AnalogDiscoveryHandle, true, &sts)) // pull for trigger event { printf("AcquireErro(42)"); return 42; } timer++; }while((sts != stsDone) && (timer < 0x1FFF)); FDwfDigitalInStatusData(AnalogDiscoveryHandle, data, length*sizeof(unsigned short)); // fetch data from IO buffer. FDwfDigitalInConfigure(AnalogDiscoveryHandle, false, false); // stop sampling
  3. Hi Brian, As an potential solution, I would go for a custom output: CustomOutput = 0b1 << (pulsesLo / pulsesHi +1) dwf.FDwfDigitalOutDataSet(hdwf, Channel, CustomOutput, 1+ (pulsesLo / pulsesHi)) This way always a sequence of 0b1000...0 is send. So if you want 99% low you send 100 bits of which 1 is high. Cheers, VonPuffelen