Arduino 1-Wire Device Libraries
The Dallas-Maxim DS2423 contains RAM as well as a pair of digital counters. It is the counters that are of particular interest in that they can count switch closures without tying up a micro-controller or taking a chance that any given switch closure might be missed. This library supports only the counting function of the chip. See the Dallas-Maxim DS2423 datasheet for more information about this device and its capabilities.
To use this library in a sketch,
- Include the OneWire.h and DS2423.h header files.
- Call the ds2423.begin() method in the setup() method of the sketch. The library supports using counter A, counter B or both counters.
- To read the current value of a counter call the ds2423.update() method.
- Call the ds2423.isError() method to determine if the update succeeded.
- And, if successful, call the ds2423.getCount(counter) method to return the counter value.
Like the other device libraries in this collection, there is also a getTimestamp() method that returns the value of the Arduino millis() function at the time the ds2423.update() method was called. This can be useful to compute elapsed milliseconds between subsequent updates.
Example 1 demonstrates the use of this library to continuously read a DS2423 counter and print its value.
Example 2 demonstrates the use of this library to continuously read both DS2423 counters and print the values.