Esempio n. 1
0
            /// <summary>This uses the standard baud rates defined by the SERIAL_BAUD enumerated type</summary>
            private static RESULTS setModeSerial(ISS_MODES mode, IO_TYPES pin3, IO_TYPES pin4, SERIAL_BAUD_RATES baud)
            {
                ISSComm comm = ISSComm.getComm();

                comm.Write(new byte[] { 0x5A, 0x02, (byte)((byte)mode | (byte)ISS_MODES.SERIAL), (byte)(((uint)baud) >> 8), (byte)baud, (byte)(((int)pin4 << 6) | ((int)pin3 << 4)) });
                comm.Read(2);
                //if (comm.readData[0] == 0xFF) // is Ack
                return((RESULTS)comm.readData[1]);
            }
Esempio n. 2
0
            private static RESULTS setMode(ISS_MODES mode, IO_TYPES pin1, IO_TYPES pin2, IO_TYPES pin3, IO_TYPES pin4)
            {
                ISSComm comm = ISSComm.getComm();

                comm.Write(new byte[] { 0x5A, 0x02, (byte)mode, (byte)(((int)pin4 << 6) | ((int)pin3 << 4) | ((int)pin2 << 2) | (int)pin1) });
                comm.Read(2);
                //if (comm.readData[0] == 0xFF) // is Ack
                return((RESULTS)comm.readData[1]);
            }
Esempio n. 3
0
            /// <summary>This uses the custom specified baud rate. Eg: baud = 57600</summary>
            private static RESULTS setModeSerial(ISS_MODES mode, IO_TYPES pin3, IO_TYPES pin4, uint baud)
            {
                baud = (48000000 / (16 + baud)) - 1; // convert to baud rate divisor
                ISSComm comm = ISSComm.getComm();

                comm.Write(new byte[] { 0x5A, 0x02, (byte)((byte)mode | (byte)ISS_MODES.SERIAL), (byte)(((uint)baud) >> 8), (byte)baud, (byte)(((int)pin4 << 6) | ((int)pin3 << 4)) });
                comm.Read(2);
                //if (comm.readData[0] == 0xFF) // is Ack
                return((RESULTS)comm.readData[1]);
            }