Test and Measurement Forum

pico4262 trigger

Post general discussions on using our drivers to write your own software here

pico4262 trigger

Postby Pras » Wed Mar 14, 2012 9:57 am

I am trying to automate acquisition using Excel on pico4262 scope.While the acquisition is going through OK, I have problems in setting the trigger conditions. I need to set "Simple Edge, falling and 2V" setting for the External trigger input being fed from a FuncGen sync output. Request help to set up the proper code in Excel vb for this.

Thanks in advance
Pras
Pras
Newbie
 
Posts: 0
Joined: Wed Feb 29, 2012 6:54 am

Re: pico4262 trigger

Postby Martyn » Thu Mar 22, 2012 9:58 am

One of our team is currently looking at the VBA code to set the simple trigger and will post a reply soon.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2350
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: pico4262 trigger

Postby Hitesh » Thu Mar 22, 2012 2:37 pm

Hi,

The simplest way to do this is to use the call to ps4000SetSimpleTrigger() function, but the 'direction' parameter must be defined as a Long as it is an enumeration.

With the example code this means adding the following code:

Function declaration:

Code: Select all
Declare Function ps4000SetSimpleTrigger Lib "ps4000.dll" (ByVal handle As Integer, ByVal enable As Integer, ByVal source As Integer, ByVal threshold As Integer, ByVal direction As Long, ByVal delay As Long, ByVal autoTrigger_ms As Integer) As Integer


Note that direction is defined as a 'Long' value as it corresponds to an enum (source can be integer or long)

The trigger voltage must be scaled to an ADC count value using the input range for the External input (+/- 500mV or +/-5V):

Code: Select all
Dim threshold As Integer
Dim ps4000_Ext_Max_Value As Integer
ps4000_Ext_Max_Value = 32767
threshold = (2000 / 5000) * ps4000_Ext_Max_Value


Call the trigger function:

Code: Select all
Dim channel_ext As Integer
Dim direction As Long

channel_ext = 4 'EXT
direction = 3 ' Falling

status = ps4000SetSimpleTrigger(handle, 1, 4, threshold, direction, 0, 20000)


Please refer to the programmer's guide for further information on the functions and the enumerations.

I have also tested this using a Visual basic script and the C console application from the SDK. The MS Excel file is attached below:

ps4000_ext_trigger_example.xls
External Trigger example.
(676.5 KiB) Downloaded 168 times


When troubleshooting the code it is worth examining the status value returned from the function call - it will need to be converted to a hexadecimal value (use the Windows calculator for this). Use the guide to help determine the nature of the error using this value.

I hope this helps.
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: pico4262 trigger

Postby Pras » Mon Mar 26, 2012 5:09 am

Dear Mr. Hitesh,

Thank you very much for the effort to solve our problem and the attached xls file. We will try this out and get back to you.


Prasad
Pras
Newbie
 
Posts: 0
Joined: Wed Feb 29, 2012 6:54 am


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests