Table of Contents        Previous topic       Next topic       

Virtual Workshop Interface->General Purpose Interface Calls->SetWaveForm

extern "C" void SetWaveForm(LONG nExtensionState, DWORD nPortAddress, DWORD nCount[32], DWORD* pWaveForm[32])

The SetPortPins() function is capable of handling transitions generated by the ARM program when it writes to ports.  However, when the chip generates PWM output, pin transitions can occur faster than the calls to SetPortPins().  PWM output is therefore sent to the extensions using the SetWaveForm() call.

nPortAddress is the 32-bit address of the port which can be up to 32-bits wise and arrays of output data are provided for each pin.

The nCount array contains the number of entries in the 32 pWaveForm arrays.  For instance if nCount[0] is six, then the timer generating the waveform for pin 0 has clocked six times since the last call to SetWaveForm and pWaveForm[0] points to an array of six bytes containing 1's and 0's depending on the level on pin 0 at each clock transition.

nCount[i] will contain zero if there is no PWM output on pin i.

SetWaveForm() will not be called if none of the peripherals generating PWM signals for this port are running but it will be called if a timer is running and there have been no clock transitions (ie the clock it running too slow to have generated and data for this call to SetWaveForm).  In this case the nCount array entries for the appropriate pins will be zero.