Programming Examples & Sample Code
G-3. Sample Code for control PCI 16 Photo/16 Relay Card
Date : 2003, Feb. 12
Program idea:  
If Photo Isolator Channel 1 On Then Relay Output Channel 1 ON
Else Photo Isolator Channel 1 OFF Then Relay Output Channel 1 OFF
And
If Photo Isolator Channel 2 On Then Relay Output Channel 2 ON
Else Photo Isolator Channel 1 OFF Then Relay Output Channel 1 OFF

****** Sample Code for control PCI 16 Photo/16 Relay Card *****

import java.io.*;
 
import com.decision.rp.user.Adaptlet;
 
public class PR16Adaptlet extends Adaptlet implements Runnable
 
{
 
public void valueChanged(int card, int port, int line, int state)
 
{
 
if ((card == PCI16IN16OUT_CARD) && (port == 1) && (line == 0) && (state == 1))
 
{
 
this.set(PCI16IN16OUT_CARD,0,0,1); // set the [PCI16IN16OUT card][port 0][line 0] as on
 
}
else    
 
{
 
this.set(PCI16IN16OUT_CARD,0,0,0); // set the [PCI16IN16OUT card][port 0][line 0] as off
 
}
 
if ((card == PCI16IN16OUT_CARD) && (port == 1) && (line == 1) && (state == 1))
 
{
 
this.set(PCI16IN16OUT_CARD,0,1,1); // set the [PCI16IN16OUT card][port 0][line 1] as on
 
}
 
else  
 
{
 
this.set(PCI16IN16OUT_CARD,0,1,0); // set the [PCI16IN16OUT card][port 0][line 1] as off
 
}
 
}
 
public void run()
 
{
 
}
 
public void stop()
 
{
 
}
 
public void start()
 
{
 
}
 
}
 
****** End Of program ***** 

Back to main manual
Prepare JAVA Development Environment
Write your program
Digital I/O Command and Function
RS232/422/485 Serial Communication Command and Function
12 bit Data Acquisition Card Command and Function
Video Image Input Command and Function
Sample Code
Compile your JAVA Class application program
Upload your application program
Start and Stop run your application program
Tranzview System