Data Reading Errors Encountered During Software Development Using Visual Studio

Post your .Net discussions here
Post Reply
Zihan Xu
Newbie
Posts: 0
Joined: Mon Feb 19, 2024 10:32 am

Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Zihan Xu »

First of all, thank you for your suggestions to solve the problem.
I use PicoScope 2408B block mode to develop waveform reading interface. When I use a signal generator to generate a 5V sine wave, I actually get a sine wave with a amplitude of 500mV. I compared my code with officially released block mode code but I can't find the actual error.
I found during debugging that after I run the 'GetValue()' statement, the maximum amount of data stored in the A-Channel buffer I set up is about 4000, Which means after 'adc to mv', the voltage I get is about 500mV, but my actual peak voltage was around 2.5V.
The attenuation factor of the oscilloscope probe is 1. The coupling mode is DC coupling, the voltage range is also set to 5V. I wonder what the problem is, I can provide all the code if it necessary, thanks for answering it for me.
Attachments
adc to mV
adc to mV
Waveform I actually get (The unit is mV)
Waveform I actually get (The unit is mV)
GetValues code
GetValues code
5V sine wave
5V sine wave
Set DataBuffers
Set DataBuffers

Martyn
Site Admin
Site Admin
Posts: 4499
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Martyn »

The Pk to Pk voltage looks like 1.25V which is half of the signal generator voltage.

The generator is probably specified to output the 5V into an open circuit, but as you are connecting to a 1MOhm input impedance scope and you have the generator set to high impedance, you have a 1MOhm + 1MOhm voltage divider. What you are reading is therefore correct.
Martyn
Technical Support Manager

Zihan Xu
Newbie
Posts: 0
Joined: Mon Feb 19, 2024 10:32 am

Re: Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Zihan Xu »

Mr. Martyn thank you very much for your reply.
I think it's a reasonable excuse for this situation. But I connected the signal generator directly to the PicoScope, I ran both the block mode routine and the program I wrote myself, and got different results.
The block mode routine can get a result of -2.5V but my program can only get about 600 to 750mV, and most of my programs are written to routines, so I thought maybe I was wrong in some details.
Here are the results of the block mode routine under the same conditions.
Attachments
34dffb9bf45c855026a3466fd798ab9.png
53b33c6f88f18309b10690dfe4d3dbb.png

Martyn
Site Admin
Site Admin
Posts: 4499
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Martyn »

Please post your code and use the code button ( < / > ) to help format it, or add it as a file.
Martyn
Technical Support Manager

Zihan Xu
Newbie
Posts: 0
Joined: Mon Feb 19, 2024 10:32 am

Re: Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Zihan Xu »

Sorry for not replying to your message in time due to netlag, thank you for your reply.
The program is still debugging. Here are my code and some instructions.
Initial parameter:
timebase = 27;
sample count = 100000;
sampling rate = 5MS/s
The sampling rate can't adjust yet, Because I'm still learning how to use multithreading, .
Attachments
PS2000ABlockMode.zip
routine
(424.32 KiB) Downloaded 69 times
HouCC.zip
(2.83 MiB) Downloaded 78 times
instruction1
instruction1
instruction2
instruction2

Zihan Xu
Newbie
Posts: 0
Joined: Mon Feb 19, 2024 10:32 am

Re: Data Reading Errors Encountered During Software Development Using Visual Studio

Post by Zihan Xu »

I think I know what the problem is. I put the channel Settings and time base Settings in the program initialization, but I didn't run openscope until then. The start button (after opening the scope) didn't contain channel settings because I intialized it. Thank you for answering my questions! :lol:

Post Reply