Talking to DC-16 output expansion board
I can't seem to get Javelin to talk to the DC-16 Output Expansion Board (#31216). I wrote a Uart Library; but, it doesn't seem to be responding to my messages.
I attached my java code. Any help would be appreciated as I've stumbled over this issue with RC-4 and other serial controlled things. I can only find P-BASIC examples, so I'm sorta stuck.
Thanks much!
I attached my java code. Any help would be appreciated as I've stumbled over this issue with RC-4 and other serial controlled things. I can only find P-BASIC examples, so I'm sorta stuck.
Thanks much!
Comments
The javelin has a class for Uart (see manual).
For bidirectional you need 2 uart objects.
import stamp.core.*;public class Testing{ static Uart serialTx = new Uart(CPU.dirTransmit,CPU.pin15,Uart.dontInvert,Uart.speed2400,Uart.stop1);
static Uart serialRx = new Uart(CPU.dirReceive,CPU.pin14,Uart.dontInvert,Uart.speed2400,Uart.stop1);
static Timer t = new Timer(); public static void main() {
int n=0,c;
serialTx.sendString("!DC16"); char block = 3; serialTx.sendByte(block); serialTx.sendByte('V'); System.out.println("Sending..."); //System.out.println(serial.SerOut(1000)); System.out.println("Receiving..."); while (true) { //Expect 3 bytes and wait up to 1000ms for them (sweet!)
System.out.print("BINGO! ");
t.mark(); //reset timer while (!t.timeout(1000) && (n<3)) {
if (serialRx.byteAvailable()) {
c = serialRx.receiveByte(); System.out.print((char)c);
n++; }
}
System.out.print('\n'); } }}
That should give you an idea how to use the Uart object.
regards peter
Post Edited (Peter Verkaik) : 10/13/2006 6:49:04 AM GMT
I have only been able to get 0 (byte) reply from the DC16 unit. (which is just based upon the invert / dontInvert / Pin)
There are a few things I need to verify. The BASIC example they give is:
SEROUT Pin, Baud, ("!DC16", %11, "V")
SERIN Pin, Baud, v1, v2, v3
Do you see anything wrong with my attempt in the attached file?
to transmit and receive.
I adapted my psc class for the DC16 board.
This class must be stored in folder
%IDE path%\lib\stamp\peripheral\relay\dc16\
Read this class how to connect the javelin to the DC16 board, using either 1 or 2 javelin
I/O pins.
regards peter
Not sure if you have any more advice about this, since I know you don't have the component to test with.
Check the wiring. You need to have a 0V connection (GND dc16 to GND javelin)
and a TX/RX connection (Javelin I/O pin to dc16 pin).·I·think the dc16 pin to use
is the one marked W (there is a 3pin connector labeled RWB on the dc16 board)
I know the communication worked on the psc board.
regards peter
as described in the DC16 class?
regards peter
How do you connect the dc16 board to the javelin to make it work?
regards peter
·
I updated the DC16 class with that info.
regards peter
regards peter