Basic stamp program to javelin program
Dear all,
I am trying to convert some coding from basic stamp code to javelin code.
below is the basic stamp code.
RcvData VAR Byte(10)
SEROUT 7, 84, [noparse][[/noparse]"RS", CR]
SEROUT 7, 84, [noparse][[/noparse]"L1 1",CR]
serin 9, 84, [noparse][[/noparse]STR RcvData\10]
debug DEC RCVData(2)
I write the beginning like this
import stamp.core.*;
public class test{
final static int TX = CPU.pin7;
final static int RX = CPU.pin9;
static Uart txUart = new Uart( Uart.dirTransmit, TX, Uart.dontInvert, Uart.speed9600,Uart.stop1 );
static Uart rxUart = new Uart( Uart.dirReceive, RX, Uart.dontInvert, Uart.speed9600,Uart.stop1 );
after this I do not know how to continue the above conversion.
Thank you for your help in advance.
I am trying to convert some coding from basic stamp code to javelin code.
below is the basic stamp code.
RcvData VAR Byte(10)
SEROUT 7, 84, [noparse][[/noparse]"RS", CR]
SEROUT 7, 84, [noparse][[/noparse]"L1 1",CR]
serin 9, 84, [noparse][[/noparse]STR RcvData\10]
debug DEC RCVData(2)
I write the beginning like this
import stamp.core.*;
public class test{
final static int TX = CPU.pin7;
final static int RX = CPU.pin9;
static Uart txUart = new Uart( Uart.dirTransmit, TX, Uart.dontInvert, Uart.speed9600,Uart.stop1 );
static Uart rxUart = new Uart( Uart.dirReceive, RX, Uart.dontInvert, Uart.speed9600,Uart.stop1 );
after this I do not know how to continue the above conversion.
Thank you for your help in advance.
Comments
regards peter
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The truth in physics is changed with time.
I got some more questions.
For example, if I connect the cmucam3 directly to hyperterminal, if I type the following command. the following data will be appear. Below got remark one is I type one and without remark one is computer return one.
RS // I type the reset command
ACK
CMUcam2 v1.00 c6
OM 0 3 // Request for data package
ACK
TC 0 50 0 50 0 50 // I request to track black color
T 11 6
T 30 40
...
...
Now i convert the above coding actually only 3 command: RS, OM 0 3, TC 0 50 0 50 0 50 to java programm like below. Seems I cannot get the exactly data that appears
I mean the character T(applear as other character sometimes, sometimes correct), and the data value(after T) I receive in javelin terminal is different from what I receive in hyperterminal.
Thank you in advance.
import stamp.core.*;
public class cmucam1_2{
final static int TX = CPU.pin3;
final static int RX = CPU.pin4;
static Uart txUart = new Uart(Uart.dirTransmit,TX,Uart.dontInvert,Uart.speed57600,Uart.stop1);
static Uart rxUart = new Uart(Uart.dirReceive,RX,Uart.dontInvert,Uart.speed57600,Uart.stop1);
static StringBuffer buffer = new StringBuffer(128);
static char[noparse]/noparse buf = new char[noparse][[/noparse]8];
static int i;
static void bufferMessage(){
if(rxUart.byteAvailable()){
for (i=1; i<4; i++) {
buf= (char)rxUart.receiveByte();
buffer.append(buf);
}
}
}
static void main() {
txUart.sendString("RS\r");
CPU.delay(5000);
txUart.sendString("OM 0 3\r");
CPU.delay(5000);
txUart.sendString("TC 0 50 0 50 0 50\r");
CPU.delay(5000);
while(true){
bufferMessage();
buf = (char) rxUart.receiveByte();
System.out.println("");
System.out.print(buf);
System.out.print(" ");
System.out.print(buf&255);
System.out.print(" ");
System.out.print(buf&255);
System.out.print(" ");
}
}
}
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The truth in physics is changed with time.