73
DMM Technology Corp.
DYN4 AC Servo Drive Instruction Manual
REV. ZM7-A10A
CT1
Sample Code Notes:
(1) The sample code uses a ring buffer structure to input and output data packet bytes. Two separate ring buffers are
using in the code as
char InputBuffer[256]
and
char OutputBuffer[256]
.
Two position pointers are used in each buffer structure to index the data inside the buffer structure. For example, when
a data packet is received from the servo drive, each byte received is sequentially saved into the InputBuffer with the
InBfTopPointer incremented each time. This is done until the host hardware RS232 receiver buffer is empty, meaning
all packet bytes have been read and stored. Data is processed as first-in-first-out (FIFO) queue and starts at the index
of InBfBtmPointer. InBfBtmPointer is incremented each time a byte is processed until InBfBtmPointer=InBfTopPointer,
meaning all packet bytes have been processed.
C++ Code for Serial Communication - Page 7
7.9A Appendix : C++ Code for Serial Communication Protocol