Quote Originally Posted by RuudNL View Post
...If I create a loop that does nothing else than: serout2 xxx, delay 1000, I get MIDI information every second.
My main suspect is that the switch(es) are not read correctly in: if PORTB.x =1 then ...
Blinking a LED confirms if your timing is running at the speed you think it's running at.

I usually go for LED 1/2 second OFF, 1/2 second ON, just to know my OSC is running as it's supposed to.

EDIT: Hm, yeah, but you're getting a SEROUT every second already, so not sure what else to check.