Author |
Message |
beep
Joined: May 05, 2013 Posts: 105 Location: Germany
|
Posted: Thu Apr 12, 2018 10:52 am Post subject:
Assembler Code, help needed (ATTiny85 midi to CV&GATE) Subject description: "Mitxela MidiMonotron" need advice how to modify the code for the CV out to stay. |
|
|
Hello,
on my search for the ultimatively simple midi to CV interface,
I stepped across this https://github.com/mitxela/MidiMonotron
Built the circuit and programmed the chip with the .hex file, it worked. YAAY!
But when you release the keys, the CV output jumps back to zero.
So I figured out how to compile the .asm file to hex with AVR Studio 4, got it.
Spent the whole day on modifying the code by trial and error.
(I have no clue about Assembler or barely about coding in general)
disabling the "setNote" call in the "noteOffMove" sub resulted in a a stuck CV, which stayed but didn't change
when playing legato. And the Gate stayed HIGH. undo.
Then I tried by disabling and re-enabling single lines in all subroutines that
had something to do with notes, including the outputtOff subroutine at the end.
When I removed the line "out OCR1A.r16" in the outputOff sub
and the last two "ldi" and "out" lines before the "ret" command,
the CV out behaved as I wanted, but then the gate output got stuck.
After six hours I decided to give up the trial&error thing and ask in the
forums.
I'd aprecciate your advice. _________________ Is the future obsolete? |
|
Back to top
|
|
|
Grumble
Joined: Nov 23, 2015 Posts: 1294 Location: Netherlands
Audio files: 30
|
Posted: Fri Apr 13, 2018 11:21 pm Post subject:
|
|
|
My guess is:
Almost at the bottom of the code you find:
Code: |
outputOff:
clr r16
out OCR1A,r16
cbi PORTB,3
cbi PORTB,0
ldi r16, 0b00000000
out DDRB,r16
ret
|
Here the cv for notes is set to 0 where it says: clr r16 (cleares r16) and out OCR1A, r16 (output r16 to OCR1A) effectively stopping the pwm that causes the cv for notes. So just remove these two statements while keeping the rest of the code and try again. _________________ my synth |
|
Back to top
|
|
|
beep
Joined: May 05, 2013 Posts: 105 Location: Germany
|
Posted: Sun Apr 15, 2018 12:35 pm Post subject:
|
|
|
Your guess was right, but that' only half of the enemy killed.
The last two commands turn off the PWM outputs, so they have to go.
CV works like a charm then but the GATE output cannot retrigger unless
you change the note.
That was the point where I got stuck before I decided to ask people out there.
Got help in the SDIY facebook group. Someone found out that those lines:
in r16,OCR1A
cp r16,r19
breq setNoteEnd
in the SetNote: sub cause the retriggering problem. just delete them too.
voila. _________________ Is the future obsolete? |
|
Back to top
|
|
|
beep
Joined: May 05, 2013 Posts: 105 Location: Germany
|
Posted: Sun Apr 15, 2018 12:41 pm Post subject:
|
|
|
Next things I want to find out is how to restrict the whole thing either to
high note or to low note priority. I think of two ATTinys being triggered
from the same midi signal, but outputting high and low note CV -> duophony!
And it should be possible to change the MIDI channel for each chip. _________________ Is the future obsolete? |
|
Back to top
|
|
|
|