i build the Parallel to Serial Shifting-In with a CD4021BE from the arduino tutorials http://www.arduino.cc/en/Tutorial/ShiftIn.
now the question is: "can i call an interrupt on pressing a button?"
i want to make a keyboard out of this to control the frequency of a sinewave,
but the response time is to slow, so evertime a state change takes place (button released/pressed) i want to interrupt the main program and set a new tuning word to look up in the dds table.
when i put the datapin on pin 3 an write
attachInterrupt(1, doPiano, CHANGE); // pin 3
then the function doPiano is called continuos, without pressing or releasing any button.
any suggestions?
i would appreciate.
How slow, the SR read should happen in < a couple of uS I would think.
when i put the datapin on pin 3 an write
attachInterrupt(1, doPiano, CHANGE); // pin 3
This will interrupt on the first change of state coming out of the SR's data pin and probably all others. The interrupt(s) will occur part way through the shiftin function so your doPiano function will be called at the wrong time and with dodgy data.
then the function doPiano is called continuos, without pressing or releasing any button.
Can't explain that, unless the code is dicking with the data pin there should be no changes if no keys are pressed.
Also have a look at the MAX6818, that will give you an interrupt on any input change of state.