Frequency issue | LabJack
 

Frequency issue

2 posts / 0 new
Last post
Rajaox
rajaox's picture
Frequency issue

Hi!

I'm working on T7-PRO and Im generating a sine wave on DAC0 and a square wave on FIO3. The square wave is configured to be high on the peaks of the sine wave.

My problem is, when I use an oscillosope to see the two signals, in the begining the square wave turn to high exactly where i want (in the peaks of the sine wave), but from a certain moment there is a phase shift between the peaks of the sine wave and the high of the square wave. Maybe because the change of the frequency.

please, there is a solution to keep the two signals synchronized throught out the test?

I join my lua script.

Thanks,

File Attachment: 
LabJack Support
labjack support's picture
Unfortunately, we do not have

Unfortunately, we do not have many useful resources for you. We do not have any dedicated functionality for synchronization like this, and as a result you are going to run up against the limitations of Lua scripting with our devices. You are always going to have a limit either with the timing resolution or the resolution of your waveform update (rad/step). The interval timers have an inherent jitter of around +-30us and the minimum valid time interval is 10us. It generally takes between 10us and 20us to update the DAC or DIO. You also need to ensure you can run your control loop faster than your interval updates so that you update at the correct time.

Stream out would allow you to output faster waveforms, but there would still always be some offset between the sine wave peaks and square wave. To perform stream out, I would not recommend using embedded lua scripting and instead recommend a host application in a language like Python with our beta LJM installer and our periodicStreamOut functionality:

https://labjack.com/support/datasheets/t-series/communication/stream-mod...

https://labjack.com/support/software/examples/ljm

https://labjack.com/support/software/installers/ljm