Reading Digital caliper with Arduino
#64
This defines which edge of the clock we use ...

Code:
#define CLOCK_TRANSITION FALLING

I put it in as a #define at the top of the code so it would be easy to change to RISING if that is what eventually shows up after the level shifting, etc.

The transition is used to determine the time component and it also defines when the data line is read.

Based on the time component ... i.e. how long has it been since we last saw a clock transition we care about ... we determine if it is a start of data stream and therefore need to set everything up to capture the first data bit and the rest of the stream or we thing the transition is noise or we think the transition indicates it is the next next bit of data or we are not exactly sure why it showed up and we need to forget about this stream and hope the next stream goes better.

Hopefully it is "edge direction agnostic". All we should need to do is look at the lines with a scope, define ...

Code:
#define CLOCK_PIN 2                              // The pin associated with the clock pulse
#define CLOCK_TRANSITION FALLING                 // What will happen on the clock pulse that will want us to read the data pin
#define CLOCK_TERMINATION INPUT_PULLUP           // What kind of termination do we want on the clock pin

#define DATA_PIN 3                               // The pin associated with the data
#define DATA_TERMINATION INPUT_PULLUP            // What kind of termination do we want on the data pin

#define CLOCK_NOISE_FILTER 1000                  // How many microseconds long must the clock be stable for it to be consider 'good'
#define MINIMUM_BURST_START_PULSE_WIDTH 100000   // At a minimum, how many microseconds long is the pulse at the beginning of a burst
#define MAXIMUM_TIME_FOR_A_SINGLE_BURST 100000   // The maximum amount of time that a burst should take before considered invalid

#define DATA_BITS_IN_A_VALID_BURST 24            // The number of data bits that are expected in a complete burst of data

... and hopefully have some binary output to look at.

Or that was what the [non-existent] requirements document said.
Reply
Thanks given by:


Messages In This Thread
RE: Reading Digital caliper with Arduino - by EdK - 03-07-2015, 03:37 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-07-2015, 09:07 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-08-2015, 05:26 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-09-2015, 11:45 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-09-2015, 11:51 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-09-2015, 12:24 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-09-2015, 01:47 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-10-2015, 05:24 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-10-2015, 11:14 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-10-2015, 04:44 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-10-2015, 05:18 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-10-2015, 06:19 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-11-2015, 04:13 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-11-2015, 04:23 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-11-2015, 08:13 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-11-2015, 08:25 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-12-2015, 05:00 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-12-2015, 06:09 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-14-2015, 09:41 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-18-2015, 05:50 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-19-2015, 04:11 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-19-2015, 04:42 PM
RE: Reading Digital caliper with Arduino - by arvidj - 03-20-2015, 04:44 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-20-2015, 05:31 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-20-2015, 06:33 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-20-2015, 07:28 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-20-2015, 08:38 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-20-2015, 09:24 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-21-2015, 09:07 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-21-2015, 11:08 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-21-2015, 03:29 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-21-2015, 06:21 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-24-2015, 11:14 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-24-2015, 02:15 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-26-2015, 03:36 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-26-2015, 05:33 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-26-2015, 05:52 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-26-2015, 06:14 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-27-2015, 06:46 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-27-2015, 07:38 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 08:39 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 09:42 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 09:23 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 09:28 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 09:35 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 11:11 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 11:48 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 12:03 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 12:47 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-28-2015, 01:33 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-29-2015, 02:31 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-29-2015, 03:49 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-29-2015, 05:35 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-29-2015, 06:18 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-30-2015, 06:33 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-30-2015, 06:45 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-30-2015, 06:14 PM
RE: Reading Digital caliper with Arduino - by EdK - 03-31-2015, 05:48 AM
RE: Reading Digital caliper with Arduino - by EdK - 03-31-2015, 07:10 PM
RE: Reading Digital caliper with Arduino - by EdK - 04-09-2015, 08:43 PM
RE: Reading Digital caliper with Arduino - by EdK - 04-28-2015, 08:42 AM
RE: Reading Digital caliper with Arduino - by EdK - 08-28-2015, 11:07 AM
RE: Reading Digital caliper with Arduino - by EdK - 08-28-2015, 02:41 PM
RE: Reading Digital caliper with Arduino - by EdK - 09-04-2015, 01:21 PM
RE: Reading Digital caliper with Arduino - by EdK - 09-27-2017, 03:39 PM
RE: Reading Digital caliper with Arduino - by EdK - 09-28-2017, 03:51 PM



Users browsing this thread: 1 Guest(s)