11-15-2006 03:34 AM
Hi ALL.
I'm trying to provide the possibility of clock source choice for a user. According the reference help the attribute which is responsible for this operation is NISCOPE_ATTR_INPUT_CLOCK_SOURCE with the list of valid values:
NISCOPE_VAL_NO_SOURCE ("VAL_NO_SOURCE")
NISCOPE_VAL_RTSI_CLOCK ("VAL_RTSI_CLOCK")
NISCOPE_VAL_PFI_1 ("VAL_PFI_1")
NISCOPE_VAL_PFI_2 ("VAL_PFI_2")
NISCOPE_VAL_PXI_CLOCK ("VAL_PXI_CLOCK")
NISCOPE_VAL_EXTERNAL ("VAL_EXTERNAL")
NISCOPE_VAL_CLK_IN ("VAL_CLK_IN")
What value should I set to make the scope use the internal and external clock?
I guess NISCOPE_VAL_NO_SOURCE and NISCOPE_VAL_EXTERNAL correspondingly, but I’m not sure.
Could anybody confirm or refute the supposition?
11-15-2006 10:03 AM
Hello Babay,
This function sets the source for the reference clock that your device will Phase Lock (PLL) to. "VAL_NO_SOURCE" means that the device will not PLL, and "VAL_EXTERNAL" is actually the same as "VAL_CLK_IN". This is to maintain compatibility with the older versions of NI-SCOPE. You can also accept an external reference clock from the PFI lines, the RTSI Clock, or the PXI Clock depending on the device.
If you want to provide an external Sample Clock, you would use the NISCOPE_ATTR_SAMP_CLK_TIMEBASE_SRC attribute.
Let me know if you have any further questions.
Regards,
Sean Close
PSE, High Speed Digitizers
11-15-2006 11:34 AM
11-17-2006 07:12 AM
Hi Sean C. ,
I have another question concerning external clock. If I set the NISCOPE_ATTR_SAMP_CLK_TIMEBASE_RATE to, lets say 100000000, do I need to set this value to NISCOPE_ATTR_HORZ_SAMPLE_RATE as well (in case if I want the scope to acquire the date with 100000000 samp/sec speed)?
11-17-2006 07:26 AM - edited 11-17-2006 07:26 AM
And in addition. NISCOPE_ATTR_SAMP_CLK_TIMEBASE_SRC has:
NISCOPE_VAL_CLK_IN
NISCOPE_VAL_NO_SOURCE
NISCOPE_VAL_PXI_STAR
So NISCOPE_VAL_CLK_IN - External
NISCOPE_VAL_NO_SOURCE - Internal.
Am I right?
I strange but when I set mentioned attribute to NISCOPE_VAL_CLK_IN it returns me an error...
Message Edited by BABAY on 11-17-2006 07:30 AM
11-17-2006 09:42 AM - edited 11-17-2006 09:42 AM
Message Edited by Sean C. on 11-17-2006 09:44 AM
11-20-2006 05:15 AM
Hi Sean C. , thank youu for you help.
I've found out the interesting thing. When I try to read the current clock source through the command:
char chClock[13];
ViStatus rc = niScope_GetAttributeViString (this->sessionId, VI_NULL, NISCOPE_ATTR_SAMP_CLK_TIMEBASE_SRC, sizeof(chClock), chClock);
it returns me a warning (rc = 14). This is becouse of chClock is too small, we need at least size of 14 (this is the problem witch I told you before). Afterwards I'm trying to extract the warning like this:
char acqMsg[512];
niScope_GetError(sessionId, &rc, sizeof(acqMsg), acqMsg);
and it returns the empty acqMsg buffer + rc = 0.
Does it mean that the function niScope_GetError works with errors only???
Regards, Valery.
11-20-2006 02:15 PM
You must provide a ViChar array to serve as a buffer for the value. You pass the number of bytes in the buffer as the bufSize. If the current value of the attribute, including the terminating NUL byte, is larger than the size you indicate in the bufSize, the function copies (bufSize – 1) bytes into the buffer, places an ASCII NUL byte at the end of the buffer, and returns the bufSize you must pass to get the entire value. For example, if the value is 123456 and the bufSize is 4, the function places 123 into the buffer and returns 7. If you want to call this function just to get the required buffer size, you can pass 0 for the bufSize and VI_NULL for the value. If you want the function to fill in the buffer regardless of the number of bytes in the value, pass a negative number for the bufSize.
The defined behavior occurred without error or warning. That is why there is no elaboration.
Regards,
Sean Close
11-21-2006 12:53 AM
11-21-2006 02:32 AM - edited 11-21-2006 02:32 AM
Message Edited by BABAY on 11-21-2006 02:33 AM