Issue with GlobalCounterReset

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with GlobalCounterReset
#1
I have been trying to work with global counters and ran into an issue where resetting the counter caused an "Index exceeds array bounds" error message.

Attempting to fix it, I tried to run the example code from the documentation, but still ended up with the same error message.  The highlighted row is the piece of code that breaks when I attempt to use it.

Link to Documentation:
https://sites.google.com/site/bpoddocume...unter_beta

Code:
    sma = NewStateMachine();

    sma = SetGlobalCounter(sma, 1, 'BNC1High', 5);

    sma = AddState(sma, 'Name', 'State1', ... % BNC1High Events in this state are not counted because the count will be reset.
        'Timer', 1,...
        'StateChangeConditions', {'Tup', 'State2'},...
        'OutputActions', {});

    sma = AddState(sma, 'Name', 'State2', ... % This state resets the global counter.
        'Timer', 0,...
        'StateChangeConditions', {'Tup', 'State3'},...
        'OutputActions', {'GlobalCounterReset', 1});

    sma = AddState(sma, 'Name', 'State3', ...
        'Timer', 0,...
        'StateChangeConditions', {'Port1In', 'State4', 'GlobalCounter1_End', 'exit'},...
        'OutputActions', {});

    sma = AddState(sma, 'Name', 'State4', ...
        'Timer', 0,...
        'StateChangeConditions', {'Port1Out', 'State3', 'GlobalCounter1_End', 'exit'},...
        'OutputActions', {});

If anyone knows what the problem is, I would appreciate any suggestions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)