Test and Measurement Forum

importing arbitrary waveform for generation.

Post your VB and VBA discussions here

importing arbitrary waveform for generation.

Postby fabianmicallef » Fri Nov 15, 2013 10:49 am

I am trying to set up the AWG on my 2204 picoscope and I am using VBA for excel. How do I import the data of the arbitrary waveform, which is currently saved as a column in a CSV file, and how do I implement it in the function ps2000_set_sig_gen_arbitrary? Eseentially, what do I have to place in the argument arbitraryWaveform, which is of type Long. Thank you for your continued support.
fabianmicallef
Newbie
 
Posts: 0
Joined: Tue Nov 12, 2013 5:49 pm

Re: importing arbitrary waveform for generation.

Postby fabianmicallef » Fri Nov 15, 2013 4:00 pm

I am also trying to set up fast streaming of data. The streaming example in the SDK examples for excel is compatible streaming which on the attached pdf says that it cannot be used for my 2204 model. I have tried my best to modify the example for fast streaming but the computer freezes when I run it, I believe that the problem is that I am not using the pointers and indexes required correctly. I also have no idea in what variable are the readings going as none of the functions the pdf told me to define seem to have places for them, unlike the ones used in the example. Here is the code:

Code: Select all
Sub StreamingData2()
ReDim values_a(100) As Integer
ReDim values_b(100) As Integer
ReDim values_c(100) As Integer
ReDim values_d(100) As Integer
ReDim times(100) As Long
Dim no As Long
Dim overflow As Integer
Dim counter As Integer

ps2000_handle = ps2000_open_unit()
 
If ps2000_handle = 0 Then
   MsgBox "Unit not opened", vbOKOnly, "Error Message"
   Exit Sub
End If


Call ps2000_set_channel(ps2000_handle, 0, 1, 1, 10)

Cells(17, "E").Value = "channel A opened"

Call ps2000_set_channel(ps2000_handle, 1, 1, 0, 10)
 
Cells(17, "E").Value = "channel B opened"
 
'Trigger disabled
Call ps2000_set_trigger(ps2000_handle, 5, 0, 0, 0, 0)

'find the maximum number of samples, the time interval (in time_units),
'the most suitable time units, and the maximum oversample at the current timebase
timebase = 13
no_of_samples = 100

ok = ps2000_run_streaming_ns(ps2000_handle, 1, 13, 100, 1, 1, 15000)

counter = 0

'the values (in ADC counts)
no = 0
While no = 0
  no = ps2000_get_streaming_last_values(ps2000_handle, buffers)
Wend

buffers = my_get_overview_buffers(no, overflow, 0, 0, 100)

For i = 0 To (no - 1)
   Cells(counter + i + 4, "B").Value = values_a(i)
   Cells(counter + i + 4, "C").Value = (values_a(i) / 32767) * 20000
Next i
   
If counter > 1000 Then
  counter = 0
Else
  counter = counter + i
End If

End Sub
fabianmicallef
Newbie
 
Posts: 0
Joined: Tue Nov 12, 2013 5:49 pm

Re: importing arbitrary waveform for generation.

Postby Hitesh » Mon Nov 18, 2013 4:19 pm

Hi Fabian,

You arbitrary waveform needs to be a set of char values in the range 0 (min value) to 255 (max value). It should be possible to obtain the values from the csv file into a char array which you can pass to the function call.

Please refer to the recently updated PicoScope 2000 Series Programmer's Guide on our documents page for further information:

http://www.picotech.com/document/

With regards to Fast Streaming, release 10.5.0.28 for the SDK contains an example that shows how to collect Fast Streaming Data and retrieve data once the collection has stopped.

Best wishes,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: importing arbitrary waveform for generation.

Postby fabianmicallef » Mon Nov 18, 2013 5:07 pm

Thank you for your advice.
Could you please give me another link to the recent SDK zip file as the one on the software page is not functioning.
It is giving me the following error:
Code: Select all
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>20888FFCA726E8B2</RequestId>
<HostId>
H53oHka/9GkG+kTYT2LrEcRzS3fUNEZfEiG47MJLTKrPL8JmhsgWJosy9CgdXsZ4
</HostId>
</Error>
fabianmicallef
Newbie
 
Posts: 0
Joined: Tue Nov 12, 2013 5:49 pm

Re: importing arbitrary waveform for generation.

Postby Hitesh » Tue Nov 19, 2013 9:45 am

Hi Fabian,

We are aware of an issue with our download server which should be corrected soon. If you require this file immediately please email support@picotech.com for a link.

Thanks,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: importing arbitrary waveform for generation.

Postby fabianmicallef » Tue Nov 19, 2013 11:00 am

I have e-mailed,
Thank you for your support
fabianmicallef
Newbie
 
Posts: 0
Joined: Tue Nov 12, 2013 5:49 pm


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests