By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,739 Members | 2,014 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,739 IT Pros & Developers. It's quick & easy.

Connection with microcontroler

P: 24
I had add library RXTX from[HTML]http://users.frii.com/jarvi/rxtx/[/HTML] package and have copied code from page :TwoWaySerialComunication
[HTML]http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port[/HTML]
for communication and tested it with Command prompt-u.
and PIC microcontroller.



I have built JFrame with JTextField, where I would like to see arrived sign and send typed key.

Problem:
What is the variable I haw to get (from RXRX code) to see the value in new JTextField from MCU and what method I need to use?
Thank you
Jan 24 '07 #1
Share this Question
Share on Google+
6 Replies


10K+
P: 13,264
I had add library RXTX from[HTML]http://users.frii.com/jarvi/rxtx/[/HTML] package and have copied code from page :TwoWaySerialComunication
[HTML]http://rxtx.qbang.org/wiki/index.php/Two_way_communcation_with_the_serial_port[/HTML]
for communication and tested it with Command prompt-u.
and PIC microcontroller.



I have built JFrame with JTextField, where I would like to see arrived sign and send typed key.

Problem:
What is the variable I haw to get (from RXRX code) to see the value in new JTextField from MCU and what method I need to use?
Thank you
You want to display something in a JFrame? You said where are you taking that variable that you want to display from?
Jan 24 '07 #2

P: 24
Who=program=code=

class 1{
JFrame GrafficInterface =new JFrame();
//...
JTextField WhereDataFromMicrocontrolerAreVisible = new JTextField();
//:::
GraficInterface.add(WhereDataFromMicrocontrolerAre Visible);
//...
}


class 2 {
//...
TwoWaySerialComunicationTwoWaySerialComunication
// interfers with microcontroler storing dates in variables. Yes,which wariables?
// and then have to put them in WhereDataFromMicrocontrolerAreVisible
// and in other direction to

}

Thanks for your interstig.

With rispect

Ivan
Jan 24 '07 #3

10K+
P: 13,264
Who=program=code=

class 1{
JFrame GrafficInterface =new JFrame();
//...
JTextField WhereDataFromMicrocontrolerAreVisible = new JTextField();
//:::
GraficInterface.add(WhereDataFromMicrocontrolerAre Visible);
//...
}


class 2 {
//...
TwoWaySerialComunicationTwoWaySerialComunication
// interfers with microcontroler storing dates in variables. Yes,which wariables?
// and then have to put them in WhereDataFromMicrocontrolerAreVisible
// and in other direction to

}

Thanks for your interstig.

With rispect

Ivan
Can pass data between objects of different classes using the constructor e.g

Expand|Select|Wrap|Line Numbers
  1. class A {
  2.     Object data1
  3.  
  4. }
  5. class B {
  6.     B(A a) {
  7.                     use the variables in a here eg
  8.         a.data1
  9.     }
Jan 24 '07 #4

P: 24
Thanck you wery much ,
for your clear and fast answer.


I'LL let you know...
... need some time to work on it.
Jan 24 '07 #5

P: 24
And to be sure,..., is it variable buffer that i have aplay to ?

public static class SerialReader implements Runnable
{
InputStream in;

public SerialReader ( InputStream in )
{
this.in = in;
}

public void run ()
{
byte[] buffer = new byte[1024];
int len = -1;
try
{
while ( ( len = this.in.read(buffer)) > -1 )
{
System.out.print(new String(buffer,0,len));
}
}
catch ( IOException e )
{
e.printStackTrace();
}
}
}

/** */
Jan 24 '07 #6

10K+
P: 13,264
And to be sure,..., is it variable buffer that i have aplay to ?

public static class SerialReader implements Runnable
{
InputStream in;

public SerialReader ( InputStream in )
{
this.in = in;
}

public void run ()
{
byte[] buffer = new byte[1024];
int len = -1;
try
{
while ( ( len = this.in.read(buffer)) > -1 )
{
System.out.print(new String(buffer,0,len));
}
}
catch ( IOException e )
{
e.printStackTrace();
}
}
}

/** */
Yes pretty much any type can be passed into the constructor.
Jan 25 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.