FreeCalypso > hg > fc-rfcal-tools
comparison cmu200/signalgen.c @ 5:493987a4527e
fc-cmu200d: signal-gen-sine implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 21 May 2017 07:48:54 +0000 |
parents | 504d3cbb95b5 |
children | d8cbc7a383eb |
comparison
equal
deleted
inserted
replaced
4:504d3cbb95b5 | 5:493987a4527e |
---|---|
34 send_scpi_cmd(cmdstr); | 34 send_scpi_cmd(cmdstr); |
35 current_mode = OP_MODE_SIGNAL_GEN; | 35 current_mode = OP_MODE_SIGNAL_GEN; |
36 send_socket_response("+OK\n"); | 36 send_socket_response("+OK\n"); |
37 return(0); | 37 return(0); |
38 } | 38 } |
39 | |
40 cmd_signal_gen_sine() | |
41 { | |
42 unsigned arfcn, freq_khz; | |
43 int offset; | |
44 char cmdstr[128]; | |
45 | |
46 if (current_mode != OP_MODE_SIGNAL_GEN) { | |
47 send_socket_response("-Wrong mode\n"); | |
48 return(0); | |
49 } | |
50 if (client_cmd_nfields != 4) { | |
51 send_socket_response("-Wrong number of arguments\n"); | |
52 return(0); | |
53 } | |
54 arfcn = atoi(client_cmd_fields[1]); | |
55 if (verify_arfcn(arfcn, 0, &freq_khz) < 0) { | |
56 send_socket_response("-Invalid ARFCN\n"); | |
57 return(0); | |
58 } | |
59 offset = atoi(client_cmd_fields[2]); | |
60 freq_khz += offset; | |
61 sprintf(cmdstr, "SOUR:RFG:LEV %s\n", client_cmd_fields[3]); | |
62 send_scpi_cmd(cmdstr); | |
63 sprintf(cmdstr, "SOUR:RFG:FREQ %u000\n", freq_khz); | |
64 send_scpi_cmd(cmdstr); | |
65 send_scpi_cmd("INIT:RFG\n"); | |
66 send_scpi_cmd("*OPC?\n"); | |
67 collect_staropc_response(); | |
68 send_socket_response("+OK\n"); | |
69 return(0); | |
70 } |