TsctlAIOReadys16Desc

From embeddedTS Manuals

This function prepares a buffer for high speed conversion if supported by the hardware. For an ADC, this sets up the specified buffer to automatically receive the specified number of samples in the Array on the enabled channels, while for a DAC it sets up the specified buffer as containing the values to automatically convert to analog outputs. After the buffer has been set up the hardware is set up to activate the first enabled channel and then automatically activate each subsequent channel in turn as soon as the previous one de-activates, looping back around to the first enabled channel after the last enabled channel has de-activated as long as more samples remain.

For some hardware it may be necessary to match which Readys function is called to the size of the samples expected by the hardware. For example, a 16-bit A/D that supports DMA may require that Readys16 be called because it transfers 16-bit values. Or, it might require 32-bit values even though it takes 16-bit samples. Check for any notes for your hardware to determine if this is the case.

Returns a positive value on success. This indicates that the given buffer has been accepted for queuing.

A negative return value indicates failure. Possible failures include:

  • the specified buffer is already (still) in use. (note: you must deliberately try to provoke this error to determine if a previously requested conversion is completed)
  • the hardware has a limited amount of space for queuing and cannot accept an additional buffer at this time
  • the buffer passed does not conform to hardware requirements, such as alignment
  • the hardware does not support buffer queueing. it is still possible to call Gets or Puts as appropriate but those functions will block until the requested buffer is filled or used up.

Any previous conversion in progress caused by Ready will be finished or cancelled (depending on hardware capabilities) before this request is serviced.

A channel goes through the following states:

  1. When a channel is first made active, it waits for its trigger to occur. If its trigger is "on demand" then not wait is done at this step.
  2. The channel remains active while conversion begins and proceed.
  3. When conversion is finished, the channel becomes inactive as well as the last channel active.