CPU.installVP() & CPU.removeVP() Not Working
I have a UART object that reads in serial data. After it is declared in code (and automatically installed), it ALWAYS works.
If I place a removeVP() & installVP() (As showen in the "Javelin Stamp Hardware Refernce" P. 165) before using the object, then the UART no longer works. HELP.
Working Code:
NOT Working Code (There is never a byte available):
Please help... What is wrong?
If I place a removeVP() & installVP() (As showen in the "Javelin Stamp Hardware Refernce" P. 165) before using the object, then the UART no longer works. HELP.
Working Code:
...
static Uart Uart_rx = new Uart( Uart.dirReceive, CPU.pin3, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
...
public static void main() {
...
if ( Uart_rx.byteAvailable() ) {
System.out.println(Uart_rx.receiveByte());
}
...
}
...
NOT Working Code (There is never a byte available):
...
static Uart Uart_rx = new Uart( Uart.dirReceive, CPU.pin3, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
...
public static void main() {
...
CPU.removeVP(Uart_rx);
CPU.installVP(Uart_rx);
...
if ( Uart_rx.byteAvailable() ) {
System.out.println(Uart_rx.receiveByte());
}
...
}
...
Please help... What is wrong?

Comments
use Uart_rx.start() to start the Uart (and install vp).
The start() method initializes all necessary Uart registers.
regards peter