| 1 | = SetDIOCounter = |
| 2 | Setup a DIO counter. |
| 3 | |
| 4 | {{{ |
| 5 | int SetDIOCounter(int dev, int input, DIOSetReg reg, int value, int wait); |
| 6 | }}} |
| 7 | |
| 8 | == Parameters == |
| 9 | |
| 10 | * dev - 0 = main board input, DIO option card number |
| 11 | * input number - option card inputs limited to two counters, any of inputs 1 - 7, and input 8 may be used. |
| 12 | * reg - register to set |
| 13 | * value - value to set |
| 14 | * wait - WAIT_ACK to wait for acknoledgement or NO_WAIT_ACK for no wait. |
| 15 | |
| 16 | == Return Value == |
| 17 | |
| 18 | * Returns the result - OK success |
| 19 | |
| 20 | == Remarks == |
| 21 | |
| 22 | The main board or option card must already be opened by calling OpenMnBd first. |
| 23 | |
| 24 | == Examples == |
| 25 | |
| 26 | |
| 27 | {{{ |
| 28 | int bd = 1; |
| 29 | int inp = 8; |
| 30 | |
| 31 | SetDIOCounter(bd, inp, dioSetCount, 0, WAIT_ACK); |
| 32 | SetDIOCounter(bd, inp, dioSetPrescaler, 1, WAIT_ACK); |
| 33 | SetDIOCounter(bd, inp, dioSetCountUp, 0, WAIT_ACK); |
| 34 | SetDIOCounter(bd, inp, dioSetCountLowToHigh, 0, WAIT_ACK); |
| 35 | SetDIOCounter(bd, inp, dioEnableCounter, 0, WAIT_ACK); |
| 36 | |
| 37 | struct mnbd_multi_rep_counters_struct counters; |
| 38 | memset(&counters, 0, sizeof(counters)); |
| 39 | |
| 40 | counters.cnt1_bd = bd; |
| 41 | counters.cnt1_input = inp; |
| 42 | |
| 43 | if(StartRepeatMulti(100, counters) == OK) |
| 44 | DisplayText(0, 0, "Wt, I/O, cnt 10 times per second"); |
| 45 | }}} |
| 46 | |
| 47 | == See Also == |
| 48 | |
| 49 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/Weight/StartRepeatMulti StartRepeatMulti] |
| 50 | * [http://tech.825spectrum.com/trac/wiki/Docs/Prog/Manual/ApplicationLibraries/lib825ev/IO/GetDIOCounter GetDIOCounter] |