This is a multi-part message in MIME format. ------=_NextPart_000_0009_01C07BF2.5C097680 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit I suggested using a 4017 to select pots. Circuit and s/w attached seem to work OK. Nitpicking welcomed Tinkering I didn't have time for - using RC on 4017 Clock/Reset to use one less PIC pin (R between Clock and Reset, C to 0V from Reset, use long pulse to reset, short pulse to clock) and fine tune routines/calls/delays to optimise speed. Data in the EEPROM could be sent out serially Components shown will give 8-bit resolution. Highest reading for a 10k pot was e9h (233d). There's a small overhead to remove from this (about a 4-5 count). Bigger pots will need a correspondingly smaller cap, eg 100k pot = 1n5 pot. Not decreasing the cap would allow finer resolution, but it would take longer to go through the pots The code for a 4051 MUX would be quite similar, even a little simpler. The 4017 way can be expanded indefinitely using the same 2-wire system, whereas a 4051 system would need extra chips to direct the ABC selector lines This should be useable in a robotics system as cheap or convenient (possibly more so than encoders) position sensing for something like a grasp or turntable ================================================== rs equ porta.0 ;o/p 4017 reset pot equ porta.1 ;i/p o/p measure/discharge cap clk equ porta.2 ;o/p 4017 clock led equ porta.3 ;o/p finished go equ porta.4 ;i/p start orgdata ram idx rb ;current position ptn rb ;pot number to be done count1 rb count2 rb count3 rb entry movlw 12h ;...i ooio tris porta bcf clk bcf rs bcf led bsf go movlw 00h ;oooo oooo tris portb clrf portb movlw 80h option movlw 10h ;store pot readings in RAM at address 10h up movwf fsr clrf idx movlw 01h ;start with pot#1 movwf ptn bcf led wait btfsc go ;wait for PB release on a.4 goto wait call msdelay waitl btfss go goto waitl setpot call reset ;discharge cap, select pot measure btfsc pot ;bump measure while pot pin is low goto store ;else jump out and store count incf count1,f goto measure store call cstore ;store reading incf ptn,f ;next pot# movlw 04h ;limit = (number of pots)+1 xorwf ptn,w btfss zero goto setpot ;next pot goto stop ;all done cstore movf count1,w ;put count value in RAM movwf indf call stee ;and/or EEPROM (also from 10h up) incf fsr,f return reset bsf rs ;reset 4017, q0=1, no pot selected nop nop bcf rs movlw 10h ;a.2 = o/p, discharge cap tris porta bcf pot call msdelay clrf idx nextpot bsf clk nop nop bcf clk incf idx,f ;current 4017 position movf ptn,w ;pot to be measured xorwf idx,w btfss zero goto nextpot ;loop until 4017=pot# movlw 12h tris porta clrf count1 return ;to measure new pot msdelay movlw 0f6h ;delay about 1 millisecond @ 10MHz movwf count1 clrf count2 inc incfsz count2,f goto inc incfsz count1,f goto inc return stee movf fsr,w ;store pot reading in EEPROM movwf eeadr movf count1,w movwf eedata call write return write bsf rp0 bsf wren movlw 55h movwf eecon2 movlw 0aah movwf eecon2 bsf wr wrend btfss eeif goto wrend bcf eeif bcf wren bcf rp0 return stop bsf led ;LED on, finished wrst goto wrst ;wait for RESET to go again ------=_NextPart_000_0009_01C07BF2.5C097680 Content-Type: image/gif; name="4017pots.gif" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="4017pots.gif" R0lGODlhNwHLAPcAAAAAAP////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////ywAAAAANwHLAAAI/gADCBxI sKDBgwgTKlzIsKHDhxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlxQByJxJs6bN mzgBMLwJs6fPn0AL6hQ5dKfMoEiTKj1ZFGTThU+XSp1KdWLUjlcRZq3KtavXrRrBCvVKtmxXsRjR DlRrtq3blGwrxo37tq5dj3StPsz7Mqffv4ADCx5MuLBhwQJnJj4aQHFjxo4dN+QbkS5llpfvalY4 d2TezHA3iw671zNE0KFHq5ZbmmhrrqhX1y3aWStj1pMPNo3cV7bvnWtfj01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wJYvvInm5tFaOdpaNrS/mVbypq1sTlhuN9QFHbVPS71PP6G60D1mHWPf aerbvprJWZ4zmVt7SFT716CRvrVq+Vrr7Rk30b9+c7CFXUItS/lWB05ysjFcOWZLmrrUuam1tzwz 1Bw619tW1hl3ncp8hlu5hVYTn4Fs7nPDi9OLcu2S181jd5sozovFtwj3jOvc2jt71CS17ELKb3Iv +9+a9mrRXtvmfh8c4bpmmose7cJ2Q5yJbtYxvcl9cZSEc6nTnou2/jv+E2B2GcUNB/bISU6rgMMu kxW2sbJZ3tz3sLjkraY5P23+8HX3XOfdzBCJ3Qn0k9kc5RHTc9GNLrGVT1PpS/d4mj8ddalv69lV n9CxvWvmrHtGrz9/aNhpbtixQ73TjH6s1/sZMrN3/UJQZazbpU3gWYNKzWfXXIZEuvaY4Ahu7CWw PVcV99RFu+8uU7fURRykrU+u8A9G/EWPdPO7//XNlIT8miVfr8PvcO/d1fzJOY9JmcNwzJjXL97N OndpAxz0BSd9fb2ZvsrGGZ2y/y9tI5573bv17b0Hc3t5H3xADx/NxRf+7jee/Hn/nvjNj/2ggR/9 KS+f+dUH9/FhTp196XMd+t0fJ56JHn6j5MTHWC//lsuk/ryqvT6tbz925Q8Xzw+b/iSNP/7ht3+h 6r//JddrADiABOgx71eACJiAm/V/CtiADviAQhUQAAA7 ------=_NextPart_000_0009_01C07BF2.5C097680-- -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body