| 85 | ---- |
| 86 | '''Writing Samples''': WARPLab 7 enables setting the same RF and baseband parameters as previous versions. However the syntax for sending commands to nodes has changed. The new syntax allows the same command to be sent to multiple nodes in one line. Each node can be assigned the same parameter value, or multiple values (one per node) can be passed as an array argument. The example below shows equivalent code for setting a few parameters for two nodes. |
| 87 | |
| 88 | {{{#!html |
| 89 | <table border=1 width=600><tr valign=top><td width=50% align=left> |
| 90 | }}} |
| 91 | |
| 92 | {{{ |
| 93 | %WARPLab 6 |
| 94 | |
| 95 | %Time vector (assumes 40MHz sampling rate) |
| 96 | t = (1/40e6) .* [0 : 2^14-1]; |
| 97 | |
| 98 | %Generate a 1MHz sinusoid |
| 99 | txSigA = exp(1i*2*pi*t*1e6); |
| 100 | |
| 101 | %Generate a 2MHz sinusoid |
| 102 | txSigB = exp(1i*2*pi*t*2e6); |
| 103 | |
| 104 | %Write the two signals to RF A and B on both nodes |
| 105 | warplab_writeSMWO(udp_node1, RADIO2_TXDATA, txSigA); |
| 106 | warplab_writeSMWO(udp_node1, RADIO3_TXDATA, txSigB); |
| 107 | warplab_writeSMWO(udp_node2, RADIO2_TXDATA, txSigA); |
| 108 | warplab_writeSMWO(udp_node2, RADIO3_TXDATA, txSigB); |
| 109 | }}} |
| 110 | |
| 111 | {{{#!html |
| 112 | </td><td width=50% align=left> |
| 113 | }}} |
| 114 | |
| 115 | {{{ |
| 116 | %WARPLab 7 |
| 117 | |
| 118 | %Time vector (assumes 40MHz sampling rate) |
| 119 | t = (1/40e6) .* [0 : 2^14-1]; |
| 120 | |
| 121 | %Generate a 1MHz sinusoid |
| 122 | txSigA = exp(1i*2*pi*t*1e6); |
| 123 | |
| 124 | %Generate a 2MHz sinusoid |
| 125 | txSigB = exp(1i*2*pi*t*2e6); |
| 126 | |
| 127 | %Write the two signals to RF A and B on both nodes |
| 128 | % Use vector arguments for interface selection and per-interface signals |
| 129 | wl_basebandCmd(nodes, [RFA RFB], 'write_IQ', [txSigA txSigB]); |
| 130 | |
| 131 | }}} |
| 132 | |
| 133 | {{{#!html |
| 134 | </td></tr></table> |
| 135 | }}} |
| 136 | |
| 137 | |