Exemplo n.º 1
0
Arquivo: PMW.cs Projeto: Edll/iow
        /// <summary>
        /// Set the Frequenz of the PMW signal
        /// </summary>
        /// <param name="frequenz"></param>
        public void SetFrequenz(int frequenz)
        {
            _frequenz = (byte)((25000000 / 4096 / frequenz) - 1);

            _i2cMode.AddDataToQueue(_i2cAddrs, 0x00, 0x10);
            _i2cMode.AddDataToQueue(_i2cAddrs, 0xfe, _frequenz);
            _i2cMode.AddDataToQueue(_i2cAddrs, 0x00, 0x01);

            // sleep for 10ms
            _i2cMode.AddDataToQueue(_i2cAddrs, 0x00, 0x80);
        }
Exemplo n.º 2
0
        private void WriteToI2C(int on, int off)
        {
            CalcServoAdress(AxisNumber);

            // Berechnen der Werte für die Register
            byte on1  = (byte)(on & 0xff);
            byte on2  = (byte)(on >> 8);
            byte off1 = (byte)(off & 0xff);
            byte off2 = (byte)(off >> 8);

            Console.WriteLine("Write To ic2");
            _i2CMode.AddDataToQueue(_i2CAddrs, _registerOnL, on1);
            _i2CMode.AddDataToQueue(_i2CAddrs, _registerOnH, on2);
            _i2CMode.AddDataToQueue(_i2CAddrs, _registerOffL, off1);
            _i2CMode.AddDataToQueue(_i2CAddrs, _registerOffH, off2);
        }