Set range channel for probes ps4000aSetChannel()

Post your C and C++ discussions here
Post Reply
zipcode
Newbie
Posts: 0
Joined: Wed Dec 05, 2018 8:54 am

Set range channel for probes ps4000aSetChannel()

Post by zipcode » Wed Feb 13, 2019 2:29 am

I have a picoscope 4444 connected with a TA300 current probe and an 442 differential probe ,to be able to make current and voltage measurements.
On the programmers-guide PDF it is specified that the range is defined in the header file :

Code: Select all

PICO_STATUS ps4000aSetChannel
(
	int16_t handle, PS4000A_CHANNEL channel,
	 int16_t enabled, PS4000A_COUPLING type, 
	 PICO_CONNECT_PROBE_RANGE range,
	 float analogOffset
)
page74____________________________________________________________ 
range, specifies the measuring range. The original set of values defined in
ps4000aApi.h is shown in the table below. The PicoScope 4444 supports all
of these ranges plus an additional set defined in PicoConnectProbes.h
Now if I specify the channel range as PICO_1KV_500V or PICO_CURRENT_CLAMP_40A_1A I will get an error PICO_INVALID_VOLTAGE_RANGE. I can only use the value ranges between PS4000A_10MV and PS4000A_50V, which are established inside ps4000aApi.h.
My question is: how can I indicat the ranges that are 500V and 1A , which are inside PicoConnectProbes.h.

I really appreciate any help.

zipcode
Newbie
Posts: 0
Joined: Wed Dec 05, 2018 8:54 am

Re: Set range channel for probes ps4000aSetChannel()

Post by zipcode » Wed Feb 13, 2019 5:21 pm

I did not find a solution, ps4000aSetChannel() does not accept values like PICO_1KV_500V or 6010.
I kind of hardcoded the range so when I make a plot from the csv values the signal has the same shape as the one from the software.
For example to use the 500V for the 442 differential probe i set the range to PS4000A_20V and for the TA300 current probe i set the range to PS4000A_200MV
The problem is now to find a way to convert from adc to V and A.

Any help would be appreciated.

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

Re: Set range channel for probes ps4000aSetChannel()

Post by Martyn » Wed Feb 13, 2019 6:25 pm

Have you used ps4000aSetProbeInteractionCallback as this will setthe driver up to allow you to use the correct ranges for the probe that it detects. Otherwise it will only allow standard ranges as you have found.
Martyn
Technical Support Manager

zipcode
Newbie
Posts: 0
Joined: Wed Dec 05, 2018 8:54 am

Re: Set range channel for probes ps4000aSetChannel()

Post by zipcode » Wed Feb 13, 2019 8:36 pm

Yes, the ps4000aSetProbeInteractionCallback function populates the values of userProbeInfo.userProbeInteractions. I can get access to them and obtain for example rangeFirst_ which in this case returns 6003 but can not be established as a value range inside ps4000aSetChannel.
Also when the call to ps4000aSetProbeInteractionCallback is made, ps4000aSetCannel returns twice this status:

SetDefaults:ps4000aSetChannel------ 0x00000157
// the channel range limits have changed due to connecting or disconnecting a probe
// the channel has been enabled
which means PICO_WARNING_PROBE_CHANNEL_OUT_OF_SYNC
If I don't use ps4000aSetProbeInteractionCallback than ps4000aSetChannel returns no message.

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

Re: Set range channel for probes ps4000aSetChannel()

Post by Martyn » Wed Feb 13, 2019 9:33 pm

Have you tried the example code from GitHub?
Martyn
Technical Support Manager

zipcode
Newbie
Posts: 0
Joined: Wed Dec 05, 2018 8:54 am

Re: Set range channel for probes ps4000aSetChannel()

Post by zipcode » Wed Feb 13, 2019 10:33 pm

Yes and it dones't work.

zipcode
Newbie
Posts: 0
Joined: Wed Dec 05, 2018 8:54 am

Re: Set range channel for probes ps4000aSetChannel()

Post by zipcode » Wed Feb 13, 2019 11:52 pm

I found out how it has to be used. So now basicaly i do not have to use all the settings that have to deal with ranges.

Code: Select all

for(i=0;ihandle,
			userProbeInfo.userProbeInteractions[i].channel,
			userProbeInfo.userProbeInteractions[i].connected,
			userProbeInfo.userProbeInteractions[i].couplingCurrent_,
			userProbeInfo.userProbeInteractions[i].rangeCurrent_,
			0.0f
			);
									
			userProbeInfo.userProbeInteractions[i].status_=status;
		}
	}
The first problem is that I was just setting the range but with the old example of ps4000aSetChannel() and the second problem was that the userProbeInfo.userProbeInteractions.enabled by default is set to "FLASE" and channel was never activated so i used userProbeInfo.userProbeInteractions.connected

Code: Select all

		status = ps4000aSetChannel(
		unit->handle, (PS4000A_CHANNEL)(PS4000A_CHANNEL_A + i),
		unit->channelSettings[PS4000A_CHANNEL_A + i].enabled,
	       (PS4000A_COUPLING)unit->channelSettings[PS4000A_CHANNEL_A + i].DCcoupled,
	       userProbeInfo.userProbeInteractions[i].rangeCurrent_,
	       unit->channelSettings[PS4000A_CHANNEL_A + i].analogueOffset);
I think that the online example needs a updated becuase the probes are not taken into consideration.
Thank you Martyn and hope it helps to improve the code on github.

Post Reply