Data exchange, function (KL1501 only)
Automatic setting of the outputs for defined counter values
The feature register R32 can be used to activate an internal function for setting the outputs.
- Up/down counter or gated counter:
- When the counter reaches the value 0x80000000, the output A0 is set (feature bit 5) or reset (feature bit 6).
- In the event of a counter overflow, the output is reset.
- Output A1 is set in parallel with bit 15 (0x8000).
- Two counters active:
- When the counter reaches the value 0x8000, the output (A1, A0) is set (feature bit 4,6) or reset (feature bit 5,7).
- In the event of a counter overflow, the output is reset.
Example:
Feature register = 0x02AC i.e:
Two counters are active.
The counter is set via the positive edge of the CNT_SET bit.
The control bit CNT_INH deals with setting of the second counter.
A glass is to be filled with 200 ml of beer.
1 pulse corresponds to 0.01 ml => 1 glass corresponds to 20000 pulses (0x31E0 = 0x8000-20000).
First counter | Control byte | Status byte | Output data | Output A0 | Function |
---|---|---|---|---|---|
0x0000 | 0x00 | 0x00 | 0x0000 | Low | Power-on reset |
0x0000 | 0x22 | 0x00 | 0x31E0 | Low | Counter is set, |
0x31Ex | 0x02 | 0x28 | any | High | Beer is flowing. |
… |
|
|
|
|
|
0x8000 | 0x02 | 0x00 | any | Low | The first glass is full. |
… |
|
|
|
|
|
0x8000 | 0x22 | 0x00 | 0x31E0 | Low | Counter is set, |
0x31Ex | 0x02 | 0x28 | any | High | Beer is flowing. |
… |
|
|
|
|
|
0x8000 | 0x02 | 0x00 | any | Low | The second glass is full. |
… |
|
|
|
|
|