Hiii all
I am using java 1.6 and RXTXComm package (Javax.comm) package.
I can read data from a electronic weighing machine. Now I have to set the weight as zero. I can tare this weight by sending T command to serial port. I had tried several times but no response from device. Somebody please help me.
this is my code snippet
public class WriteToSerialPort {
CommPortIdentifier pid;
SerialPort serial;
java.io.OutputStream outstream;
public void writeToPort() throws Exception
{
CommPortIdentifier pid=CommPortIdentifier.getPortIdentifier("COM1");
serial=(SerialPort)pid.open("test app",1000);
serial.setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
serial.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
outstream=serial.getOutputStream();
char tare=(char)84;
outstream.write(tare);
}
public static void main(String args[])throws Exception
{
WriteToSerialPort ob=new WriteToSerialPort();
ob.writeToPort();
}
}
thanks in advance