I've been wondering what I can do with Arduino that would really be 'useful' : to me and came up with the idea of reading 2 or 3 chinese digital vernier calipers and displaying the info, a cheap DRO if you will.
Would it be possible to decode the protocol implemented by these calipers with an Arduino? Link to protocol definition to follow ..
Yes there should be no problem implementing that. As it is slow just follow the clock bits up and down and shift in the data bits when you need to.
Have fun.
I am fairly new to arduino could you perhaps just drop a few keywords for the implementation path of something like this, maybe a similar example elsewhere? :-?
This is a form of SPI interface. The built in SPI system for the Arduino uses 8 bit words where as this uses 24 bit words. Therefore you need what is called a "bit banging" solution. That is one you code by reading the bits as they go up and down.
Many SPI systems use 16 bit long words (two bytes) this uses 24 bits (three bytes).
Based on the SPCR setup stated there and from what I know from the protocol description mine should look like this:
MPIE=0,
SPE=1 (spi on)
DORD=1 (Least Significant Bit first),
MSTR=1 (master),
CPOL=0 (clock idle when low),
CPHA=1 (samples MOSI on falling edge),
SPR1=0 & SPR0=0 (500kHz)
I'm not too sure about SPE and the clock speed though, the protocol spec mentions 'nominal frequency of 90 kHz' and an update speed of 50Hz?
Also in the forum post mentioned above is a function called read_register16 which just calls spi_transfer twice and uses UBLB to make a word. Is there a function I can use to combine three bytes?
BTW, thanks to Arduino and Grumpy_Mike I actually read and understood an oscilloscope readout for the first time .. I think
Is there a function I can use to combine three bytes
Suppose you had three bytes b1, b2, b3 (with b3 being the most significant) and you need to combine them into a long int (they won't go into an int). Simply shift them up and combine them with an OR operation:-
P.S.
I forgot to say that it looks like their is only 1.5v signal output from these devices so you will need a transistor on the input to boost them up to 5V before you feed them in. Remember if you use only a single transistor you will get an inverted signal so you will have to take that into account in your software.