Usage of buffer at 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: Acquisition of limited data numbers and post-sampling data

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

syori.png(440 byte)
              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 DioDmSetStopNum 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 nanosleep.


Pattern 2: Acquisition while sampling limited data numbers and data


Single transfer is carried out, and data is acquired during sampling and used.
syori.png(440 byte)
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 DioDmSetStopNum function.

The process is carried out while confirming the position that the data is stored
at using the transfer number acquisition function (DioDmGetCount).

The process should be carried out while checking that erroneous endings
are not generated by the status function in the middle of processing.
Insert a wait such as nanosleep during looping to avoid overloading the system.


Pattern 3: Acquisition of limited data numbers and all data


Unlimited transfers are carried out, and when the prescribed amount of data is acquired, processing,
i.e. storing data into the file, is carried out.
syori.png(440 byte)
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 (DioDmGetWritePointerUserBuf).
The read pointer is a write pointer at the last time data processing.


Pattern 4: A random data number from a random part by acquiring unlimited data numbers and write pointers


Unlimited transfers are carried out, and when the random conditions are met, random data numbers are acquired from the random part.
In this case, read and write pointers must be controlled as well.
Please refer to pattern 3.