User`s manual
XP8300/XP8400/SE1100 Advanced Programming s 91
Sample Program for BL1000 and BL1300
The program locates all XP8300 and XP8400 boards attached to the
PLCBus. The program then loops, activating the relays on each board.
For each board, the program concludes with an all-on/all-off sequence. To
locate boards, the program polls all 64 possible addresses. The integer
(logical) address of each board that responds is displayed in Dynamic Cs
STDIO window.
/******************************************************
Relay Board Demo - for BL1100
******************************************************/
#define ON 1
#define OFF 0
main(){
int board,relay,found,list[64];
Reset_PBus(); // always do this, first thing
Stall(3000); // pause ~1sec for reset
// Locate relay boards. Build list
// and print board IDs
found=0;
printf("\nLogical relay addresses found: ");
for( board=0; board<64; board++ ){
if( Poll_PBus_Node(Relay_Board_Addr(board)) ){
list[found++] = board;
printf(" %d ",board);
if( found%10 == 0 ) printf("\n");
}
} // Activate relays on each board
// found
while( 1 ){ // loop forever
for( board=0; board<found; board++ ){
for( relay=0; relay<8; relay++ ){
Set_PBus_Relay(list[board],relay,ON);
Stall(1000);
Set_PBus_Relay(list[board],relay,OFF);
}
for( relay=0; relay<8; relay++ ){
Set_PBus_Relay(list[board],relay,ON); // all
}
Stall(2000);
for( relay=0; relay<8; relay++ ){
Set_PBus_Relay(list[board],relay,OFF);// all
}
}
}
}