So... I dug out my ICD2 and selection of pics, to build myself a MIDI foot controller. Not having played with MIDI before, I set up a 16f628a, and tried the following:
DEFINE HSER_TXSTA 24H
DEFINE HSER_BAUD 31250
main:
[set relevant ports and CMCON, etc...]
loop:
hserout [144,90,90]
goto loop
Voila! My MIDI analyser shows note on, channel 1, regular as clockwork. Next, I need to send differing messages dependent on one of [n] push-to-make footswitches, so I tried:
if not porta.1 then
hserout [144,90,90]
endif
FAIL! Whereas the analyser was consistent before, now it fails every so often, showing error messages/system reset errors, etc., which leads me to believe there are timing issues with the USART that the if...then and porta.0 test is causing.
I don't want to write a hserout equivalent in assembler, as that's the whole point of using PicBasic Pro, but the timing issues and the button press test are making what should have been a simple project quite frustrating...
I feel that there's not enough documentation available which explains precisely which resources a given command uses, borne out of other frustrating isues I've had with timers, serial LCD display, etc...
Can anybody shed any light on this, or is it back to assembler for this whole project???
G
Bookmarks