03-19-2015, 04:42 PM
(03-19-2015, 04:39 PM)Vinny Wrote: what did you use for a regulator?
A Texas Instruments TPS76316.
http://www.digikey.com/product-detail/en...-ND/477328
Ed
Reading Digital caliper with Arduino
|
03-19-2015, 04:42 PM
(03-19-2015, 04:39 PM)Vinny Wrote: what did you use for a regulator? A Texas Instruments TPS76316. http://www.digikey.com/product-detail/en...-ND/477328 Ed
03-20-2015, 12:03 PM
My contribution is a start to the code ...
The .h file Code: // Only modify this file to include and the .cpp file Code: // Do not remove the include below Submitted as a place to start the discussion, not as 'the last word'. Arvid
03-20-2015, 04:25 PM
Are you reading on the falling edge of the clock pulse or just using it for the start notification?
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 ... and hopefully have some binary output to look at. Or that was what the [non-existent] requirements document said.
03-20-2015, 05:22 PM
I saw the #define which is why I asked. The Sparber document V1.3 says on the bottom of page 5 that the data is valid on the rising edge of the clock pulse. The data can very well have already changed by the falling edge.
03-20-2015, 05:31 PM
(03-20-2015, 05:22 PM)Vinny Wrote: I saw the #define which is why I asked. The Sparber document V1.3 says on the bottom of page 5 that the data is valid on the rising edge of the clock pulse. The data can very well have already changed by the falling edge. Which clock edge to look at is going to be dependent on the interface circuitry. I should have the cables done shortly and will set up the o-silly-scope to look at the signals. Ed
03-20-2015, 05:36 PM
On a more positive note regarding my scope, it looks like two fets are bad (shorted) so I have some on order. Grabbed the one from the basement and no video. That appears to be the fuse for the HV supply so provided something didn't blow up there I should have that one back working tonite.
03-20-2015, 06:33 PM
Arvid,
I'm a bit rusty on C programming since it's been a while. I'm getting this error when I try to "Verify" the project. sketch_mar20a.ino:2:25: fatal error: scaleReader.h: No such file or directory The .h file is in the project directory so I'm not sure why it's not finding it. Does the #include "scaleReader.h" need to have the complete path to the project directory? I didn't think it would need it but like I said, I'm a bit rusty with C programming. Ed
03-20-2015, 07:28 PM
Never mind Arvid, I got it to compile.
Ed
03-20-2015, 07:31 PM
Ed,
Short answer ... Under the Build Process headline here ... http://www.arduino.cc/en/Hacking/BuildProcess ... it says: Quote:The include path includes the sketch's directory, the target directory (<ARDUINO>/hardware/core/<CORE>/) and the avr include directory (<ARDUINO>/hardware/tools/avr/avr/include/), as well as any library directories (in <ARDUINO>/hardware/libraries/) which contain a header file which is included by the main sketch file. ... which seems to suggest that if the .h file is in the sketch's directory it should find it. The slightly longer answer ... I use Eclipse C++ with and Arduino plugin [C++] rather than the Arduino IDE [IDE]. Some of the differences are: The .cpp file [C++] is called .ino [IDE], but I am guessing you simply copied the code into a new [IDE] project so you automatically got the .ino file. The [IDE] does some things 'automatically' so it is 'easier' to use. In doing so it hides some stuff that a normal C developer [which I am not] would normally need to do. What you might want to do is forget about the .h file. The [IDE] will silently add the ... Code: #include "Arduino.h" ... line to your .ino file ... i.e. you will never see it but when the project is built "it is there". That takes care of part of what is in the .h file. The other line that is important ... Code: #include <util/atomic.h> ... you can put at the very top of your .ino file and remove these lines ... Code: // Do not remove the include below ... as they are only required when using the "less automatic" [C++] system that I am using. Other than the include differences the two development environments should be compatible so we can share all of the code below the #include directives. Certainly not a big issue. Arvid Thanks given by: EdK
|
« Next Oldest | Next Newest »
|