Previous Next        Current Page: NeXtMidas Training / Primitives / Lab 9 / Instructions
back
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   + Lab 2   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   + Primitive Restarts   
   + Introduction to DSP   
   - Lab 9   
      - Instructions   
      - Solution   
WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Lab 9:
    • For this lab you will create a primitive that will demodulate an FM signal. Don't worry, you do not need to know anything about FM to do this lab; the algorithm is already coded, you just need to handle the data input and output to the algorithm.
    • A template for this primitive is provided with the algorithm allready filled in.
    • Files (be sure to save these with the correct names):
    • Use UPDATE to add the primitive to the command dictionary. It takes in 2 parameters (IN= and OUT=).
    • Take a look at the processFM(..) method provided. This method handles the demodulation. It takes in three parameters, input and output arrays and number of elements read in.
    • Within the file you will need to do the following (in the template, there is a "Your code goes here." for each line you need to complete):
      1. In the open() method, add in the buffer allocation.
      2. In the process() method, complete the int numRead = line. You should read in a buffer's worth of data.
      3. You will need to cast the input data to a float array before passing it to the processFM(..) method.
        • Hint: Only the data from the input buffer needs to be copied from the data buffer into the array.
      4. Once you put in the casts you should immediately put in the uncasts a few lines below. Do this for both the input and output arrays.
        • Hint: Only the data from the output buffer needs to be copied from the array into the data buffer.
      5. Between the cast and uncast, process the data. All you need to do is to call processFM(..), all of the other work is done in that method.
      6. Now write out the data to the output file (this must be AFTER the uncast).
    • Use the test macro to test it out.
    • FYI: The DEMOD command in the DSP option tree supports demodulating AM, FM, PM and more. Please see the explain file for DEMOD for more details.

back