Example #1
0
        public async void SetOperModeHM(PCS drive, sbyte home_method, int home_offset, uint index_pulse, uint fast_speed, uint slow_speed, uint home_acceleration)
        {
            drive.SetOperMode(PCS.OM_HM);

            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x607c, 0x00, home_offset);       //Home offset
            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x2700, 0x04, index_pulse);       //Index pulse
            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x6099, 0x01, fast_speed);        //Homing speed fast
            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x6099, 0x02, slow_speed);        //Homing speed slow
            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x609A, 0x00, home_acceleration); //Homing Acceleration

            drive.COMM.AsyncWrite(drive.SlaveNumber, 0x6098, 0x00, home_method);       //Homing Method

            drive.SetControlWordPdo(drive.CurrentCW, 0x00);
            await Task.Delay(10);

            drive.SetControlWordPdo(drive.CurrentCW, 0x10);
        }
Example #2
0
        public ScopeControl(PCS device)
        {
            this.device = device;
            plotScope   = new PlotViewModel();

            saveTimer.Elapsed += new ElapsedEventHandler(DoSaveToFile);
            saveTimer.Interval = 10000;

            Hamb1.Items = new ObservableCollection <HambMenuItemScope>
            {
                new HambMenuItemScope()
                {
                    Id   = 1,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.Play
                    },
                    IconColor = new SolidColorBrush(IntecColors.green),
                    Name      = "Start Plot (F5)",
                    Vis       = Visibility.Hidden
                },
                new HambMenuItemScope()
                {
                    Id   = 2,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.Crosshairs
                    },
                    IconColor = new SolidColorBrush(IntecColors.white),
                    Name      = "Readjust Axes",
                    Vis       = Visibility.Hidden
                },
                new HambMenuItemScope()
                {
                    Id   = 3,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.ChartLine
                    },
                    IconColor = new SolidColorBrush(IntecColors.white),
                    ChckBx    = new CheckBox()
                    {
                        IsChecked = true
                    },
                    Bttn = new Button()
                    {
                        Content = new PackIconMaterial()
                        {
                            Kind = PackIconMaterialKind.ArrowLeft
                        }
                    },
                    Combo = new ComboBox()
                    {
                        ItemsSource         = device.ObjectDictionary.simpleDict,
                        SelectedValuePath   = "Key",
                        DisplayMemberPath   = "Value",
                        IsTextSearchEnabled = true,
                        Foreground          = new SolidColorBrush(IntecColors.white),
                        Background          = new SolidColorBrush(IntecColors.plotColors[0]),
                        FontSize            = 14,
                        FontFamily          = new FontFamily("Lucida Console")
                    }
                },
                new HambMenuItemScope()
                {
                    Id   = 4,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.ChartLine
                    },
                    IconColor = new SolidColorBrush(IntecColors.white),
                    ChckBx    = new CheckBox()
                    {
                        IsChecked = false
                    },
                    Bttn = new Button()
                    {
                        Content = new PackIconMaterial()
                        {
                            Kind = PackIconMaterialKind.ArrowLeft
                        }
                    },
                    Combo = new ComboBox()
                    {
                        ItemsSource         = device.ObjectDictionary.simpleDict,
                        SelectedValuePath   = "Key",
                        DisplayMemberPath   = "Value",
                        IsTextSearchEnabled = true,
                        Foreground          = new SolidColorBrush(IntecColors.white),
                        Background          = new SolidColorBrush(IntecColors.plotColors[1]),
                        FontSize            = 14,
                        FontFamily          = new FontFamily("Lucida Console")
                    }
                },
                new HambMenuItemScope()
                {
                    Id   = 5,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.Download
                    },
                    IconColor = new SolidColorBrush(IntecColors.white),
                    ChckBx    = new CheckBox()
                    {
                        IsChecked = false
                    },
                    Bttn = new Button()
                    {
                        Content = new PackIconMaterial()
                        {
                            Kind = PackIconMaterialKind.ArrowLeft
                        }
                    },
                    Combo = new ComboBox()
                    {
                        ItemsSource         = device.ObjectDictionary.simpleDict,
                        SelectedValuePath   = "Key",
                        DisplayMemberPath   = "Value",
                        IsTextSearchEnabled = true,
                        Foreground          = new SolidColorBrush(IntecColors.white),
                        Background          = new SolidColorBrush(IntecColors.plotColors[2]),
                        FontSize            = 14,
                        FontFamily          = new FontFamily("Lucida Console")
                    }
                },
                new HambMenuItemScope()
                {
                    Id   = 6,
                    Icon = new PackIconMaterial()
                    {
                        Kind = PackIconMaterialKind.ExitToApp
                    },
                    IconColor = new SolidColorBrush(IntecColors.white),
                    Name      = "",
                    Vis       = Visibility.Hidden
                }
            };

            Hamb1.Items[2].Combo.SelectionChanged += HambMenuCombo_SelectionChanged;
            Hamb1.Items[2].ChckBx.Checked         += ChckBx_Checked;
            Hamb1.Items[2].ChckBx.Unchecked       += ChckBx_Unchecked;
            Hamb1.Items[2].Bttn.Click             += Bttn_Click;
            Hamb1.Items[3].Combo.SelectionChanged += HambMenuCombo_SelectionChanged;
            Hamb1.Items[3].ChckBx.Checked         += ChckBx_Checked;
            Hamb1.Items[3].ChckBx.Unchecked       += ChckBx_Unchecked;
            Hamb1.Items[3].Bttn.Click             += Bttn_Click;
            Hamb1.Items[4].Combo.SelectionChanged += HambMenuCombo_SelectionChanged;
            Hamb1.Items[4].ChckBx.Checked         += ChckBx_Checked;
            Hamb1.Items[4].ChckBx.Unchecked       += ChckBx_Unchecked;
            Hamb1.Items[4].Bttn.Click             += Bttn_Click;
        }