Beispiel #1
0
    public static void setPort(short p, byte val)
    {
        /* Initialize static out_word register bits just once */
        if (once)
        {
            out_world.one  = 1;
            out_world.zero = 0;
            out_world.Bit5 = 0;
            out_world.Bit6 = 0;
            out_world.Bit7 = 0;
            once           = true;
        }

        /* Update the local out_word copy of the JTAG signal to the new value. */
        if (p == TMS)
        {
            out_world.TMS = val;
        }
        if (p == TDI)
        {
            out_world.TDI = val;
        }
        if (p == TCK)
        {
            out_world.TCK = val;
            //    (void) _outp( (unsigned short) (base_port + 0), out_word.value );
            NativeMethods.Out32((short)(base_port + DATA_OFFSET), (short)PrimitiveConversion.ToLong(out_world));

            /* To save HW write cycles, this example only writes the local copy
             * of the JTAG signal values to the HW register when TCK changes. */
        }
    }
Beispiel #2
0
            public void ClearMux(CHANNEL channel)
            {
                byte val = 0;

                switch (channel)
                {
                case CHANNEL.CHANNEL0:
                    m_cmdReg.MuxCH7 = val;
                    break;

                case CHANNEL.CHANNEL1:
                    m_cmdReg.MuxCH6 = val;
                    break;

                case CHANNEL.CHANNEL2:
                    m_cmdReg.MuxCH5 = val;
                    break;

                case CHANNEL.CHANNEL3:
                    m_cmdReg.MuxCH4 = val;
                    break;

                case CHANNEL.CHANNEL4:
                    m_cmdReg.MuxCH3 = val;
                    break;

                case CHANNEL.CHANNEL5:
                    m_cmdReg.MuxCH2 = val;
                    break;

                case CHANNEL.CHANNEL6:
                    m_cmdReg.MuxCH1 = val;
                    break;

                case CHANNEL.CHANNEL7:
                    m_cmdReg.MuxCH0 = val;
                    break;
                }
                ushort data = (ushort)(PrimitiveConversion.ToLong(m_cmdReg));

                SetCommandRegister(data);
            }
Beispiel #3
0
            public AD7291(byte slaveAddress, DiolanI2CController i2c)
            {
                m_slaveAddress = slaveAddress;
                m_i2c          = i2c;
                SetVREF(VREF);


                /* It is recommended to enable AD7291_COMMAND_DELAY feature for
                 * normal operation. */
                m_cmdReg.AutocycleMode = 1;
                m_cmdReg.EXT_REF       = 0;
                m_cmdReg.NoiseDelayedBitTrialAndSampling = 1;
                m_cmdReg.TSense = 1;

                ushort data = (ushort)(PrimitiveConversion.ToLong(m_cmdReg));

                SetCommandRegister(data);

                Console.WriteLine("Command resgister {0}", data);
            }