Be warned that the 74HC597 has a maximum rise and fall time of 139 nsec/volt (at 5V). So you can't make C2 bigger than about 30 pF without violating this spec. On Sun, Sep 13, 2015 at 8:32 PM, Isaac Marino Bavaresco wrote: > The attached schematic shows the principle. Please note that this > circuit is not tested, it is a modified version of a circuit I use with > the 74HC595, that does the same function for outputs. > > If you can afford to use three I/O pins, parts T1, R1, R2 and C2 are not > used. Control using signals SCK, MISO and LOAD. > If you use just two I/Os, signal "LOAD" is not connected to the MCU. > > Operation: > > When idle, keep signal "SCK" high. > > 1) Before each transaction, change "SCK" to low. That will load the > input latches with fresh data. > 2) Return "SCK" to high, waiting the R2*C2 RC constant. That will make > the 597 transfer the input latches to the shift-register. Data on IN1-8 > will appear at "MISO". > 3) In a rapid succession, read the bit at "MISO" and pulse low and high > again, doing that as many times as needed to read all bits in the serial > chain. > > After the R2*C2 time delay, new data will be loaded into the shift-regist= er. > > If you do several transfers in a rapid succession, you do not need to do > step (1) again. Always wait the RC constant between transactions. > > Isaac > > > > Em 13/09/2015 22:06, Vartan Haghverdi escreveu: >> Isaac how does that work? Would the uC switch between each extended pin >> many times per second? >> On Sep 13, 2015 8:24 PM, "Isaac Marino Bavaresco" < >> isaacbavaresco@yahoo.com.br> wrote: >> >>> The OP could use the 74HC597 to serially expand the number of inputs. >>> Usually it would need three I/O pins, but with a clever trick it is >>> possible to use just two. >>> It is possible to expand the input pins to virtually any number, in >>> multiples of eight. >>> >>> Isaac >>> >>> >>> Em 13/09/2015 20:13, IVP escreveu: >>>>>> Thanks. I am only looking for 5 bit accuracy. >>>>>> >>>>> That might be asking a bit much - not from the PIC, that's easy >>>>> enough - from the person. >>>>> 5 bits =3D 32 position values. Typical pot has about 270 degrees >>>>> of travel. 270 / 32 =3D ~8.4 degrees. >>>> My nephew has a guitar effects box, and one of the selectors >>>> looks rather like that on a DMM, but is actually a pot with 10 >>>> detent positions between fully CCW and fully CW, giving 12 >>>> distinct settings altogether. The knob is spring-loaded against >>>> a ring of bumps in the case plastic >>>> >>>> Maybe you can make something with a slotted disc and a ball >>>> bearing and a spring or other bits and pieces. 32 values is going >>>> to be tricky though. >>>> >>>> 10-turn pot ? With vernier ? >>>> >>>> Analogue TVs had slide pots with a screw thread for tuning >>>> >>>> Two thumbwheel or BCD switches, 10s and 1s ? >>>> >>>> How about an optical encoder, bought or made. You could >>>> print a scale on a transparency. Perhaps 5 rings to represent >>>> 5 bits in a simple binary code, or 1 ring of stripes to generate >>>> pulses to count >>>> >>>> There are many variations of digital calipers, protractors and >>>> rulers you could take apart for a very fine position sensor >>>> >>>> Pehaps hack an optical mouse. Draw a circle on the screen >>>> now with it. Can you potentiometerise that ? >>>> >>>> All options have drawbacks - accuracy, precision, consumption, >>>> reset on power-down, cost, fiddliness etc >>>> >>>> Joe >>>> >>>> >>>> ----- >>>> No virus found in this message. >>>> Checked by AVG - www.avg.com >>>> Version: 2015.0.6125 / Virus Database: 4419/10635 - Release Date: >>> 09/13/15 >>> >>> >>> -- >>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> > > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 Regards, Mark markrages@gmail --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .