4-38
Example Program
SR844 RF Lock-In Amplifier
// *******************************************************************
// ***** Acquire data, then transfer data *****
printf("AcquireData.");
test = 0;
// Keep track of errors in variable test
TxSr844 ("REST");
// Reset buffers
TxSr844 ("STRT");
// Start data storage
j = 0;
do {
GetSr844 ("SPTS?");
i = atoi(recv);
// Read how many points taken so far?
if (i/64 > j) {printf ("."); j++;}
// Show progress every 64 points
}
while (i<640);
// Until 640 points taken (10 seconds)
TxSr844 ("PAUS");
// Pause acquisition
GetSr844("SPTS?");
// How many points in buffer?
nPts = atoi(recv);
printf ("SPTS=%d.",nPts);
// ***** Read all points in IEEE float format *****
printf("IEEE.");
sprintf(cmd,"TRCB?1,0,%d",nPts); // (CH1, start at bin 0, all points)
TxGpib (sr844,cmd);
// Send cmd and don't wait for IFC ready!
transmit ("MLA TALK 8", &status);
// Make sr844 the talker
rarray ((char *)rfBuf, nPts*4, &nCount, &status);
// Read directly into a FLOAT array rfBuf, 4 bytes per point
if ( nCount != nPts*4 ) {
printf ("\nERROR: expected %d bytes, received %d bytes",nPts*4,nCount);
test=1; GetSpace ();
}
else printf ("1.",nCount);
// CH1 ok
sprintf(cmd,"TRCB?2,0,%d",nPts); // (CH2, start at bin 0, all points)
TxGpib (sr844,cmd);
// Send cmd and don't wait for IFC ready!
transmit ("MLA TALK 8", &status);
// Make sr844 the talker
rarray ((char *)pfBuf, nPts*4, &nCount, &status);
// Read directly into a FLOAT array pfBuf, 4 bytes per point
if ( nCount != nPts*4 ) {
printf ("\nERROR: expected %d bytes, received %d bytes",nPts*4,nCount);
test=1; GetSpace ();
}
else printf ("2.",nCount);
// CH2 ok
// ****** Read all points in LIA float format ******
printf("LiaFlt.");
sprintf(cmd,"TRCL?1,0,%d",nPts); // (CH1, starting with bin 0, all points)
TxGpib (sr844,cmd);
// Send cmd and don't wait for IFC ready!
transmit ("MLA TALK 8", &status);
// Make sr844 the talker
rarray ((char *)rLiaBuf, nPts*4, &nCount, &status);
// Read into int array rLiaBuf, 2 ints or 4 bytes per point
if ( nCount != nPts*4 ) {
printf ("\nERROR: expected %d bytes, received %d bytes",nPts*4,nCount);
test=1; GetSpace ();
}
else printf ("1.",nCount);
// CH1 ok
sprintf(cmd,"TRCL?2,0,%d",nPts); // (CH2, starting with bin 0, all points)
TxGpib (sr844,cmd);
// Send cmd and don't wait for IFC ready!
transmit ("MLA TALK 8", &status);
// Make sr844 the talker
rarray ((char *)pLiaBuf, nPts*4, &nCount, &status);
// Read into int array pLiaBuf, 2 ints or 4 bytes per point
if ( nCount != nPts*4 ) {
printf ("\nERROR: expected %d bytes, received %d bytes",nPts*4,nCount);
Содержание SR844
Страница 10: ...viii SR844 RF Lock In Amplifier...
Страница 12: ...1 2 Getting Started SR844 RF Lock In Amplifier...
Страница 32: ...2 2 SR844 Basics SR844 RF Lock In Amplifier...
Страница 60: ...3 2 Operation SR844 RF Lock In Amplifier...
Страница 102: ...3 44 Shift Functions SR844 RF Lock In Amplifier...
Страница 108: ...4 6 Index of Commands SR844 RF Lock In Amplifier...
Страница 144: ...4 42 Example Program SR844 RF Lock In Amplifier...
Страница 146: ...5 2 Performance Tests SR844 RF Lock In Amplifier...
Страница 150: ...5 6 Performance Tests SR844 RF Lock In Amplifier...
Страница 156: ...5 12 Performance Tests SR844 RF Lock In Amplifier...
Страница 158: ...5 14 Performance Tests SR844 RF Lock In Amplifier...
Страница 162: ...5 18 Performance Tests SR844 RF Lock In Amplifier...
Страница 166: ...5 22 SR844 Test Record SR844 RF Lock In Amplifier...
Страница 168: ...6 2 Circuitry Parts Lists and Schematics SR844 RF Lock In Amplifier...
Страница 246: ...Parts Lists SR844 RF Lock In Amplifier 6 80 Schematic Diagrams...