import stamp.core.CPU; import stamp.core.ScaledTimer16; import stamp.core.Timer; import stamp.core.Uart; import stamp.peripheral.rtc.DS1302; public class SerialLCDTest { static boolean tick=true; //static Uart txUart = new Uart(Uart.dirTransmit, CPU.pin12, Uart.invert, Uart.speed19200, Uart.stop1); public static void main () { System.out.println ("SerialLCDTest.java v1.7"); System.out.println ("Starting SerialLCD test..."); ScaledTimer16 scaledTimer = new ScaledTimer16 (400, 100); Timer clock = new Timer(); System.out.println ("Starting DS1302 test..."); DS1302 ds1302 = new DS1302 (CPU.pin13, CPU.pin14, CPU.pin0); for (int i = 0; i < 5; i++) { System.out.println (ds1302.readTime(false)); scaledTimer.mark(); for (clock.mark(); !clock.timeout(1000);) ; // wait for one second } // end for Uart screenUart = new Uart(Uart.dirTransmit, CPU.pin15, Uart.invert, Uart.speed19200, Uart.stop1); screenUart.start(); screenUart.writeString("12345678901234567890"); while (!screenUart.sendBufferEmpty()); //wait until character transmitted screenUart.stop(); //txUart.start(); //txUart.writeString("12345678901234567890"); //while (!txUart.sendBufferEmpty()); //wait until character transmitted //txUart.stop(); /* SerialLCD screen = new SerialLCD(screenUart); screen.backLightOn(); screen.blinkOff(); screen.cursorOff(); screen.clearScr(); screen.moveTo(SerialLCD.LINE2, 1); screen.write("Wow! It's working!"); */ System.out.println ("Starting ScaledTimer test..."); int i = 1; while (true) { scaledTimer.mark(); for (clock.mark(); !clock.timeout(1000);) ; // wait for one second int ticks = scaledTimer.passedTicks(); int time = scaledTimer.passedTime(); System.out.print(i); System.out.print(" "); System.out.print(ticks); System.out.print(" ticks. "); System.out.print(time); System.out.print(" ms. "); System.out.println(tick?"tick":"tock"); tick=!tick; i++; } // end for } }