UART and Hyperterminal
Don French
Posts: 126
I have been trying to get the UART example HyperTermCOM.java to work with the MS Hyperterm program with no success.· So, what could I be doing wrong?· Here is the code of HyperTermCOM:
import stamp.core.*;
public cl(expletive) HyperTermCOM {························ // COM Port (9-pin serial)
· final static int SERIAL_TX_PIN = CPU.pin0;······· //···· 2
· final static int SERIAL_RTS_PIN = CPU.pin1;······ //···· 7
· final static int SERIAL_CTS_PIN = CPU.pin2;······ //···· 8
· final static int SERIAL_RX_PIN = CPU.pin3;······· //···· 3
· static Uart txUart = new Uart( Uart.dirTransmit, SERIAL_TX_PIN, Uart.dontInvert,
························· SERIAL_RTS_PIN, Uart.dontInvert, Uart.speed9600,
························· Uart.stop1 );
· static Uart rxUart = new Uart( Uart.dirReceive, SERIAL_RX_PIN, Uart.dontInvert,
························· SERIAL_CTS_PIN, Uart.dontInvert, Uart.speed9600,
························· Uart.stop1 );
· static StringBuffer buffer = new StringBuffer(128);
· static char c;
· static void bufferMessage(){
··· c = 0xff;
··· while (c != '\r'){
····· if(rxUart.byteAvailable()){
······· c = (char)rxUart.receiveByte();
······· buffer.append(c);
····· }
··· }
· }················································· // end bufferMessage
· public static void main(){
··· do{
····· buffer.clear();
····· txUart.sendString("Type a message, the press enter: \n\r");
····· bufferMessage();
····· txUart.sendString("The message you sent was: \n\r");
····· txUart.sendString(buffer.toString());
····· txUart.sendString("\n\rDo you want to enter another message? (y/n) \n\r");
····· c = (char) rxUart.receiveByte();
··· } while(c == 'y' || c != 'n');
··· txUart.sendString("Goodbye!\n\r");
· }················································· // end main
}··················································· // end cl(expletive) declaration
I could not find where in the documentation·the IO pins that are attached to the onboard COM port on the Demo board are defined, but I am (expletive)uming that the ones in the example are right.· Correct?
In Hyperterminal, I have the following settings:· COM1 9600 baud 8-N-1 Hardware
But I don't get anything in the Hyperterm window and it does not show what I type.· What am I doing wrong?
·
import stamp.core.*;
public cl(expletive) HyperTermCOM {························ // COM Port (9-pin serial)
· final static int SERIAL_TX_PIN = CPU.pin0;······· //···· 2
· final static int SERIAL_RTS_PIN = CPU.pin1;······ //···· 7
· final static int SERIAL_CTS_PIN = CPU.pin2;······ //···· 8
· final static int SERIAL_RX_PIN = CPU.pin3;······· //···· 3
· static Uart txUart = new Uart( Uart.dirTransmit, SERIAL_TX_PIN, Uart.dontInvert,
························· SERIAL_RTS_PIN, Uart.dontInvert, Uart.speed9600,
························· Uart.stop1 );
· static Uart rxUart = new Uart( Uart.dirReceive, SERIAL_RX_PIN, Uart.dontInvert,
························· SERIAL_CTS_PIN, Uart.dontInvert, Uart.speed9600,
························· Uart.stop1 );
· static StringBuffer buffer = new StringBuffer(128);
· static char c;
· static void bufferMessage(){
··· c = 0xff;
··· while (c != '\r'){
····· if(rxUart.byteAvailable()){
······· c = (char)rxUart.receiveByte();
······· buffer.append(c);
····· }
··· }
· }················································· // end bufferMessage
· public static void main(){
··· do{
····· buffer.clear();
····· txUart.sendString("Type a message, the press enter: \n\r");
····· bufferMessage();
····· txUart.sendString("The message you sent was: \n\r");
····· txUart.sendString(buffer.toString());
····· txUart.sendString("\n\rDo you want to enter another message? (y/n) \n\r");
····· c = (char) rxUart.receiveByte();
··· } while(c == 'y' || c != 'n');
··· txUart.sendString("Goodbye!\n\r");
· }················································· // end main
}··················································· // end cl(expletive) declaration
I could not find where in the documentation·the IO pins that are attached to the onboard COM port on the Demo board are defined, but I am (expletive)uming that the ones in the example are right.· Correct?
In Hyperterminal, I have the following settings:· COM1 9600 baud 8-N-1 Hardware
But I don't get anything in the Hyperterm window and it does not show what I type.· What am I doing wrong?
·
Comments
I have used routines for null modem (3wire - rx,tx,gnd) - on·my own circuits with·no issues
static Uart txUart = new Uart(Uart.dirTransmit,
CPU.pin0, Uart.invert,Uart.speed9600,Uart.stop1 );
with this example - hyperterminal is set to 9600,n,8,1 - none
Post Edited (QuattroRS4) : 1/26/2007 6:30:49 AM GMT
P.S. I can't believe that this forum converts every occurance of a-s-s to (expletive), even when it is included in the middle of a word. I (expletive)ume that is to protect our youth, who will be corrupted by reading the word a-s-s? Save me!
What serial cable are you using, Is it a homebrew board or kit ?
did you try a simple send from the javelin to hyperterminal ?
http://forums.parallax.com/showthread.php?p=626089
because it never happened before.
To make the javelin work with a pc com port you need to wire
javelin I/O pins to a rs232 level shifter, like the SP237 onboard
the javelin demoboard or a max232 (or alike).
regards peter
P.S. Would the moderator please turn off that stupid expletive thing? No kids are harmed by reading the word a-s-s. And when it is embedded inside another word,even!!! My Lord!!!
(The program port is labeled JIDE)
see manual page 64 and further. (Communicating with other computers).
You need to supply connections between connectors X2 and X4 (figure 4.8b)
regards peter