RE: serial0 on TINI 400

"Dooley, Skip" <[email protected]>
Newsgroups gmane.comp.hardware.microcontrollers.tini
Message-ID <DFA43913F010A343B3311B059A7AA99901898323@exhsv06>
Serial0 is used by the serial server thread on the slush shell.
Before running your program you need to 
stopserver -s
Which will stop the server and release the serial0 device for use by other
programs

Skip Dooley 

Hello,

   I have some trouble with using serial0 on TINI 400.
I want to read what is comming on serial0.
   The following program is working perfect form
serial4, but not for serial0.

portNum=0;
try
 {
   CommPortIdentifier portId =
CommPortIdentifier.getPortIdentifier("serial" +
portNum);
    try{
      sP = (SerialPort)portId.open(interfaceName, 10);
    }catch (PortInUseException e){
        System.out.println("Port in use");
        return;
    }

    sP.setSerialPortParams(4800,
                           SerialPort.DATABITS_8,
                           SerialPort.STOPBITS_1,
                           SerialPort.PARITY_NONE);

    sP.setFlowControlMode(sP.FLOWCONTROL_NONE);

    modemInputStream = sP.getInputStream();

    // Clear any old input data
    long available = modemInputStream.available();
    if (available > 0)
modemInputStream.skip(available);
 }
 catch (Exception e)
 {
   System.out.println(e.toString());
   return;
 }

 System.out.println("Open serial"+portNum+" port");

// reading

while(true){
 try{
  int bytesAvailable=modemInputStream.available();
  if (bytesAvailable>0){

     // Read available data
     byte[] readBuffer = new byte[bytesAvailable];
     int numBytes = modemInputStream.read(readBuffer,
0, bytesAvailable);
     System.out.println(new String(readBuffer, 0,
numBytes));

   }
 }catch(IOException ioe){ioe.printStackTrace();}
 }

   Do you know what the problem migth be? 
   Thanks for any sugestion.

Mihaela
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.