/* Copyright(c) 1998-2009 by Robotic Systems Integration, Inc. All rights reserved. This software contains proprietary and confidential information of Robotic Systems Integration, Inc. (RSI) and its suppliers. Except as may be set forth in the license agreement under which this software is supplied, disclosure, reproduction, or use with controls other than those provided by RSI or suppliers for RSI is strictly prohibited without the prior express written consent of Robotic Systems Integration. Warning! This is a sample program to assist in the integration of your motion controller with your application. It may not contain all of the logic and safety features that your application requires. For any questions regarding this sample code please visit www.roboticsys.com. ================================================================================== */ using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; using RSI.RapidCode.SynqNet.dotNET; using RSI.RapidCode.SynqNet.dotNET.Enums; namespace SampleApplications { [TestFixture] public class SliceCounter { const int SLICE_NODE = 0; //node number as discovered on SynqNet network const int SEGMENT_NUMBER = 0; // segment (slice) number as found on Slice I/O const int PARAMTER_NUMBER = 0; // parameter to set the counter mode const string PARAMETER_VALUE = "1"; // required value to setup "1 Pulse Mode" [Test] public void Main() { try { //RapidCode Objects MotionController controller = MotionController.Create(); IO slice = controller.IOGet(SLICE_NODE); Console.WriteLine(slice.SqNode.TypeGet().ToString()); // configure to count in "1 Pulse Mode" slice.SegmentParameterSet(SEGMENT_NUMBER, PARAMTER_NUMBER, 1, PARAMETER_VALUE); // reads 24 bit counter value while (true) { Console.WriteLine(slice.DigitalInGet(0, 24).ToString()); controller.OS.Sleep(200); } } catch (Exception e) { Console.WriteLine(e.Message); } } } }