Usage of the Buffer for Input Transfer

The usage methods of the buffer and functions in a typical pattern for carrying out input transfer (sampling) are described in this section.


Pattern 1: Finite number of data, acquire the data after sampling

Single transfer is carried out, and data is acquired after sampling is complete.


                               Process

In this case, a buffer size the same as the required data number size or larger must be prepared.

Specify DIODM_WRITE_ONCE as the buffer repeat specification. If data input number has been decided, specify the stop condition as DIODM_STOP_NUM, and try to complete transfer in the number specified by the DioDmSetStopNumber function.

After a transfer is started, wait for the completion message, or wait in a loop until the status bit DIODM_STATUS_STOP is set by the status acquisition function while inserting a wait such as sleep by Win32API.


Pattern 2: Finite number of data, acquire the data while sampling

Single transfer is carried out, and data is acquired during sampling and used.


  Process    Process    Process

In this case, a buffer size the same as the required data number size or larger must be prepared.

Specify DIODM_WRITE_ONCE as the buffer repeat specification. If data input number has been decided, specify the stop condition as DIODM_STOP_NUM, and try to complete transfer in the number specified by the DioDmSetStopNumber function.

When transferring, if the specification number transfer completion message is notified (DioDmSetCountEvent), then use the transfer number acquisition function (DioDmGetCount) need to confirm the position that the data is stored at.


Pattern 3: Infinite number of data, acquire all of the data

Infinite transfers are carried out, if the prescribed amount of data is acquired, then store the data into a file.


  Process    Process    Process

The transfer number is confirmed by the system timer, etc., using the specification number transfer completion message or transfer number acquisition function. Applications are periodically processed from the read pointer to the write pointer by the system timer or event message.

In this case, the read pointer indicating where data is processed up to and the write pointer indicating up to which part of the buffer data has been written must be controlled by a user program.

The read/write pointers are counters that loop back and return to 0 when transfers are carried out up to the buffer size.
The write pointer is requested by using DioDmGetWritePointer.

The read pointer is a write pointer at the last time data processing.


Pattern 4: Infinite number of data, a random number of data is acquired from the random part by acquiring write pointers


This is the case that infinite tranfer is carried out, and if random conditions are met, then a random number of data is acquired from the random part.

In this case, read and write pointers must be controlled as well.
Please refer to pattern 3.