Thread View: borland.public.jbuilder.java.language
2 messages
2 total messages
Started by Magnus
Tue, 06 Dec 2005 15:53
Serial Port Communication error
Author: Magnus
Date: Tue, 06 Dec 2005 15:53
Date: Tue, 06 Dec 2005 15:53
50 lines
2698 bytes
2698 bytes
Hi,
I have one customer (out of ~100) that can't get his communication over
the Serial port to work and I don't know how to find why this fails. The
customer can use the serial port to transfer data to other programs.
Any ideas?
Maybe it can be checked/verified in WinXP?
Can I add more exceptions to catch the fault?
Magnus
--- code ---
public UploadCommunication(String pID) { // Constr
try {
Format formatter = new SimpleDateFormat("yyMMdd-HHmmss");
LOGFILE = "UploadLog"+formatter.format(new Date())+".txt";
TimeStamp = new java.util.Date().toString();
Logg.ULLog(TimeStamp, LOGFILE);
Enumeration a = CommPortIdentifier.getPortIdentifiers();
if (!a.hasMoreElements()) {
Logg.ULLog("No ports found!", LOGFILE);
boolean stopRead = true;
}
portID = CommPortIdentifier.getPortIdentifier(pID);
serialPort1 = (SerialPort) portID.open("UploadCommunication",
2000);
Logg.ULLog(portID.getName() + " opened for instrument
input",LOGFILE);
} catch (Exception ee) {
if (portID == null) {
Logg.ULLog("PortID is NULL for port: " + pID,LOGFILE);
} else {
Logg.ULLog("main catch portID: " + portID, LOGFILE);
}
Logg.ULLog("main catch ee: " + ee.toString(),LOGFILE);
boolean stopRead = true;
try {serialPort1.close();
} catch (Exception ce) {} //try to close the port
}
--- end code ---
--- I get the following in UploadLog ---
Mon Dec 5 14:45:09 GMT-05:00 2005
No ports found!
PortID is NULL for port: COM1
main catch ee: javax.comm.NoSuchPortException
Re: Serial Port Communication error - solved
Author: Magnus
Date: Tue, 13 Dec 2005 20:50
Date: Tue, 13 Dec 2005 20:50
20 lines
1718 bytes
1718 bytes
It turned out that the install did not find the correct JRE Home so the communication files did not end up in the right directories. Magnus wrote: > Hi, > > I have one customer (out of ~100) that can't get his communication over > the Serial port to work and I don't know how to find why this fails. The > customer can use the serial port to transfer data to other programs. > > Any ideas? > Maybe it can be checked/verified in WinXP? > Can I add more exceptions to catch the fault? > > > --- I get the following in UploadLog --- > Mon Dec 5 14:45:09 GMT-05:00 2005 > No ports found! > PortID is NULL for port: COM1 > main catch ee: javax.comm.NoSuchPortException
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads