Hysteresis, CV, and the TAPLFO

Started by swinginguitar, September 30, 2011, 06:54:20 PM

Previous topic - Next topic

swinginguitar

Been studying teh ASM code for most of the day. Just came across this:

; Apply hysteresis to the CV by checking if ADC_VALUE and ADC_VALUE+4 give the same result
   addlw   D'4'      ; Add 4 to the AD value in W
   andlw   B'11100000'   ; Get the top 3 bits (Result 1)
   movwf   TEMP
   movf   ADC_VALUE, w
   andlw   B'11100000'   ; Get the top 3 bits (Result 2)
   xorwf   TEMP, w      ; Test if the two results are the same
   btfss   ZEROBIT      ; If zero, they're the same
   goto   MainLoop   ; Not the same, no need to change multiplier

Could someone explain to me what it's doing, why, and how?


On another note concerning the TAPLFO code, in the main loop when he's checking the various CV inputs, it appears that only one CV per main loop is evaluated (rather than checking each one in turn per main loop) since after each one is checked there's a GOTO MAIN_LOOP instruction. Is the reason for this performance, best practice, or....? COuld you not poll each of teh CV inputs each iteration of the main loop? (perhaps it would make the PIC sluggish to do that many ADC's each time through?)


slacker

#1
It stops the wave shape and multiplier jumping back and forth between setting as you turn the pot or due to noise or inaccuracies in the ADC. The ADC is 8 bit so you get values between 0 and 255, the wave shape is 3 bit (8 values) so the top 3 bits are used like this.

0 - 31 = wave shape 1 top 3 bits = 000
32 - 63 = wave shape 2 top 3 bits = 001
64 - 95 = wave shape 3 top 3 bits = 010

and so on. Even if you leave the pot in one position the ADC won't always give you the same value it will fluctuate a bit, so if you set the pot near the change from wave shape 1 to wave shape 2 you might get 30 one time and 33 the next so the wave shape will jump back and forth between the two settings. The code stops this happening like this,
30 + 4 = 34 so the top 3 bits are different so the code skips back to the main loop, leaving the wave shape set to what ever it was before. 33 + 4 = 37 so the top 3 bits are the same so it will change to wave shape 2, if it then reads 30 again next time it will ignore it and stay on shape 2. It basically creates gaps between the transitions where nothing happens.

swinginguitar

#2
Quote from: slacker on October 02, 2011, 12:37:04 PM
30 + 4 = 34 so the top 3 bits are different so the code skips back to the main loop, leaving the wave shape set to what ever it was before. 33 + 4 = 37 so the top 3 bits are the same so it will change to wave shape 2, if it then reads 30 again next time it will ignore it and stay on shape 2. It basically creates gaps between the transitions where nothing happens.

I was clear up until this paragraph - is it sorta double checking that the CV has stayed in the same range?


EDIT: nevermind...got it!

swinginguitar

Any suggestions for visual feedback on the next multiplier button? would be nifty to have a series of LEDs  that light for each one in turn (quarter/8th/etc), but since there aren't nearly enough pins I assume this can't be done?

nexekho

You could do that easily with three pins and a 4017.  Run one LED off each output of the 4017 all going to ground via a MOSFET you can use to turn the output on and off with a current limiting resistor too.  Pins are clock, light current LED and reset counter.

I don't know if this is a right way to do it?  I'm gonna experiment at Christmas with two 4017s and 11 MOSFETs to make a 20x5 LED matrix display for my Arduino.
I made the transistor angry.

nexekho

Here's a schematic of how I'd do it (adjust that resistor to match)
http://www.falstad.com/circuit/#%24+1+5.0E-6+10.20027730826997+50+5.0+50%0Af+160+192+160+144+0+1.5%0Ag+144+144+128+144+0%0Ar+176+144+240+144+0+120.0%0A162+240+208+240+144+1+2.1024259+1.0+0.0+0.0%0A162+272+208+272+144+1+2.1024259+1.0+0.0+0.0%0A162+304+208+304+144+1+2.1024259+1.0+0.0+0.0%0A162+336+208+336+144+1+2.1024259+1.0+0.0+0.0%0A162+368+208+368+144+1+2.1024259+1.0+0.0+0.0%0A162+400+208+400+144+1+2.1024259+1.0+0.0+0.0%0A162+432+208+432+144+1+2.1024259+1.0+0.0+0.0%0A162+464+208+464+144+1+2.1024259+1.0+0.0+0.0%0A162+496+208+496+144+1+2.1024259+1.0+0.0+0.0%0A162+528+208+528+144+1+2.1024259+1.0+0.0+0.0%0Aw+528+144+496+144+0%0Aw+496+144+464+144+0%0Aw+464+144+432+144+0%0Aw+432+144+400+144+0%0Aw+400+144+368+144+0%0Aw+368+144+336+144+0%0Aw+336+144+304+144+0%0Aw+304+144+272+144+0%0Aw+272+144+240+144+0%0A163+208+240+288+240+0+10+5.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0+0.0%0AI+528+368+528+304+0+0.5%0AL+528+368+528+400+0+0+false+5.0+0.0%0AL+208+272+208+400+0+0+false+5.0+0.0%0AL+160+192+160+400+0+1+false+5.0+0.0%0A
This is what I want to build at Christmas (sorry it's a mess :p)
http://www.falstad.com/circuit/#%24+1+5.0E-6+0.08824969025845955+50+5.0+50%0A163+192+832+288+832+0+10+0.0+0.0+0.0+5.0+0.0+0.0+0.0+0.0+0.0+0.0%0A162+224+480+240+464+1+2.1024259+1.0+0.0+0.0%0A162+256+480+272+464+1+2.1024259+1.0+0.0+0.0%0A162+288+480+304+464+1+2.1024259+1.0+0.0+0.0%0A162+320+480+336+464+1+2.1024259+1.0+0.0+0.0%0A162+352+480+368+464+1+2.1024259+1.0+0.0+0.0%0A162+512+480+528+464+1+2.1024259+1.0+0.0+0.0%0A162+480+480+496+464+1+2.1024259+1.0+0.0+0.0%0A162+448+480+464+464+1+2.1024259+1.0+0.0+0.0%0A162+416+480+432+464+1+2.1024259+1.0+0.0+0.0%0A162+384+480+400+464+1+2.1024259+1.0+0.0+0.0%0A162+704+480+720+464+1+2.1024259+1.0+0.0+0.0%0A162+736+480+752+464+1+2.1024259+1.0+0.0+0.0%0A162+768+480+784+464+1+2.1024259+1.0+0.0+0.0%0A162+800+480+816+464+1+2.1024259+1.0+0.0+0.0%0A162+832+480+848+464+1+2.1024259+1.0+0.0+0.0%0A162+672+480+688+464+1+2.1024259+1.0+0.0+0.0%0A162+640+480+656+464+1+2.1024259+1.0+0.0+0.0%0A162+608+480+624+464+1+2.1024259+1.0+0.0+0.0%0A162+576+480+592+464+1+2.1024259+1.0+0.0+0.0%0A162+544+480+560+464+1+2.1024259+1.0+0.0+0.0%0Aw+560+464+592+464+0%0Aw+592+464+624+464+0%0Aw+624+464+656+464+0%0Aw+656+464+688+464+0%0Aw+688+464+720+464+0%0Aw+720+464+752+464+0%0Aw+752+464+784+464+0%0Aw+784+464+816+464+0%0Aw+816+464+848+464+0%0Aw+528+464+496+464+0%0Aw+496+464+464+464+0%0Aw+464+464+432+464+0%0Aw+432+464+400+464+0%0Aw+400+464+368+464+0%0Aw+368+464+336+464+0%0Aw+336+464+304+464+0%0Aw+304+464+272+464+0%0Aw+272+464+240+464+0%0Aw+528+464+544+448+0%0Aw+544+448+880+448+0%0Af+832+528+848+528+0+1.5%0Aw+544+400+944+400+0%0Aw+528+416+544+400+0%0Aw+272+416+240+416+0%0Aw+304+416+272+416+0%0Aw+336+416+304+416+0%0Aw+368+416+336+416+0%0Aw+400+416+368+416+0%0Aw+432+416+400+416+0%0Aw+464+416+432+416+0%0Aw+496+416+464+416+0%0Aw+528+416+496+416+0%0Aw+816+416+848+416+0%0Aw+784+416+816+416+0%0Aw+752+416+784+416+0%0Aw+720+416+752+416+0%0Aw+688+416+720+416+0%0Aw+656+416+688+416+0%0Aw+624+416+656+416+0%0Aw+592+416+624+416+0%0Aw+560+416+592+416+0%0A162+544+432+560+416+1+2.1024259+1.0+0.0+0.0%0A162+576+432+592+416+1+2.1024259+1.0+0.0+0.0%0A162+608+432+624+416+1+2.1024259+1.0+0.0+0.0%0A162+640+432+656+416+1+2.1024259+1.0+0.0+0.0%0A162+672+432+688+416+1+2.1024259+1.0+0.0+0.0%0A162+832+432+848+416+1+2.1024259+1.0+0.0+0.0%0A162+800+432+816+416+1+2.1024259+1.0+0.0+0.0%0A162+768+432+784+416+1+2.1024259+1.0+0.0+0.0%0A162+736+432+752+416+1+2.1024259+1.0+0.0+0.0%0A162+704+432+720+416+1+2.1024259+1.0+0.0+0.0%0A162+384+432+400+416+1+2.1024259+1.0+0.0+0.0%0A162+416+432+432+416+1+2.1024259+1.0+0.0+0.0%0A162+448+432+464+416+1+2.1024259+1.0+0.0+0.0%0A162+480+432+496+416+1+2.1024259+1.0+0.0+0.0%0A162+512+432+528+416+1+2.1024259+1.0+0.0+0.0%0A162+352+432+368+416+1+2.1024259+1.0+0.0+0.0%0A162+320+432+336+416+1+2.1024259+1.0+0.0+0.0%0A162+288+432+304+416+1+2.1024259+1.0+0.0+0.0%0A162+256+432+272+416+1+2.1024259+1.0+0.0+0.0%0A162+224+432+240+416+1+2.1024259+1.0+0.0+0.0%0Aw+224+480+224+432+0%0Aw+256+432+256+480+0%0Aw+288+480+288+432+0%0Aw+320+432+320+480+0%0Aw+352+480+352+432+0%0Aw+384+432+384+480+0%0Aw+416+480+416+432+0%0Aw+448+432+448+480+0%0Aw+480+480+480+432+0%0Aw+512+432+512+480+0%0Aw+544+480+544+432+0%0Aw+576+432+576+480+0%0Aw+608+480+608+432+0%0Aw+640+432+640+480+0%0Aw+672+480+672+432+0%0Aw+704+432+704+480+0%0Aw+736+480+736+432+0%0Aw+768+432+768+480+0%0Aw+800+480+800+432+0%0Aw+832+480+832+432+0%0Aw+832+432+832+384+0%0Aw+800+432+800+384+0%0Aw+768+384+768+432+0%0Aw+736+432+736+384+0%0Aw+704+384+704+432+0%0Aw+672+432+672+384+0%0Aw+640+384+640+432+0%0Aw+608+432+608+384+0%0Aw+576+384+576+432+0%0Aw+544+432+544+384+0%0Aw+512+384+512+432+0%0Aw+480+432+480+384+0%0Aw+448+384+448+432+0%0Aw+416+432+416+384+0%0Aw+384+384+384+432+0%0Aw+352+432+352+384+0%0Aw+320+384+320+432+0%0Aw+288+432+288+384+0%0Aw+256+384+256+432+0%0Aw+224+432+224+384+0%0A162+224+384+240+368+1+2.1024259+1.0+0.0+0.0%0A162+256+384+272+368+1+2.1024259+1.0+0.0+0.0%0A162+288+384+304+368+1+2.1024259+1.0+0.0+0.0%0A162+320+384+336+368+1+2.1024259+1.0+0.0+0.0%0A162+352+384+368+368+1+2.1024259+1.0+0.0+0.0%0A162+512+384+528+368+1+2.1024259+1.0+0.0+0.0%0A162+480+384+496+368+1+2.1024259+1.0+0.0+0.0%0A162+448+384+464+368+1+2.1024259+1.0+0.0+0.0%0A162+416+384+432+368+1+2.1024259+1.0+0.0+0.0%0A162+384+384+400+368+1+2.1024259+1.0+0.0+0.0%0A162+704+384+720+368+1+2.1024259+1.0+0.0+0.0%0A162+736+384+752+368+1+2.1024259+1.0+0.0+0.0%0A162+768+384+784+368+1+2.1024259+1.0+0.0+0.0%0A162+800+384+816+368+1+2.1024259+1.0+0.0+0.0%0A162+832+384+848+368+1+2.1024259+1.0+0.0+0.0%0A162+672+384+688+368+1+2.1024259+1.0+0.0+0.0%0A162+640+384+656+368+1+2.1024259+1.0+0.0+0.0%0A162+608+384+624+368+1+2.1024259+1.0+0.0+0.0%0A162+576+384+592+368+1+2.1024259+1.0+0.0+0.0%0A162+544+384+560+368+1+2.1024259+1.0+0.0+0.0%0Aw+560+368+592+368+0%0Aw+592+368+624+368+0%0Aw+624+368+656+368+0%0Aw+656+368+688+368+0%0Aw+688+368+720+368+0%0Aw+720+368+752+368+0%0Aw+752+368+784+368+0%0Aw+784+368+816+368+0%0Aw+816+368+848+368+0%0Aw+528+368+496+368+0%0Aw+496+368+464+368+0%0Aw+464+368+432+368+0%0Aw+432+368+400+368+0%0Aw+400+368+368+368+0%0Aw+368+368+336+368+0%0Aw+336+368+304+368+0%0Aw+304+368+272+368+0%0Aw+272+368+240+368+0%0Aw+528+368+544+352+0%0Aw+544+352+1008+352+0%0Aw+832+384+832+336+0%0Aw+800+384+800+336+0%0Aw+768+336+768+384+0%0Aw+736+384+736+336+0%0Aw+704+336+704+384+0%0Aw+672+384+672+336+0%0Aw+640+336+640+384+0%0Aw+608+384+608+336+0%0Aw+576+336+576+384+0%0Aw+544+384+544+336+0%0Aw+512+336+512+384+0%0Aw+480+384+480+336+0%0Aw+448+336+448+384+0%0Aw+416+384+416+336+0%0Aw+384+336+384+384+0%0Aw+352+384+352+336+0%0Aw+320+336+320+384+0%0Aw+288+384+288+336+0%0Aw+256+336+256+384+0%0Aw+224+384+224+336+0%0A162+224+336+240+320+1+2.1024259+1.0+0.0+0.0%0A162+256+336+272+320+1+2.1024259+1.0+0.0+0.0%0A162+288+336+304+320+1+2.1024259+1.0+0.0+0.0%0A162+320+336+336+320+1+2.1024259+1.0+0.0+0.0%0A162+352+336+368+320+1+2.1024259+1.0+0.0+0.0%0A162+512+336+528+320+1+2.1024259+1.0+0.0+0.0%0A162+480+336+496+320+1+2.1024259+1.0+0.0+0.0%0A162+448+336+464+320+1+2.1024259+1.0+0.0+0.0%0A162+416+336+432+320+1+2.1024259+1.0+0.0+0.0%0A162+384+336+400+320+1+2.1024259+1.0+0.0+0.0%0A162+704+336+720+320+1+2.1024259+1.0+0.0+0.0%0A162+736+336+752+320+1+2.1024259+1.0+0.0+0.0%0A162+768+336+784+320+1+2.1024259+1.0+0.0+0.0%0A162+800+336+816+320+1+2.1024259+1.0+0.0+0.0%0A162+832+336+848+320+1+2.1024259+1.0+0.0+0.0%0A162+672+336+688+320+1+2.1024259+1.0+0.0+0.0%0A162+640+336+656+320+1+2.1024259+1.0+0.0+0.0%0A162+608+336+624+320+1+2.1024259+1.0+0.0+0.0%0A162+576+336+592+320+1+2.1024259+1.0+0.0+0.0%0A162+544+336+560+320+1+2.1024259+1.0+0.0+0.0%0Aw+560+320+592+320+0%0Aw+592+320+624+320+0%0Aw+624+320+656+320+0%0Aw+656+320+688+320+0%0Aw+688+320+720+320+0%0Aw+720+320+752+320+0%0Aw+752+320+784+320+0%0Aw+784+320+816+320+0%0Aw+816+320+848+320+0%0Aw+528+320+496+320+0%0Aw+496+320+464+320+0%0Aw+464+320+432+320+0%0Aw+432+320+400+320+0%0Aw+400+320+368+320+0%0Aw+368+320+336+320+0%0Aw+336+320+304+320+0%0Aw+304+320+272+320+0%0Aw+272+320+240+320+0%0Aw+528+320+544+304+0%0Aw+544+304+1072+304+0%0Aw+832+336+832+288+0%0Aw+800+336+800+288+0%0Aw+768+288+768+336+0%0Aw+736+336+736+288+0%0Aw+704+288+704+336+0%0Aw+672+336+672+288+0%0Aw+640+288+640+336+0%0Aw+608+336+608+288+0%0Aw+576+288+576+336+0%0Aw+544+336+544+288+0%0Aw+512+288+512+336+0%0Aw+480+336+480+288+0%0Aw+448+288+448+336+0%0Aw+416+336+416+288+0%0Aw+384+288+384+336+0%0Aw+352+336+352+288+0%0Aw+320+288+320+336+0%0Aw+288+336+288+288+0%0Aw+256+288+256+336+0%0Aw+224+336+224+288+0%0A162+224+288+240+272+1+2.1024259+1.0+0.0+0.0%0A162+256+288+272+272+1+2.1024259+1.0+0.0+0.0%0A162+288+288+304+272+1+2.1024259+1.0+0.0+0.0%0A162+320+288+336+272+1+2.1024259+1.0+0.0+0.0%0A162+352+288+368+272+1+2.1024259+1.0+0.0+0.0%0A162+512+288+528+272+1+2.1024259+1.0+0.0+0.0%0A162+480+288+496+272+1+2.1024259+1.0+0.0+0.0%0A162+448+288+464+272+1+2.1024259+1.0+0.0+0.0%0A162+416+288+432+272+1+2.1024259+1.0+0.0+0.0%0A162+384+288+400+272+1+2.1024259+1.0+0.0+0.0%0A162+704+288+720+272+1+2.1024259+1.0+0.0+0.0%0A162+736+288+752+272+1+2.1024259+1.0+0.0+0.0%0A162+768+288+784+272+1+2.1024259+1.0+0.0+0.0%0A162+800+288+816+272+1+2.1024259+1.0+0.0+0.0%0A162+832+288+848+272+1+2.1024259+1.0+0.0+0.0%0A162+672+288+688+272+1+2.1024259+1.0+0.0+0.0%0A162+640+288+656+272+1+2.1024259+1.0+0.0+0.0%0A162+608+288+624+272+1+2.1024259+1.0+0.0+0.0%0A162+576+288+592+272+1+2.1024259+1.0+0.0+0.0%0A162+544+288+560+272+1+2.1024259+1.0+0.0+0.0%0Aw+560+272+592+272+0%0Aw+592+272+624+272+0%0Aw+624+272+656+272+0%0Aw+656+272+688+272+0%0Aw+688+272+720+272+0%0Aw+720+272+752+272+0%0Aw+752+272+784+272+0%0Aw+784+272+816+272+0%0Aw+816+272+848+272+0%0Aw+528+272+496+272+0%0Aw+496+272+464+272+0%0Aw+464+272+432+272+0%0Aw+432+272+400+272+0%0Aw+400+272+368+272+0%0Aw+368+272+336+272+0%0Aw+336+272+304+272+0%0Aw+304+272+272+272+0%0Aw+272+272+240+272+0%0Aw+528+272+544+256+0%0Aw+544+256+1136+256+0%0Af+864+528+880+528+0+1.5%0Af+896+528+912+528+0+1.5%0Af+928+528+944+528+0+1.5%0Af+960+528+976+528+0+1.5%0Af+1120+528+1136+528+0+1.5%0Af+1088+528+1104+528+0+1.5%0Af+1056+528+1072+528+0+1.5%0Af+1024+528+1040+528+0+1.5%0Af+992+528+1008+528+0+1.5%0Aw+848+416+912+416+0%0Aw+848+368+976+368+0%0Aw+848+320+1040+320+0%0Aw+1104+272+848+272+0%0A163+800+672+912+672+0+10+0.0+0.0+0.0+5.0+0.0+0.0+0.0+0.0+0.0+0.0%0Aw+1136+544+1104+544+0%0Aw+1104+544+1072+544+0%0Aw+1072+544+1040+544+0%0Aw+1040+544+1008+544+0%0Aw+1008+544+976+544+0%0Aw+976+544+944+544+0%0Aw+944+544+912+544+0%0Aw+912+544+880+544+0%0Aw+880+544+848+544+0%0Ag+1248+608+1264+608+0%0AL+1120+736+1120+768+0+1+false+5.0+0.0%0AL+512+896+512+928+0+1+false+5.0+0.0%0AR+192+864+192+928+1+2+24999.999999999996+2.5+2.5+0.0+0.5%0Aw+768+704+800+704+0%0Aw+848+512+848+464+0%0Aw+880+512+880+448+0%0Aw+912+416+912+512+0%0Aw+944+512+944+400+0%0Aw+976+368+976+512+0%0Aw+1008+512+1008+352+0%0Aw+1040+320+1040+512+0%0Aw+1072+512+1072+304+0%0Aw+1104+272+1104+512+0%0Aw+1136+512+1136+256+0%0Aw+224+288+224+208+0%0Aw+224+208+544+208+0%0Aw+544+208+544+288+0%0Aw+256+288+256+192+0%0Aw+256+192+576+192+0%0Aw+576+192+576+288+0%0Aw+288+288+288+176+0%0Aw+288+176+608+176+0%0Aw+608+176+608+288+0%0Aw+320+288+320+160+0%0Aw+320+160+640+160+0%0Aw+640+160+640+288+0%0Aw+352+288+352+144+0%0Aw+352+144+672+144+0%0Aw+672+144+672+288+0%0Aw+384+288+384+128+0%0Aw+384+128+704+128+0%0Aw+704+128+704+288+0%0Aw+736+288+736+112+0%0Aw+736+112+416+112+0%0Aw+416+112+416+288+0%0Aw+448+288+448+96+0%0Aw+448+96+768+96+0%0Aw+768+96+768+288+0%0Aw+480+288+480+80+0%0Aw+480+80+800+80+0%0Aw+800+80+800+288+0%0Aw+832+288+832+64+0%0Aw+832+64+512+64+0%0Aw+512+64+512+288+0%0Aw+256+800+224+480+0%0Aw+256+480+288+800+0%0Aw+320+800+288+480+0%0Aw+320+480+352+800+0%0Aw+384+800+352+480+0%0Aw+384+480+416+800+0%0Aw+448+800+416+480+0%0Aw+480+800+448+480+0%0Aw+512+800+480+480+0%0Aw+512+64+192+64+0%0Aw+192+64+192+480+0%0Aw+192+480+224+800+0%0Aw+864+528+864+640+0%0Aw+768+704+544+480+0%0Aw+832+528+896+640+0%0Aw+928+640+928+528+0%0Aw+896+528+960+640+0%0Aw+992+640+992+528+0%0Aw+960+528+1024+640+0%0Aw+1056+640+1056+528+0%0Aw+1024+528+1088+640+0%0Aw+1120+640+1120+528+0%0Aw+1088+528+832+640+0%0Af+1200+592+1248+592+0+1.5%0Aw+1248+576+1248+544+0%0Aw+1248+544+1136+544+0%0AL+1200+592+1200+816+0+1+false+5.0+0.0%0A
I made the transistor angry.

swinginguitar

Would it work with 1 pin and an HEF4017BP like so:

Pic pin to 4017 clock input, 4017 reset tied back to the 4017 pin above where I want to reset (eg if i want 4 steps, tie the 5th pin to reset so it rolls itself over)

??

nexekho

You want a manual reset line so if the Arduino resets you pull it high and the LED array syncs back up with the Arduino.  Otherwise you'd have to totally cut power to the whole circuit after programming.  You also need that transistor on the end otherwise you'd just be able to control the rate at which it lit EVERY led - it blocks the path to ground so you can switch the LEDs off.

But yes, you could tie an output to reset as far as I know.  You can't tie the pins together (it can cause problems) but if you want to lose some of the outputs, it can be done.
I made the transistor angry.

swinginguitar

Quote from: nexekho on October 13, 2011, 12:07:26 PM
You also need that transistor on the end otherwise you'd just be able to control the rate at which it lit EVERY led - it blocks the path to ground so you can switch the LEDs off.

Please explain...

without the transistor, each LED would light in turn at some fixed rate?

nexekho

Quote from: swinginguitar on October 13, 2011, 12:17:01 PM
Quote from: nexekho on October 13, 2011, 12:07:26 PM
You also need that transistor on the end otherwise you'd just be able to control the rate at which it lit EVERY led - it blocks the path to ground so you can switch the LEDs off.

Please explain...

without the transistor, each LED would light in turn at some fixed rate?

Right, the LED will light if the 4017 gives out power and that power can get to ground via the LED.  The transistor's control input is hooked up to one of the outputs of the controller so it can block the path the ground.  I'm not 100% on this as I'm new to electronics and have no formal training in it but it seems to work on a simulator.  You will also need an appropriate current limiting resistor for the LEDs.

4017->LED->ground LIT!
4017->LED not lit
4017->open MOSFET->ground LIT!
4017->closed MOSFET->ground not lit

Again, I'm not 100% on this, it's probably better to ask someone on here with formal electronics experience.  Or possibly use a standard shift register.  There is an Arduino tutorial on using a shift register called ShiftOut.
I made the transistor angry.

swinginguitar

Quote from: nexekho on October 13, 2011, 12:07:26 PM
You want a manual reset line so if the Arduino resets you pull it high and the LED array syncs back up with the Arduino. 

Would i be able to connect 2 sources to the rest (IOW, the PIC pin and the Nth pin on the 4017) so that I could reset it if either goes high? Or do they conflinct with each other with respect to 0v/5v?

Thanks for all the info....

nexekho

I would assume you can but I don't know.  Never tried any of this and am not an expert.  Get a second opinion on everything!

Also, stick to existing shift register controlled dot matrix designs when possible.  Less to go wrong then.  Lots on Instructables.
I made the transistor angry.

slacker

#12
Quote from: swinginguitar on October 13, 2011, 05:18:03 PM
Would i be able to connect 2 sources to the rest (IOW, the PIC pin and the Nth pin on the 4017)

Yeah you can do this using Mickey Mouse logic connect a resistor from the reset pin to ground and then connect your sources to the reset pin using diodes, cathode to the reset pin anode to the source. This way if either of the sources goes high it will reset the CD4017 but the diodes isolate the sources from each other.

I think to do what you want you need 2 pins one to clock the CD4017 and one as a reset, you might get away without the reset, but at some point the CD4017 would probably get out of sync with the PIC. I would sacrifice the tempo LED and clock output pins and use those.
The pin to clock the CD4017 would simply have to send out a pulse when the next multiplier was pressed and the reset would reset the CD4017 when needed. Using these you can step through the multipliers and by resetting and then quickly clocking to the right place you can make the LED follow the multiplier CV pot.

swinginguitar

Thanks, gents!

I can definitely scrounge some pins off there - i won't be using several of the features of the chip and can re-direct those pins as outputs.

swinginguitar

Quote from: slacker on October 14, 2011, 12:37:55 PM
Using these you can step through the multipliers and by resetting and then quickly clocking to the right place you can make the LED follow the multiplier CV pot.

to quickly clock the 4017, obviously I need a series of quick pulses. Do you typically set the pin high, delay some small amount, then pulse it again? How long of a delay is needed typically for the IC to recognize a new pulse has fired?

slacker

I don't know off hand, I think the CD4017 works at speeds up to 5Mhz or so. Check the datasheet that will tell you how long a pulse you need.

ElectricDruid

I like the idea, gents. Use a 4017 to give a visual indication of multiplier - nice.

It seems like it should be fairly straightforward the way you describe. Reset the 4017 to zero so you know where you are, then clock out enough pulses to get to the correct multiplier. This will be fast enough that poor old dopey humans will probably never even see what's happening. It takes us 20mS to spot *anything* which is hours in PIC-time.

Good luck with it. It's great to see these TAPLFO projects rolling!

Tom