Jump to content
  • 0

USB-1808 question




There is a program that uses PCI-QUAD04, and I want to use two encoder channels of USB-1808 to make the program work the same way.

PCI-QUAD04 and USB-1808 use different functions and RegNum are different, so I want to get help on how to change them.


err = cbC7266Config(vSet.cntboard, ch, X1_QUAD, NORMAL_MODE, BINARY_ENCODING,
                             RESET_CTR, DISABLED, CARRY_BORROW, DISABLED);

-> cbCConfigScan(helpme)

err = cbCLoad32(vSet.cntboard, COUNT1+ch, 0);       // start value
err = cbCLoad32(vSet.cntboard, PRESET1+ch, 100000);  //  end value
err = cbCLoad32(vSet.cntboard, PRESCALER1+ch, 1);       // filter 0 ~ 255

-> cbCLoad32(vSet.cntboard, LOADREG0(correct?) +ch, 0);
    cbCLoad32(vSet.cntboard, MINLIMITREG0(?)       +ch, 100000);
    cbCLoad32(vSet.cntboard, MAXLIMITREG0(?)      +ch, 1);



Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0


The encoder channels are 2 & 3. The following configures counter 2 to count from 1 to 100000. When the count hits 100000, it will roll over to 1.

If you have Z reset, add ENCODER_MODE_CLEAR_ON_Z_ON to the mode parameter. Ensure that RetVal is zero after each call. 

int BoardNum = 0;

int COUNTER = 2;

int RetVal = 0;

RetVal = cbCConfigScan( BoardNum,
                        ENCODER + ENCODER_MODE_X1,

RetVal = cbCLoad32(BoardNum,MINLIMITREG2, 1);

RetVal = cbCLoad32(BoardNum,MAXLIMITREG2, 100000);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...