Example #1
0
        private void Button_addPDO_Click(object sender, EventArgs e)
        {
            UInt16 trycreateindex = 0;

            if (this.isTXPDO)
            {
                trycreateindex = 0x1800;
            }
            else
            {
                trycreateindex = 0x1400;
            }

            for (UInt16 cob = trycreateindex; cob < (UInt16)(trycreateindex + 0x0200); cob++)
            {
                if (!eds.ods.ContainsKey(cob))
                {
                    trycreateindex = cob;
                    break;
                }
            }

            if (!eds.CreatePDO(!this.isTXPDO, trycreateindex))
            {
                MessageBox.Show(String.Format("Failed to create PDO at index {0}", trycreateindex));
            }
            else
            {
                eds.UpdatePDOcount();
                doUpdatePDOs();
                doUpdateOD();
            }

            eds.Dirty = true;
        }