Hi,
Looking to digitize a 1 kHz (1 Vpp) sine wave via the HP3458A, and transfer the sampled data to the host pc.
I've downloaded the example program, 4100 point program, in c#. I can get the program to function, create samples and return data.
It uses the DCV digitizing mode.
Now, i'd like to optimize the settings so it's specific to a 1kHz sinewave.
Example test program code:
cmds = "PRESET DIG;"; // Preset to the designated state (Digitizing)
cmds += "MFORMAT DINT;"; // Set the memory storage format (double integer)
cmds += "OFORMAT ASCII;"; // Set the output format (ASCII)
cmds += "MEM FIFO;"; // Clear memory and set memory storage type
cmds += "APER 2E-6;"; // Set the arperature time (
cmds += "TRIG AUTO;"; // Set the trigger source (Auto)
cmds += "NRDGS 4100,AUTO;"; // Set the number of readings (4100 readings)
cmds += "END ON;"; // Enable EOI function
cmds += "TARM HOLD"; // Hold the trigger until triggered
SendCmd("TARM SGL");
My Program, trying to digitize a 1kHz sine:
cmds = "PRESET DIG;";
cmds += "MFORMAT DINT;";
cmds += "OFORMAT ASCII;";
cmds += "MEM FIFO;";
cmds += "APER 0.0000122;";
cmds += "TIMER 0.0000122;";
cmds += "NRDGS 2048,TIMER;";
cmds += "END ON;";
cmds += "TARM HOLD";
SendCmd("TARM SGL");
My program errors duing the TARM SGL. 2048 (0 to 2047) samples are returned, however the last two samples are out of wack.
When I complete an FFT, the fundamental is at bin 51.
With the above setting, i expect this to be 1kHz and a fundamental at bin# 25.
Attached is my sampled data.
I believe my setting should represent this digitizing sample set:
F0 = 1000.576 Hz
M = 25 Cycles
N = 2048 Smpls
Fs = 81967.21311 Hz
Fres = 40.023 Hz
I chose just off 1kHz to keep the Timer and Arp value a multipal of 100 nS.
Any ideas as to what's wrong.
Looking to digitize a 1 kHz (1 Vpp) sine wave via the HP3458A, and transfer the sampled data to the host pc.
I've downloaded the example program, 4100 point program, in c#. I can get the program to function, create samples and return data.
It uses the DCV digitizing mode.
Now, i'd like to optimize the settings so it's specific to a 1kHz sinewave.
Example test program code:
cmds = "PRESET DIG;"; // Preset to the designated state (Digitizing)
cmds += "MFORMAT DINT;"; // Set the memory storage format (double integer)
cmds += "OFORMAT ASCII;"; // Set the output format (ASCII)
cmds += "MEM FIFO;"; // Clear memory and set memory storage type
cmds += "APER 2E-6;"; // Set the arperature time (
cmds += "TRIG AUTO;"; // Set the trigger source (Auto)
cmds += "NRDGS 4100,AUTO;"; // Set the number of readings (4100 readings)
cmds += "END ON;"; // Enable EOI function
cmds += "TARM HOLD"; // Hold the trigger until triggered
SendCmd("TARM SGL");
My Program, trying to digitize a 1kHz sine:
cmds = "PRESET DIG;";
cmds += "MFORMAT DINT;";
cmds += "OFORMAT ASCII;";
cmds += "MEM FIFO;";
cmds += "APER 0.0000122;";
cmds += "TIMER 0.0000122;";
cmds += "NRDGS 2048,TIMER;";
cmds += "END ON;";
cmds += "TARM HOLD";
SendCmd("TARM SGL");
My program errors duing the TARM SGL. 2048 (0 to 2047) samples are returned, however the last two samples are out of wack.
When I complete an FFT, the fundamental is at bin 51.
With the above setting, i expect this to be 1kHz and a fundamental at bin# 25.
Attached is my sampled data.
I believe my setting should represent this digitizing sample set:
F0 = 1000.576 Hz
M = 25 Cycles
N = 2048 Smpls
Fs = 81967.21311 Hz
Fres = 40.023 Hz
I chose just off 1kHz to keep the Timer and Arp value a multipal of 100 nS.
Any ideas as to what's wrong.
Attachments
I didn’t do an FFT, but I input a 2 Vpp 1 kHz sine wave with a -1 V offset and the data looks good.
My Program, trying to digitize a 1kHz sine:
cmds = "PRESET DIG;";
cmds += "MFORMAT DINT;";
cmds += "OFORMAT ASCII;";
cmds += "MEM FIFO;";
cmds += "APER 0.0000122;";
“TRIG AUTO”
“TIMER 0.00003”
cmds += "NRDGS 2048,TIMER;";
cmds += "END ON;";
cmds += "TARM HOLD";
SendCmd("TARM SGL");
Ok, your two updates fix's the error's I was getting.
But I am now struggling with the association of the Aperture time, Number of Samples and TIMER time.
My understanding:
Aperture time = 1/Sample Rate = 0.0000122 Seconds
Fs = SamplingRate = 1/TIMER = 81967.2131147539 Hz
N = Number Of Samples = 2048
Aperture and TIMER time can only be changed in 100 nS increments, hece the slightly off 1kHz tone.
With a SamplingRate of Above and Input tone of Fo = 1000.576 Hz, (Fs / N = Fo / M) i would expect M = 25 cycles. Data captured has many more cycles than that.
Knowing that, post FFT, i would expect the fundamental to be in bin# 25 as the Fres would be 40.023 Hz.
Can you help me equate aperture time, TIMER time and number of samples to fit the Coherent sampling equation (Fs / N = Fo / M). I know I will not be coherent as the 3458 is not
synchronized to my source, but the smeared fundamental should be spread around the correct bin. A window will later help me out there.
Appreciate your time! Attached new sine data.
Attachments
FYI
If you need to go faster than 50KHz you must use MFORMAT SINT and OFORMAT SINT