i'm trying to build a SSI-interace with the Arduino Board, i.e. one has a clock signal and synchorn to that signal one gets the data out of the device one is interfaceing.The problem ist that the frequency of the Clock signal has to be above 100kHz, and during one tick one has to read the signal from a I/O-port.After trying the "normal" Code, which means at last a "for Loop": - "togle the clock"- "read the port" - "togle the clock" and again....seems not quick engouh. Then i started to look at Forums, for the inbuild timer routine and code samples, finding thishttp://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1143470863/4 unluckiely the mantioned snipped is not compileable becaus of the missing function "timerAttach" which is located in "timer.h". Including this header results in another error ("avrlibtypes.h: 70: error: expected unqualified-id before numeric constant"; which has some thing in common with typedefs...).....

So what I like to know is if it is possible to realise an Interface described above, with the usage of inbuild timers?Or is the arduino Board not quick enough for this kind of task?

luckily i'm really trying to make an SSI-Interface (which means Serial Synchron Interface), which is much simpler than an SPI one. I don't have to pass an address to the device, just toggle the clock and get the (synchron comming) output. I guess i have to make my homework now and digg me thru to code, to get the relevant parts.....

finaly i got it working. Give me a few days to clean up my code. I'll then post it here.

To describe the project: The SSI is needed to get the absolute position of an rotary absolute enconder, then transfere the Position to MAX/MSP/Jitter, and play a video synchron to the read Position of the encoder.Right now i'm only hassling with the HF-electronics, but in principle it works right now.

Hi Kuk,its form Kübler GmbH and its a rotary absolute multiturn encoder 5862 series, see http://www.kuebler.com for details. Its not cheap but its relieable industial optical encoder. You don't have to take this one because the SSI is used as an industrial standart, so have a look at other companies for the best encoder that fits your needs.

* SSI: - SSI-Clock TicTac must be equal or less 10µs. - 26 Clock TicTac are needed for the whole Position consiting of a 25 Bit word, the first TicTac is needed for he status bit, which enconde the status of the device, (0) for not clear. - After the the 26 TicTacs a puse of max. 80µs is needed for a new Position to be available.

* This Program: - emulates a SSI with the Arduino Ports 12 (clock) and 11 (data). - transform the gray encoded Position to binary encoded Position - send the Position to Max/MSP/Jitter via USB

* Electronics needed: - 2 RS485 line drivers (e.g. sn75176) are needed, if you want to save ports and clean up the ignals. - for the start-sequence and the reset a uln 2803 could used (not implemented yet). - a few resitors for cleaning the singnals.... */

/*functionprototypes*/void getPosition(); // saves the status bit and the 25 position bits in the grayArray, read from the register as PINB. The only time-critical process.void condensePosition(); // condenses the recieved Byte (PINB) in grayArray to the only intersting bit (PB3) in PINB.void transformPosition(); // transforms the 25 postion bits to binary and saves them in binaryArrayvoid sendPosition(); // sends the binarayArray - enclosed in '255' - via USB to Max/MSP/Jitter//void resetRoutine(); // external Reset of the encoder, to select rotary direction and define zero Position.

/*Main*/void loop(){ if(PINB & (1<<PB3)) { getPosition(); } // delay for device to become ready again if(Serial.available()) // check if a request form max is there. To avoid a buffer overrun, MAX/MSP/Jitter is playing PingPong with the arduino Board, if max send any via sierial, arduino responds with the newest Position { while(Serial.available() > 0) // reads all the data send to the arduino board { dummy = Serial.read(); } // and finaly sends the Position condensePosition(); transformPosition(); sendPosition(); } delay(2);}