Changeset 5248
- Timestamp:
- 10/06/07 12:42:31 (6 years ago)
- Location:
- experimental/components/DigitalModem/trunk/DigitalModem
- Files:
-
- 3 modified
-
atsrc/DigitalDemodulator_testsuite.h (modified) (2 diffs)
-
atsrc/DigitalModulator_testsuite.h (modified) (1 diff)
-
src/DigitalModem.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalDemodulator_testsuite.h
r4744 r5248 143 143 144 144 void test_DemodulateQPSK() { 145 short I[4] = {10, 10, -10, -10};146 short Q[4] = { 10, -10, 10, -10};145 short I[4] = {10, 0, 0, -10}; 146 short Q[4] = { 0, -10, 10, 0}; 147 147 char * bits_out = new char[8]; 148 148 … … 162 162 } 163 163 164 void test_DemodulateQAM4() { 165 short I[4] = {10, 10, -10, -10}; 166 short Q[4] = {10, -10, 10, -10}; 167 char * bits_out = new char[8]; 168 169 SetModulationScheme( SigProc::QAM4 ); 170 DemodulateSequence(I, Q, 4, bits_out); 171 172 TS_ASSERT_EQUALS( bits_out[0], BIT0 ); 173 TS_ASSERT_EQUALS( bits_out[1], BIT0 ); 174 TS_ASSERT_EQUALS( bits_out[2], BIT0 ); 175 TS_ASSERT_EQUALS( bits_out[3], BIT1 ); 176 TS_ASSERT_EQUALS( bits_out[4], BIT1 ); 177 TS_ASSERT_EQUALS( bits_out[5], BIT0 ); 178 TS_ASSERT_EQUALS( bits_out[6], BIT1 ); 179 TS_ASSERT_EQUALS( bits_out[7], BIT1 ); 180 181 delete [] bits_out; 182 } 183 184 164 185 void test_Demodulate8PSK() { 165 186 short I[8] = { 100, 71, 71, 0, -71, 0, -100, -71}; -
experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalModulator_testsuite.h
r4754 r5248 105 105 106 106 TS_ASSERT_EQUALS( I_out[0], QPSK_LEVEL ); 107 TS_ASSERT_EQUALS( Q_out[0], QPSK_LEVEL);108 109 TS_ASSERT_EQUALS( I_out[1], QPSK_LEVEL);107 TS_ASSERT_EQUALS( Q_out[0], 0 ); 108 109 TS_ASSERT_EQUALS( I_out[1], 0 ); 110 110 TS_ASSERT_EQUALS( Q_out[1], -QPSK_LEVEL ); 111 111 112 TS_ASSERT_EQUALS( I_out[2], -QPSK_LEVEL);112 TS_ASSERT_EQUALS( I_out[2], 0 ); 113 113 TS_ASSERT_EQUALS( Q_out[2], QPSK_LEVEL ); 114 114 115 115 TS_ASSERT_EQUALS( I_out[3], -QPSK_LEVEL ); 116 TS_ASSERT_EQUALS( Q_out[3], -QPSK_LEVEL ); 116 TS_ASSERT_EQUALS( Q_out[3], 0 ); 117 118 delete [] I_out; 119 delete [] Q_out; 120 121 } 122 123 void test_ModulateQAM4() { 124 char b[8] = {BIT0, BIT0, 125 BIT0, BIT1, 126 BIT1, BIT0, 127 BIT1, BIT1}; 128 129 short * I_out = new short[4]; 130 short * Q_out = new short[4]; 131 132 SetModulationScheme( SigProc::QAM4 ); 133 ModulateSequence( b, 8, I_out, Q_out ); 134 135 TS_ASSERT_EQUALS( I_out[0], QAM4_LEVEL ); 136 TS_ASSERT_EQUALS( Q_out[0], QAM4_LEVEL ); 137 138 TS_ASSERT_EQUALS( I_out[1], QAM4_LEVEL ); 139 TS_ASSERT_EQUALS( Q_out[1], -QAM4_LEVEL ); 140 141 TS_ASSERT_EQUALS( I_out[2], -QAM4_LEVEL ); 142 TS_ASSERT_EQUALS( Q_out[2], QAM4_LEVEL ); 143 144 TS_ASSERT_EQUALS( I_out[3], -QAM4_LEVEL ); 145 TS_ASSERT_EQUALS( Q_out[3], -QAM4_LEVEL ); 117 146 118 147 delete [] I_out; -
experimental/components/DigitalModem/trunk/DigitalModem/src/DigitalModem.cpp
r4746 r5248 60 60 Modulate = &Modulate8PSK; 61 61 bitsPerSymbol = 3; 62 differentialMode = false; 63 break; 64 case QAM4: 65 Demodulate = &DemodulateQAM4; 66 Modulate = &ModulateQAM4; 67 bitsPerSymbol = 2; 62 68 differentialMode = false; 63 69 break;