I’m looking for some knowledge/assistance and some dumbing down to help me grasp this concept.
Ok, first off I am trying to make a Audio Amplifier controlled by a touch screen. I started off writing the Touch Screen Code with the Arduino, and its working good. Then I found an built the Amp, Step 2 done. Now, also where I am stuck, getting the Arduino to control the audio. I have looked around allot and decided to go with a digital Pot. Specifically Maxim’s DS1868. This is a 10k Pot with 255 positions that uses 3Wire Interface. Wiper positions are set by two 8-bit values, these values are written to a 17-bit I/O shift register.
My problem is I can’t seam to wrap my head around how to use the Shift Register.
Ok, I get that there is a RESET a CLOCK and a DATA pin. I also get that the RESET pin needs to go HIGH to start accepting data, and that each bit will only be accepted on the rising edge of the clock, when the data is done transmitting drop the RESET pin LOW again.
But here is where I get lost.
There is a Stack bit that needs to be sent first, basically saying weather it is using more then one chip, then send the first 8 bits for Pot1 then the next 8 bits for Pot0. I can’t figure out how to do this in Arduino.
Like how do I know if the data is being sent on the raising or falling edge of the clock pulse?
There is the SIP Libary and the Shiftout() command. I’m thinking I will have more luck with Shiftout() but I am to confused as to how it all works.
What should the data at each step look like? Most of the examples steps through 255 positions but if I want to jump by 5’s or have preset positions to jump to what are those values? Binary 000000101 ?? hex?
for (int j = 0; j < 256; j++) {
digitalWrite(ResetPin, HIGH);
shiftOut(dataPin, clockPin, MSBFIRST, j);
digitalWrite(ResetPin, LOW);
}
Like for j can I just put in 256 or 125 and it will know to send out the 8Bit equivalent?
And would this only cover the one pot? do I need to add the Stack Bit and other pot like so?
digitalWrite(ResetPin, HIGH);
shiftOut(dataPin, clockPin, MSBFIRST, 1);
for (int j = 0; j < 256; j++) {
shiftOut(dataPin, clockPin, MSBFIRST, j);
}
for (int j = 0; j < 256; j++) {
shiftOut(dataPin, clockPin, MSBFIRST, j);
}
digitalWrite(ResetPin, LOW);
Or am I WAY OFF THE WALL here?? ANY HELP, would be GREATLY appreciated. Thanks
The project I am trying to recreate here is from this website
But the code is written in a compiler language, so it might as well be Japanese. (By the way I don’t know Japanese or C)