FreeCalypso > hg > fc-rfcal-tools
comparison cmu200/init.c @ 0:bd62be88259d
initial import of rfcal code and docs from freecalypso-tools repository
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 20 May 2017 18:49:35 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:bd62be88259d |
---|---|
1 /* | |
2 * This module contains the code that fc-cmu200d runs at startup, | |
3 * to put the CMU200 into a known state at the global level. | |
4 */ | |
5 | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <string.h> | |
9 #include <strings.h> | |
10 #include "secaddr.h" | |
11 | |
12 extern char instrument_response[]; | |
13 | |
14 static char id_string[] = "Rohde&Schwarz,CMU"; | |
15 | |
16 static void | |
17 assign_secondary_addr(addr, func) | |
18 char *func; | |
19 { | |
20 char cmdbuf[80]; | |
21 | |
22 sprintf(cmdbuf, "SYST:REM:ADDR:SEC %d,\"%s\"\n", addr, func); | |
23 send_scpi_cmd(cmdbuf); | |
24 } | |
25 | |
26 init_cmu200() | |
27 { | |
28 /* Test if we are connected to a CMU */ | |
29 send_scpi_cmd("*IDN?\n"); | |
30 collect_instr_response(); | |
31 if (strncasecmp(instrument_response, id_string, strlen(id_string))) { | |
32 fprintf(stderr, "error: not connected to a CMU200\n"); | |
33 exit(1); | |
34 } | |
35 /* init commands */ | |
36 send_scpi_cmd("*SEC 0\n"); | |
37 send_scpi_cmd("*RST;*OPC?\n"); | |
38 collect_staropc_response(); | |
39 send_scpi_cmd("SYST:NONV:DIS\n"); | |
40 assign_secondary_addr(SECADDR_RF_NSIG, "RF_NSig"); | |
41 assign_secondary_addr(SECADDR_GSM900MS_NSIG, "GSM900MS_NSig"); | |
42 assign_secondary_addr(SECADDR_GSM1800MS_NSIG, "GSM1800MS_NSig"); | |
43 assign_secondary_addr(SECADDR_GSM1900MS_NSIG, "GSM1900MS_NSig"); | |
44 assign_secondary_addr(SECADDR_GSM850MS_NSIG, "GSM850MS_NSig"); | |
45 send_scpi_cmd("*OPC?\n"); | |
46 collect_staropc_response(); | |
47 printf("CMU200 init complete\n"); | |
48 } |