public void Initialize() { mocks = new Mockery(); mockDevice = mocks.NewMock <IDDSUSBChip>(); dds = new AD9958(mockDevice); // Define some messages // FullDDSReset via EP1 fullDDSReset = new Message(new byte[] { 0x03, 0x08, 0x0b }); // Set to Two Level Modulation // Call to Function Register 1 according to Christian's implementation setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 }); // Set to single tone // Call to channel function register with AFP select none, // the middle byte to default and the LSByte to all zeros // as in Christians code setSingleTone = new Message(new byte[] { 0x03, 0x00, 0x03, 0x00 }); // Select both channels // Call to channel select register with both channels on and open and // write mode MSB serial 4 bit mode selectBothChannels = new Message(new byte[] { 0x00, (byte)(0xc0 + 0x36) }); // Select channel zero selectChannelZero = new Message(new byte[] { 0x00, 0x76 }); // Select channel one selectChannelOne = new Message(new byte[] { 0x00, 0xB6 }); // Set frequency to 100 MHz // 0x33 0x33 0x33 0x33 / 2**32 = 0.2 setFreqTo100MHz = new Message(new byte[] { 0x04, 0x33, 0x33, 0x33, 0x33 }); // Set phase to zero setPhaseToZero = new Message(new byte[] { 0x05, 0x00, 0x00 }); // Initialization after MasterReset initialization = new Message(); initialization.Add(selectBothChannels); initialization.Add(setSingleTone); initialization.Add(setTwoLevel); }
public void Initialize() { mocks = new Mockery(); mockMicrocontroller = mocks.NewMock <IDDSUSBChip>(); dds = new AD9958(mockMicrocontroller); // Define some messages // Select channel zero selectChannelZero = new Message(new byte[] { 0x00, 0x76 }); // Set to Two Level Modulation // Call to Function Register 1 according to Christian's implementation setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 }); // Set to frequency modulation // Call to channel function register with AFP select FM, // the middle byte to default and the LSByte to all zeros // as in Christians code selectFrequencyModulation = new Message(new byte[] { 0x03, 0x80, 0x03, 0x00 }); // Set frequency tuning word of current channel to 1 MHz // 0x00 0x83 0x12 0x6E / 2**32 = 0.002 setFreqTuningWord1MHz = new Message(new byte[] { 0x04, 0x00, 0x83, 0x12, 0x6F }); // Set Channel Word Register 1 to 2 MHz setChanWordOne2MHz = new Message(new byte[] { 0x0A, 0x01, 0x06, 0x24, 0xDD }); // Set to phase modulation // Call to channel function register with AFP select PM, // the middle byte to default and the LSByte to all zeros // as in Christians code selectPhaseModulation = new Message(new byte[] { 0x03, 0xC0, 0x03, 0x00 }); // Set phase tuning word to zero setPhaseTuningWordZero = new Message(new byte[] { 0x05, 0x00, 0x00 }); // Set channel register word 1 to pi (resolution 14bit) // Pi is 2**13 (10 0000 0000) we have to MSB align it in the 32 bit CW1 register // where we set all others to zero setChanWordOnePi = new Message(new byte[] { 0x0A, 0x80, 0x00, 0x00, 0x00 }); }
public void Initialize() { mocks = new Mockery(); mockDevice = mocks.NewMock <IDDSUSBChip>(); dds = new AD9958(mockDevice); // Define some common calls // Set to Two Level Modulation // Call to Function Register 1 according to Christian's implementation setTwoLevel = new Message(new byte[] { 0x01, 0xa8, 0x00, 0x20 }); // Set to single tone // Call to channel function register with AFP select none, // the middle byte to default and the LSByte to all zeros // as in Christians code setSingleTone = new Message(new byte[] { 0x03, 0x00, 0x03, 0x00 }); // Select both channels // Call to channel select register with both channels on and open and // write mode MSB serial 4 bit mode selectBothChannels = new Message(new byte[] { 0x00, (byte)(0xc0 + 0x36) }); // Full_DDS_Reset via EP1 fullDDSReset = new Message(new byte[] { 0x03, 0x08, 0x0b }); // Start_Transfer via EP1 startTransfer = new Message(0x03, 0x03, 0x06); // Stop Transfer via EP1 stopTransfer = new Message(0x03, 0x04, 0x07); // ListplayMode via EP1 (10 byte length) listPlayMode10bytes = new Message(0x04, 0x0b, 0x0a, 0x19); // StartListplayMode via EP1 startListPlayMode = new Message(0x03, 0x0c, 0x0f); // StopListplay mode via EP1 stopListPlayMode = new Message(0x03, 0x0e, 0x11); }
public void Initialize() { mocks = new Mockery(); mockMicrocontroller = mocks.NewMock <IDDSUSBChip>(); dds = new AD9958(mockMicrocontroller); }
/// <summary> /// Construct a AD9958 from an IDDS Microcontroller device. /// </summary> /// <param name="usbDevice">Microcontroller device</param> /// <remarks> /// This constructor is the one that is to be used when programming in .NET since it neatly splits /// the CyUSB functionality from the CQTDDS functionality (the IDDS Microcontroller abstracts from /// the CyUSB functionality and makes the whole thing unit testable. However Labview crashes if /// one tries to use it in that way, so use the other constructors which hardwire functionality /// of CyUSB /// </remarks> public AD9958(IDDSUSBChip usbDevice) { // device is protected member of the base class device = usbDevice; initializeAD9958(); }