|
Windows DLL
You can use the above protocol specifications to program the
SC-8000. To further ease some of the Serial Port programming
learning curve, a windows DLL is provided to get you going quickly. The interface to the DLL
provides an easy to use and simple API to send data to the SC8000.
Up to 4 simultaneous controllers can be used with the DLL. There are only a few calls to the DLL,
the following are the C function prototypes:
int SC8_Initialize (int
PortNum);
void SC8_SendPositions (int
BoardNum, unsigned char Mask, char DIO, unsigned short *pValue);
void SC8_SendPos(int
BoardNum, int Axis, unsigned short Position);
void SC8_SendDigital(int
BoardNum, int DigitalAxis, int ONOFF);
void SC8_CleanUP (int
BoardNum);
The SC8_Initialize
function will return a Board Number, to be used for subsequent
calls.
If the call is successful, the Board Number will return a value
starting with 1 (then 2, 3, etc... for subsequent boards).
If the communication fails (ex: not connected). The return value is
0.
The PortNum
parameter is the COM port value.
The SC8_SendPositions
is the most complex function. It is used send data to update both
the digital output and servo axis.
The parameter BoardNum
is the Board Number returned from the
SC8_Initialze function above. If the board has not been
initialized, the function does nothing.
The parameter Mask
is a one byte (unsigned char) value for which each axis is one bit
in the binary representation. If the bit value is a binary 1, then
the axis will be updated with position data to be followed. Example:
Mask is decimal 27, or binary
00011011, would mean four axis are to be updated, the axis are
(starting from the right, least significant):
Axis 1: YES
Axis 2: YES
Axis 3: NO
Axis 4: YES
Axis 5: YES
Axis 6: NO
Axis 7: NO
Axis 8: NO
The parameter DIO is
a bit tricky. Since it's a ASCII representation of the Hex value.
Example: you would like to turn on the digital output 1, 2 and 4,
and turn OFF digital outputs 3. In binary (easier to see than hex),
that would be 1011, or B as a hex value; then
DIO is the "ASCII character" B.
Similarly, for 0011, or 3 as a hex;
DIO is the "ASCII
character" 3
The parameter pValue
is a pointer to an array of unsigned short values. The number of
values in the array must match the number of Axis that position data
is expected, indicated earlier in the
Mask parameter.
Using the example above for
Mask, the array will contains four values, the first value is
for Axis1, then Axis2, then Axis4, then Axis5.
The SC8_SendPos is a
simpler function to send position data to one servo axis.
The parameter BoardNum
is the Board Number returned from the
SC8_Initialze function above. If the board has not been
initialized, the function does nothing.
The parameter Axis
is the Axis number (1 to 8) to be updated.
The parameter Position
is the position data.
The SC8_SendDigital is a simpler function to turn ON or OFF one
digital IO.
The parameter BoardNum
is the Board Number returned from the
SC8_Initialze function above. If the board has not been
initialized, the function does nothing.
The parameter DigitalAxis
is the digital output (1 to 4) to be updated
The parameter ONOFF
is a value for the state of the digital output. A value of 0 will
turn the digital output OFF (low), any other values will turn the
output ON (high).
The SC8_CleanUp
function should be used just before your application end. The
parameter BoardNum
is the Board Number returned from the
SC8_Initialze
function above |