Jump to content
  • 0

Trigger Source and BufferSize not compiling?


Ayyyyyyy

Question

I'm a coding newbie trying to to use Javascript to produce a pulse of arbitrary length and capture the whole pulse (and a little bit before and after) in one csv file. To do this, I need to make Scope1's recording buffer size longer, and set Scope 1 to be triggered by Wavegen1, but get the following errors with both the Wavegen and Scope Windows open:

 

Scope1.BufferSize.value = 1;

RESULT: TypeError: Result of expression 'Scope1.BufferSize' [undefined] is not an object.

 

Scope1.Source.text = "Wavegen 1"; //OR

Scope1.Source.text = "Wavegen1";

RESULT OF BOTH: TypeError: Result of expression 'Scope1.Source' [undefined] is not an object.

 

I'm guessing these functions are deprecated, since while they do appear in the help menu, they don't appear in the Ctrl+Space autofill menu. Does anyone know how to change the the individual buffer size for recording in javascipt, and set the source or Scope1, or is this something I have to go into the C++ SDK to do?

Reading other forums code, at least the BufferSize variable is claimed to work fine, in code like here:

Even with just copying Andras's code, I've run into the same compiler errors; I've reinstalled waveforms on at least two computers with separate Analog Discovery 2 devices and hit the same wall. Is there some declaration I must make beforehand before certain Scope1 members can be accessed?

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Hi @Ayyyyyyy

Beside Ctrl+Space, see the Help, see the tip in the status bar.

Probably you want to change the number of samples with: Scope.Time.Samples.value =
In the latest beta versions it is "Wavegen C1" in earlier "Wavegen 1": Scope.Trigger.Source.text = "Wavegen 1"
(But it is backward compatible so you can use "Wavegen 1/2" also in the latest beta.)

image.png.a66b726f7f49d007343c747186d08b81.png

image.png.22c824a7abd148c9c0d92af3c61ef456.png

image.png.ae7503a35f0f03afdf0be740bc372d27.png

Link to comment
Share on other sites

@attila,

Thank you so much for the help; really appreciate how quickly you answered. Couldn't respond until now, but Scope.Time.Samples.value was exactly what I needed!

I wasted too much time trying to do what I could have already saved in my workspace (If only I had read your response sooner), but for anyone who stumbles here looking for recording/capture code, here's some code I made to record an arbitrary pulse length for a heating/cooling machine. You'll have to modify the Wavegen1 parameters though, the control scheme for the machine was inverted (off->Heating, on->Off/Cooling; very dumb).

pulse example.js

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...