DSP TP104-plus Dokumentacja Strona 112

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 178
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 111
5-28
Remote Programming
void printOutIEEEResults(void)
{
/* prints the first 10 values of R transferred in IEEE floating point format by the SR830 */
int i;
printf("\n\n");
for (i=0;i<10;i++)
printf("%d %e\n",i,rfBuf[i]); /* this is simple since the values are already IEEE floats */
}
void printOutLIAResults(void)
{
/* calculates the first 10 values of R transferred in LIA float format by the SR830 */
int i,mant,exp;
int *ptr;
float val;
printf("\n\n");
ptr =(int *) rfBuf; /* ptr points to integers in rfBuf, not floats! */
for (i=0;i<10;i++) {
mant = *ptr++; /* first comes the mantissa (16 bits) */
exp = *ptr++ - 124; /* then the binary exponent (16 bits) offset by 124 */
val = (float) mant * (float) pow(2.0,(double) exp);
printf("%d %e\n",i,val);
}
}
void initGpib(char *devName)
{
if ((lia=ibfind(devName))<0) {
printf("\nCannot Find SR830 \n\a");
exit(1);
}
}
void txLia(char *str)
{
char serPol;
ibwrt(lia,str,strlen(str));
do {
ibrsp(lia,&serPol); /* now poll for IFC RDY */
} while ((serPol&2)==0); /* until the command finishes executing */
}
void setupLia(void)
{
txLia("*RST"); /* initialize the lock-in */
Przeglądanie stron 111
1 2 ... 107 108 109 110 111 112 113 114 115 116 117 ... 177 178

Komentarze do niniejszej Instrukcji

Brak uwag