News:

SMF - Just Installed!

Main Menu

multiplex signal to replace S6

Started by shabbee, March 08, 2016, 10:19:47 PM

Previous topic - Next topic

shabbee

I'm trying to edit the code so that I can have 12 pots instead of the 6 with the little slide switch to change between functions. The hardware is no problem but as I'm just learning Arduino I'm struggling with the software.

I've tried to add the blink sketch lines to the miniatmegatron.ino so that D1 is sending out a clock pulse to control the multiplexing hardware. As you probably guessed this doesn't work as I get no signal when I scope D1. I'm convinced D1 is possibly defined elsewhere in the miniatmegatron code thus cancelling my setup and loop function, but I have no clue. I've also noted that the slower the clock frequency this interrupts the running of the miniatmegatron, my conclusion is that my approach is very lame and crude.

If I upload the blink example sketch alone, I can see the clock function working ok.

I need some pointers as my only option is to build a clock generator but I'm hopeful to the skilled programmer this would be an easy  piece of code to write. I'm also mindful that I may need some additional debounce for when then pots are read but one step at a time!

Thanks for reading and any help

paulsoulsby

So the 2 things you need are this:
http://marcusjenkins.com/wp-content/uploads/2014/06/ARDUINO_V2.png
and
http://soulsbysynths.com/wp-content/uploads/2015/08/miniAtmegatron-PCB.pdf

D0 and D1 are routed to the USB port on the Uno.  This is then used to read/write MIDI data.  To use these pins, you'll need to remove all the UART (serial) code in MinHardware.cpp

It may be better to sacrifice a different D pin.  Poss the play button on SW1 (D2). 
The way the code is structured  is:

MinHardware.cpp - just deals with the interface, it has no knowledge of the audio engine
MinEngine.cpp - just deals with the audio engine, it has no knowledge of the interface
Min.cpp - stitches the engine and the interface together

I would edit Min.cpp:
goto Min::hardwareSwitchChanged(unsigned char switch_, unsigned char newValue)
then
if(switch_==MinHardware::SW_PLAY)
use this to determine the state of the multiplexer
and change this code to alter:  engine_.getPatchPtr()->setFunctionValue(***whatever engine function you want to tweak here***);

hope this helps!

Paul


shabbee

Hi Paul,


Thanks for the reply, I may not have explained my plan clearly so want to add a bit more detail.

Assuming the filter Q and cutoff as an example, The wiper of each pot is connected to its own 4066 analog switch, I'm looking to control each 4066 switch from D2 (currently play switch) as suggested but with an inverted clock to one to enable switching between the 2 pot wipers.The outputs of both 4066 switches will be connected to the same A input of the UNO. I will use the same clock signal to replace the slide switch signal emulating either state of the switch. I'm hoping this approach will minimise the amount of code I need to change as I'm very new to that side.

I'm guessing/hoping I only need to make changes to MinHardware?

Does this correspond with your post above?

Thanks

paulsoulsby

Ah yeah, I think you're right.  Because the spec of the synth isn't changing you should only have to edit the Hardware class.   
So the edit to the library will changing the D2 from an input to an output - change:
bitClear(DDRD,PIND2);  //play to bitSet(DDRD,PIND2);  //play)
then remove D2's interrupt:  bitSet(PCMSK2,PCINT18);
then remove all trace of switch_[0] throughout the library.
then add your own code to control D2 in void MinHardware::pollAnlControls(unsigned char ticksPassed)

That should work!