Beispiel #1
0
        public EmergencyFrm(libCanopenSimple.libCanopenSimple lco)
        {
            _lco = lco;

            InitializeComponent();
            init();
        }
Beispiel #2
0
        public PDOForm(libCanopenSimple.libCanopenSimple lco)
        {
            this.lco = lco;

            InitializeComponent();
            pdoValue1.sendpdo += PdoValue_sendpdo;
            pdoValue2.sendpdo += PdoValue_sendpdo;
            pdoValue3.sendpdo += PdoValue_sendpdo;
            pdoValue4.sendpdo += PdoValue_sendpdo;
        }
Beispiel #3
0
        /// <summary>
        /// Construct a new SDO object
        /// </summary>
        /// <param name="can">a libCanopenSimple object that will give access to the hardware</param>
        /// <param name="node">The note to talk to (UInt16)</param>
        /// <param name="index">The index in the object dictionary to access</param>
        /// <param name="subindex">The subindex in the object dictionary to access</param>
        /// <param name="dir">Direction of transfer</param>
        /// <param name="completedcallback">Optional, completed callback (or null if not required)</param>
        /// <param name="databuffer">A byte array of data to be transfered to or from if more than 4 bytes</param>
        public SDO(libCanopenSimple can, byte node, UInt16 index, byte subindex, direction dir, Action <SDO> completedcallback, byte[] databuffer)
        {
            this.can               = can;
            this.index             = index;
            this.subindex          = subindex;
            this.node              = node;
            this.dir               = dir;
            this.completedcallback = completedcallback;
            this.databuffer        = databuffer;

            finishedevent = new ManualResetEvent(false);
            state         = SDO_STATE.SDO_INIT;
            dbglevel      = can.dbglevel;
        }
Beispiel #4
0
        /// <summary>
        /// A simple test that uses libcanopensimple to open a can device, set up some COB specific callbacks
        /// then send a bus reset all nodes NMT command after 5 seconds
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Change these to load correct driver and connect it to correct bus
            string   driver  = "can_usb_win32";
            string   bus     = "COM4";
            BUSSPEED bitrate = BUSSPEED.BUS_500Kbit;

            try
            {
                libCanopenSimple.libCanopenSimple lco = new libCanopenSimple.libCanopenSimple();

                lco.nmtevent   += Lco_nmtevent;
                lco.nmtecevent += Lco_nmtecevent;
                lco.pdoevent   += Lco_pdoevent;
                lco.sdoevent   += Lco_sdoevent;

                lco.open(4, bitrate, driver);

                Console.WriteLine("listening for any traffic");

                Console.WriteLine("Sending NMT reset all nodes in 5 seconds");

                System.Threading.Thread.Sleep(5000);

                lco.NMT_ResetNode(); //reset all

                Console.WriteLine("Press any key to exit test..");

                while (!Console.KeyAvailable)
                {
                }

                lco.close();
            }
            catch (Exception e)
            {
                Console.WriteLine("That did not work out, exception message was \n" + e.ToString());
            }
        }
Beispiel #5
0
 public SDOEditor(libCanopenSimple.libCanopenSimple lco)
 {
     this.lco = lco;
     InitializeComponent();
 }
Beispiel #6
0
 public IOForm(libCanopenSimple.libCanopenSimple lco)
 {
     _lco = lco;
     InitializeComponent();
 }
 public ResetEEPROM(libCanopenSimple.libCanopenSimple lco)
 {
     this.lco = lco;
     InitializeComponent();
 }
Beispiel #8
0
 public Flasher(libCanopenSimple.libCanopenSimple lco)
 {
     this.lco = lco;
     InitializeComponent();
     this.FormClosing += Flasher_FormClosing;
 }
Beispiel #9
0
 public NMTFrm(libCanopenSimple.libCanopenSimple lco)
 {
     this.lco = lco;
     InitializeComponent();
 }
Beispiel #10
0
 public void setlco(libCanopenSimple.libCanopenSimple lco)
 {
     this._lco = lco;
 }