Jump to content

mick1221

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by mick1221

  1. private const string DeviceName = "QUAD08"; private const int Axis = 0; static void Main(string[] args) { MccBoard board = new MccBoard(0); Console.WriteLine(board.BoardName); CounterMode mode = CounterMode.Encoder | CounterMode.EncoderModeX2 | CounterMode.EncoderModeBit32 | CounterMode.EncoderModeModuloNOn; ErrorInfo err = board.CConfigScan(Axis, mode, CounterDebounceTime.Debounce500ns, CounterDebounceMode.TriggerAfterStable, CounterEdgeDetection.RisingEdge , CounterTickSize.Tick208pt3ns, 0); Console.WriteLine(err.Message); for (int i = 0; i < 500000000; i++) { Console.WriteLine("Reseting..."); board.CLoad32(CounterRegister.LoadReg0, 4000); Thread.Sleep(100); err = board.CIn32(Axis, out int test); Console.WriteLine(test.ToString()); Thread.Sleep(100); err = board.CIn32(Axis, out test); Console.WriteLine(test.ToString()); Thread.Sleep(100); err = board.CIn32(Axis, out test); Console.WriteLine(test.ToString());; } } Here is the test code I'm running, I have not set the max limit Register, only the Load Register... It Outputs this Counting up to 4000 then resetting when I set the load Regsiter When I Remover the CounterMode.EncoderModeModuloNOn The CLoad32() Has no effect on the value read from the encoder Is setting the counter not allowed when using Countermode.Encoder?
  2. Final Question hopefully, CLoad32() using one of the CounterRegister.Load registers doesn't set the register to anything. If I set CounterMode.EncoderModeModuloNOn it treats The CounterRegister.Load registers like it's the CounterRegister.MaxLimit register and it will roll over on that value. Am I missing anything? There doesn't seem to be anything in the documentation relating to this
  3. That still doesn't answer the question of which mode is quadrature, or are they both? If they both are how do I tell the direction ( Clockwise or Counter Clockwise) when using CounterMode.Encoder
  4. For the Quad08 Is Quadrature Mode set through CounterMode.Encoder or CounterMode.Totalize? I have an encoder wheel attached to a rail car for measuring distance and I need to know when it's moving forward or backward. Everything I have read tells me that CounterMode.Encoder is the method for using Quadrature but I have only been able to get the card to count both up and down when using CounterMode.Totalize specifically CounterMode mode = CounterMode.Bit32 | CounterMode.Totalize | CounterMode.ModuloNOn | CounterMode.UpDownOn; When using Counter.Encoder I'm using CounterMode mode = CounterMode.Encoder | CounterMode.EncoderModeX1 | CounterMode.EncoderModeBit32; I did read the Edge Detection section in the docs but it seems to describe the methods for the UL and not the UL for .Net, I am using C#. Any insight is appreciated, Thanks.
  5. I'm currently reading from a Quad08 card into a c# program using the Universal library. Here is how I'm configuring the counter I'm using CounterMode mode = CounterMode.Bit32 | CounterMode.RangeLimitOn | CounterMode.Rollover; ErrorInfo err = board.CConfigScan(Axis, mode, CounterDebounceTime.DebounceNone, CounterDebounceMode.TriggerBeforeStable, CounterEdgeDetection.RisingEdge, CounterTickSize.Tick20ns, 0); My understanding is that when setting a max limit it is supposed to roll over to the minimum limit when reached. When I set the max Limit it gets to the max limit and stops. I had Assumed that the minimum limit would default to 0. Unfortunately when it gets to 1000 it stops err = board.CLoad32(CounterRegister.MaxLimitReg0, 1000); So I tried setting the minimum limit to 0 err = board.CLoad32(CounterRegister.MinLimitReg0, 0); However when I do this I receive the error Bad counter arg passed to cbCLoad. Is there something I'm missing here to be able to set and roll over at the limits?
  6. I have 2 pieces of software that read from the PCI-QUAD04 Software A is legacy and is being phased out Software B is has it's own features but will eventually include software A's features Currently we'd like to be able to run both at the same time. When I run software A or B on their own everything is fine When I run them both at the same time Software B will see the encoder count Jump around instead of steadily climb. do the Drivers provided by MCC only support one piece of software at a time like a serial port? note: I know the Quad04 isn't made anymore this is a bug we are trying to fix before adding support for the USB-Quad08 which is our replacement
×
×
  • Create New...