It is more an illustration by the 4 base API function that Fischertechnik put in into the FTMscLibEx :
These 4 callback are controlled by masks to enable the individual action for each Input, Counter or DisplayButton.
And also the STARTMOTOREXCMD4, which enables the possibility to have 1 master and 0..3 slave motors synchronice. Extended API function of the STARTMOTOREXCMD .
Code: Alles auswählen
[u]3.X1A SETCBUNICHANGED[/u]
[b]void SetCBUniChanged (void (__stdcall *) cbFunct (DWORD devId, DWORD ioId, DWORD Value, DWORD Overun, [code]
UINT8 mode, BOOL8 digital, void *context ))[/b]
Function installs to the library the specified callback function that reports the change of an “Universal-Input” .
Callback function parameter:
Call:
DWORD devId - controller ID (master or extension controller)
DWORD ioId - index of the universal input (0=I1 to 7=I7)
DWORD Value – depend of the configuration setting for this Input
DWORD Overun – depend of the configuration setting for this Input
UINT8 mode – Mode (see TA_CONFIG struct 9.5)
BOOL8 digital - Digital/Analoque (see Uni input configuration)
void *context -pointer to the context
Since: central registration now (since v4)
3.X4A SETCBCNTINCHANGED
void SetCBCntInChanged (void (__stdcall *) cbFunct (DWORD devId, DWORD cntId, BOOL state, void *context ) )
Function installs to the library the specified callback function that reports the change of a “Counter-Input” .
Callback function parameter:
Call:
DWORD devId - controller ID (master or extension controller)
DWORD cntId - index of the Counter input (0=C1 to 3=C4)
BOOL state – actual state of the input
void *context -pointer to the context
Since: central registration now (since v4)
3.X7A SETCBCOUNTERCHANGED
void SetCBCounterChanged (void (__stdcall *) cbFunct (DWORD devId, DWORD cntId, DWORD count, INT16 mode, void *context ))
Function installs to the library the specified callback function that reports
the change of a “Counter” .
Callback function parameter:
Call:
DWORD devId - controller ID (master or extension controller)
DWORD cntId - index of the Counter input (0 =C1 to 3=C4)
DWORD count – actual counter value
INT16 mode - Mode (see TA_CONFIG struct 9.5)
void *context -pointer to the context
Since: central registration now (since v4)
3.X10A SETCBBUTTONCHANGED
void SetCBButtonChanged (void (__stdcall *) cbFunct (DWORD devId, DWORD buttonId, DWORD duration, BOOL16 pressed, void *context) )
Function installs to the library the specified callback function that reports
the change of a “Counter” .
Callback function parameter:
Call:
DWORD devId - controller ID (master or extension controller)
DWORD buttonId - index of the Button input (0 =right 1=left)
DWORD duration – counts that the button was pressed (after release),
BOOL16 pressed - 1=pressed
void *context -pointer to the context
Since: central registration now (since v4)
[/code]
Code: Alles auswählen
[u]3.13A STARTMOTOREXCMD4[/u]
[b]DWORD StartMotorExCmd4 (HANDLE fthdl,int devId,int mIdx,int duty,int mDirection,int s1Idx,int s1Direction,int s2Idx,int s2Direction,int s3Idx,int s3Direction,int pulseCnt)[/b]
Function activates the intelligent motor mode for motor synchronization. The motor moves to the desired position using the shared counter information. The application shares the information that the motor has reached the end position by using a previously installed callback function (see also SetCBMotorReached() or SetCBMotorExReached() ).
The function is able to managed 1,2 or 3 slaves. However all motor have their proper CBMotorExReached notification.
Call:
HANDLE fthdl - current handle of the ROBO TX Controller
int devId - controller ID (master or extension controller)
int mIdx - motor index (0 to 3) from master (motor)
int duty - duty value for master/slave motor
int mDirection - direction for master motor (0= CW, 1= CCW)
int s1Idx - motor index (0 to 3, -1 or 255 not in use) from slave1 (motor)
int s1Direction - direction for slave1 motor (0= CW, 1= CCW)
int s2Idx - motor index (0 to 3, -1 or 255 not in use) from slave2 (motor)
int s2Direction - direction for slave2 motor (0= CW, 1= CCW)
int s3Idx - motor index (0 to 3, -1 or 255 not in use ) from slave3 (motor)
int s3Direction - direction for slave3 motor (0= CW, 1= CCW)
int pulseCnt - number of count pulses for moving to a position,
relative to the starting position
Return:
DWORD errCode - FTLIB_ERR_SUCCESS (no error) or error code
Note:
Need to wait for a CBMotorExReached for each motor in use (JOIN).