Java Reference
In-Depth Information
// Since only one program per card, make
// the password static.
private static int fPassword -- = 0x2201;
// Label pins on evaluation card for serial I/O
final static int SERIAL - TX - PIN = CPU.pin0;
final static int SERIAL - RTS - PIN = CPU.pin1;
final static int SERIAL - CTS - PIN = CPU.pin2;
final static int SERIAL - RX - PIN = CPU.pin3;
// Create the UART vp for transmission via COM serial port
static Uart fTxUart -- = new Uart (Uart.dirTransmit, SERIAL - TX - PIN,
Uart.dontInvert, SERIAL - RTS - PIN,
Uart.dontInvert, Uart.speed9600,
Uart.stop1);
// Create the UART vp for reception via the COM serial port
static Uart fRxUart -- = new Uart (Uart.dirReceive, SERIAL - RX - PIN,
Uart.dontInvert, SERIAL - CTS - PIN,
Uart.dontInvert, Uart.speed9600,
Uart.stop1);
/** Resetting Javelin will start the program here. **/
public static void main () {
// Local variable
int data=0;
// Create a temperature data sensor.
DataGenerator temp - sensor = new TempDataGenJavelin ();
// Loop continuously, each time waiting for a request to arrive with
// the password (PW). Then get the temperature reading and send it.
do {
// Go into receive mode and wait for PW
checkPW ();
// Get the data
data = temp - sensor.getData ();
// and then send it to the requestor.
sendInt (data);
} while (true);
} // main
/**
* Utility method to send int value as
 
Search WWH ::




Custom Search