serial
Class SerialDA232

java.lang.Object
  |
  +--serial.Serial
        |
        +--serial.SerialDA232
All Implemented Interfaces:
EventListener, javax.comm.SerialPortEventListener

public class SerialDA232
extends Serial

The Serial class is designed to control serial devices. This is the base class for all serial devices we use.


Fields inherited from class serial.Serial
answerTimeout, cancelEcho, debug, device, listener, semaphore, serial, serial_in, serial_out, timeout_wait, waitingForResponse
 
Constructor Summary
SerialDA232()
           
 
Method Summary
static boolean[] byteToBoolean(byte input)
          This method is used to power the 232SDA12 via the serial port by setting RTS and DTR high.
static void main(String[] args)
          Used for standalone debugging and hardware tests.
 int[] readAnalogInput()
          This method reads all anlaog channels (0 through 10) and outputs them in the form of an array of integers.
 int[] readAnalogInput(int index)
          This method reads all anlaog channels(0 through index) and outputs them in the form of an array of integers.
 boolean[] readDigitalInput()
          This method returns all Digital Inputs as a boolean array with digitalInputs[0,1,2] as the values of Digital Inputs 0,1,2 and digitalOutputs[3,4,5] as the values of the Digital Outputs 0, 1, 2, respectively.
 boolean readDigitalInput(int index)
          This method returns the value of a specific Digital Input
 int readSpecificAnalogInput(int index)
          This method reads the specific analog channel specified by index (0 through 10)
 void setDigitalOutput(boolean DO1, boolean DO2, boolean DO3)
          This method is used to set all the Digital Outputs
 void setDigitalOutput(int index, boolean value)
          This method is used to set just one Digital output, given by index (1, 2, or 3), without affecting the other Digital Outputs.
 
Methods inherited from class serial.Serial
addEventListener, close, getNewInstance, open, open, open, openNoParams, processSerialEvent, read, readBytes, readString, ready, send, send, sendSynch, sendSynch, sendSynch, sendSynch, serialEvent, setDebug, setFlowControlMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerialDA232

public SerialDA232()
Method Detail

byteToBoolean

public static boolean[] byteToBoolean(byte input)
This method is used to power the 232SDA12 via the serial port by setting RTS and DTR high.

setDigitalOutput

public void setDigitalOutput(boolean DO1,
                             boolean DO2,
                             boolean DO3)
This method is used to set all the Digital Outputs

setDigitalOutput

public void setDigitalOutput(int index,
                             boolean value)
This method is used to set just one Digital output, given by index (1, 2, or 3), without affecting the other Digital Outputs.

readDigitalInput

public boolean[] readDigitalInput()
This method returns all Digital Inputs as a boolean array with digitalInputs[0,1,2] as the values of Digital Inputs 0,1,2 and digitalOutputs[3,4,5] as the values of the Digital Outputs 0, 1, 2, respectively.

readDigitalInput

public boolean readDigitalInput(int index)
This method returns the value of a specific Digital Input

readAnalogInput

public int[] readAnalogInput()
This method reads all anlaog channels (0 through 10) and outputs them in the form of an array of integers.

readAnalogInput

public int[] readAnalogInput(int index)
This method reads all anlaog channels(0 through index) and outputs them in the form of an array of integers.

readSpecificAnalogInput

public int readSpecificAnalogInput(int index)
This method reads the specific analog channel specified by index (0 through 10)

main

public static void main(String[] args)
Used for standalone debugging and hardware tests.