wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/IO/SetDIOCounter

SetDIOCounter

Setup a DIO counter.

int SetDIOCounter(int dev, int input, DIOSetReg reg, int value, int wait);

Parameters

  • dev - 0 = main board input, DIO option card number
  • input number - option card inputs limited to two counters, any of inputs 1 - 7, and input 8 may be used.
  • reg - register to set
  • value - value to set
  • wait - WAIT_ACK to wait for acknoledgement or NO_WAIT_ACK for no wait.

Return Value

  • Returns the result - OK success

Remarks

The main board or option card must already be opened by calling OpenMnBd first.

Examples

int bd = 1;
int inp = 8;

SetDIOCounter(bd, inp, dioSetCount, 0, WAIT_ACK);
SetDIOCounter(bd, inp, dioSetPrescaler, 1, WAIT_ACK);
SetDIOCounter(bd, inp, dioSetCountUp, 0, WAIT_ACK);
SetDIOCounter(bd, inp, dioSetCountLowToHigh, 0, WAIT_ACK);
SetDIOCounter(bd, inp, dioEnableCounter, 0, WAIT_ACK);

struct mnbd_multi_rep_counters_struct counters;
memset(&counters, 0, sizeof(counters));

counters.cnt1_bd = bd;
counters.cnt1_input = inp;

if(StartRepeatMulti(100, counters) == OK)
    DisplayText(0, 0, "Wt, I/O, cnt 10 times per second");

See Also

Last modified 7 years ago Last modified on 04/19/18 06:57:49
Note: See TracWiki for help on using the wiki.