Question about SignalGenerator Class Max Frequency


I have a couple of questions on the SignalGenerator Class available in the Premium Core code.

First what I am trying to determine is the maximum frequency that can be generated by this class. Is it 1MHz based upon the 1uS timing resolution?

Basically I have the following code (snippet) and want to know if this is correct for generating 1MHz signal. Unfortunately I don’t have access to a scope right now to determine, but does this seem correct?

        Cpu.Pin pulseTrainPin;
        GHI.Premium.Hardware.SignalGenerator sg;
        uint[] time = new uint[] { 1, 1 };

        //Get Pin6 of the Breakout board
        pulseTrainPin = GT.Socket.GetSocket(11, true, breakout_TB10, null).CpuPins[6];

         sg = new SignalGenerator(pulseTrainPin, false, 2);
         sg.Set(true, time, 0, 2, true);

The second question is that, if I understand this correctly, that the timingsBuffer_us buffer holds the number of pulses that the Signal Generator will generate. So in this example it would generate (2) signals 1uS long (continuously since the bufferRepeating is true)


@ khalilm -

following your code,

  • The first signal is high, of course, next one will be low
  • for each signal (low or high) is 1us, total will be 2us
  • that is repeated, so PWM 500KHz, dutycyle is 50% I think

That makes sense. Thanks!