Jump to content

Agouti

Members
  • Posts

    2
  • Joined

  • Last visited

Agouti's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Hi @attila Sorry, looks like I didn't explain myself clearly - I want basically the reverse of that, the input is the variable frequency square wave in C1 and the output is the kHz as a channel. That's still a very interesting little function, and it was a good learning experience figuring it out (even though the shorthand JavaScript was pretty confusing at first). Edit: Worked something out, code is as follows, not pretty but I'm not really sure how to improve it as things like initializing the frequency on the first zero crossing would need some way of looking forward, which I don't think is possible in the Math framework. Obviously C1 needs to be AC coupled since it's only looking for zero crossings. Init: var prev = NaN; var lastCross=-1; var ret=0; Function: if(isNaN(prev)){ prev = C1; } if((prev<=0 && C1>0) || (prev>=0 && C1<0)) { ret = 0.5/(Time-lastCross) lastCross=Time; prev=C1; } return ret; This works, but I'd appreciate a more sophisticated way. For longer periods I've found I can record (aka stream to PC) then post-sample, is there a way to just set up hardware triggering and just capture the interval between triggers? Or some sort of hardware based frequency estimation? Also, can I apply smoothing to the Math channel output to have slope between the points instead of hard steps?
  2. Hi all, I'm hoping someone can help me define a custom channel in WaveForms, or point me to a better way to do it. I am familiar with adding virtual Math channels in desktop scopes, so that is my approach here. What I need to do is graph the frequency of a frequency-modulated square wave as a separate custom channel, so it can be displayed under a waveform capture. I assume this should be possible using the scripting under Measurements in WaveForms, but I'm having a little trouble wrapping my head around how it works and the best approach to take. I'd also like to be able to log the frequency under the Logging tab, too. If I was doing it through say Python in post processing, I would find all the zero crossings, measure the period between them, then graph the inverse as frequency, but this doesn't seem like the approach for ECMAScript? I'm doing this using the device Demo source in WaveForms, as I need to make sure what I want will work before I buy the hardware. Many thanks in advance!
×
×
  • Create New...