Sensoray 2600 User Manual
Page 14

Sensoray 2600 Programming Guide
10
Initialization and Status Functions
if ( ( faults = S26_BoardOpen( 0, 0, MMAdrs ) ) != 0 )
{
//
// .... Handle error ....
//
S26_DLLClose();
return faults;
}
// Reset MM number 0 and all of its connected I/O modules.
S26_ResetNetwork( 0 );
// Detect and register all IOMs connected to MM number 0.
S26_RegisterAllIoms( 0, 1000, &NumIoms, IomList, IomStatus, 1 );
printf( "%d IOMs were detected.\n" );
//
// .... Do all I/O operations and run the application’s main function ....
//
// Close the 2600 system middleware. S26_BoardClose() is called implicitly.
S26_DLLClose();
return 0;
}
4.4.4.2 Linux
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_DriverOpen() ) != 0 )
{
//
// .... Handle error ....
//
return faults;
}
// Open MM number 0 and process any errors.
if ( ( faults = S26_BoardOpen( 0, 0, MMAdrs ) ) != 0 )
{
//
// .... Handle error ....
//
S26_DriverClose();
return faults;
}
// Reset MM number 0 and all of its connected I/O modules.
S26_ResetNetwork( 0 );
// Detect and register all IOMs connected to MM number 0.
S26_RegisterAllIoms( 0, 1000, &NumIoms, IomList, IomStatus, 1 );
printf( "%d IOMs were detected.\n" );