4 programming examples – Sensoray 2600 User Manual
Page 13

Sensoray 2600 Programming Guide
9
Initialization and Status Functions
Prototype:
u32 S26_RegisterAllIoms(u32 hbd,u32 msec,u16 *nIoms, u16 *types, u8 *stat,u32 retries);
Returns:
Error code as described in section 5.5. Zero is returned if the operation was successful.
Notes:
S26_RegisterAllIoms()
attempts to detect the presence of all IOMs that are connected to the specified MM.
Each detected IOM is then queried to determine its type (i.e., model number), and its RST and CERR (but not any
IOM-specific) status flags are reset to zero. Finally, the IOM types are registered to enable type-specific I/O
operations to be scheduled and executed.
If no errors are detected,
nIoms
receives the number of detected IOMs,
types[]
receives a list of all detected IOM
types, and
stat[]
receives the status flags returned from all detected IOMs.
nIoms
will have a value from 0 to 15,
while each element of
types[]
will contain the IOM model number connected to the corresponding IOM port, or
zero if no IOM is present at the port. Set any of these pointer arguments to zero if the corresponding values are not
needed by the application.
This function must be called before any I/O operations are transacted with IOMs. It should be called after opening
the MM and before calling any of the gateway transaction functions. In addition, this function should be called if
the MM experiences an unexpected reset operation resulting from a communication watchdog time-out.
Example:
See section 4.4.4.
4.4.4 Programming Examples
4.4.4.1 Windows
int main()
{
u32 faults;
char MMAdrs[] = "10.10.10.1"
int NumIoms;
u16 IomList[16];
u8 IomStatus[16];
// Open the MM middleware.
if ( ( faults = S26_DLLOpen() ) != 0 )
{
//
// .... Handle error ....
//
return faults;
}
// Open MM number 0 and process any errors.
Parameter
Type
Description
hbd
u32
MM handle.
msec
u32
Maximum time, in milliseconds, to allow for the MM to reply.
nIoms
u16 *
Pointer a 16-bit application buffer that will receive the number of
detected IOMs. Set to zero if the detected IOM count is not needed.
types
u16 *
Pointer to a 16*16-bit array that will receive a list of the detected IOM
types. types[i] will receive the model number of the IOM that is
connected to IOM port number i. Set to zero if the list of detected
IOM types is not needed.
stat
u8 *
Pointer to a 16-byte buffer that will receive the status bytes from all
detected IOMs. Set to zero if you are not interested in receiving IOM
status info.
retries
u32
Maximum number of transaction retry attempts.