Changeset 5248

Show
Ignore:
Timestamp:
10/06/07 12:42:31 (6 years ago)
Author:
jgaeddert
Message:

Updating DigitalModem components to work with SigProc? from r5246:5247

Location:
experimental/components/DigitalModem/trunk/DigitalModem
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalDemodulator_testsuite.h

    r4744 r5248  
    143143 
    144144    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}; 
    147147        char * bits_out = new char[8]; 
    148148 
     
    162162    } 
    163163 
     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     
    164185    void test_Demodulate8PSK() { 
    165186        short I[8] = { 100,  71,  71,    0, -71,   0, -100, -71}; 
  • experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalModulator_testsuite.h

    r4754 r5248  
    105105         
    106106        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          ); 
    110110        TS_ASSERT_EQUALS( Q_out[1], -QPSK_LEVEL ); 
    111111         
    112         TS_ASSERT_EQUALS( I_out[2], -QPSK_LEVEL ); 
     112        TS_ASSERT_EQUALS( I_out[2],  0          ); 
    113113        TS_ASSERT_EQUALS( Q_out[2],  QPSK_LEVEL ); 
    114114         
    115115        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 ); 
    117146         
    118147        delete [] I_out; 
  • experimental/components/DigitalModem/trunk/DigitalModem/src/DigitalModem.cpp

    r4746 r5248  
    6060        Modulate = &Modulate8PSK; 
    6161        bitsPerSymbol = 3; 
     62        differentialMode = false; 
     63        break; 
     64    case QAM4: 
     65        Demodulate = &DemodulateQAM4; 
     66        Modulate = &ModulateQAM4; 
     67        bitsPerSymbol = 2; 
    6268        differentialMode = false; 
    6369        break;