LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

programming time/div knob of the oscilloscope

Is a formula needed to programme the time/div knob?
How to link it to the timer?
0 Kudos
Message 1 of 3
(2,993 Views)
The way to set the time/division depends on which scope you have. You need to get the scope's Programming Manual. They're usually available on the manufacturer's website. If you have a Teltronix scope, use their Manual Finder at http://www.tek.com/site/mn/mnfinder_search
Enter the model number and set the Type to Programmer.
On the CVI side, you need a callback for your time/div knob. On EVENT_COMMIT, send the appropriate command to the scope. For example, if you're using a Tek TDS7000 series scope with a GPIB interface, use something like the following.

int CVICALLBACK SetTimePerDiv (int panel, int control, int event, void *callbackData,
int eventData1, int eventData2)
{
static char write_buffer[100];
switch (event)
{
case EVENT_CO
MMIT:
GetCtrlVal (pnl_handle, PNL_TIMEDIV, write_buffer);
ibwrt (device, write_buffer, strlen(write_buffer));
break;
}
return 0;
}

Your code must previously set pnl_handle with LoadPanel() and device with ibdev().
For more details on GPIB, see the gpibrw project (...\CVI\samples\gpib\gpib.prj) that ships with CVI.
I don't think you want to link the time/div knob to a timer: just use a callback to let you know when the control has been operated.
To create a callback, from the UI editor, double-click on the control (to edit the control). Enter a function name in the box labeled Callback Function, then click OK. Then, right-click on the control in the UI editor and select Generate Control Callback. Then right-click again and select View Control Callback.
0 Kudos
Message 2 of 3
(2,993 Views)
Sorry: a couple of corrections in the callback function: I forgot to build the horizontal scale command.

int CVICALLBACK SetTimePerDiv (int panel, int control, int event, void *callbackData,
int eventData1, int eventData2)
{
static char write_buffer[100];
double timePerDiv;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (pnl_handle, PNL_TIMEDIV, &timePerDiv);
sprintf(write_buffer, "HOR:SCA %f", timePerDiv);
ibwrt (device, write_buffer, strlen(write_buffer));
break;
}
return 0;
}
0 Kudos
Message 3 of 3
(2,993 Views)