Having trouble running both serial terminal and full duplex serial at the same time
tuffstuff
Posts: 24
I have found an issue that is perplexing me. I have some working code that breaks when I comment out one line and I'm not sure why. The end goal is a real time midi parser. My current stage is trying to print to the serial terminal the midi recording mode (on or off) while reading in midi data via FullDuplexSerial. Record mode is toggled via a Yamaha sustain pedal. The code below does not toggle to record mode when I hit the pedal. Record is allways off. Here is my code:
But when I comment out the "midi.start( 0, 1, %0000, 31250 )" line it works fine. Like so:
Whats the deal? Thanks!
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ pst : "Parallax Serial Terminal" midi : "FullDuplexSerial" VAR LONG stack[128] LONG midiseq[64] BYTE rectog[1] BYTE recstate[1] PUB Main | mbyte, track, counter cognew(PetalBounce, @stack) pst.Start(115200) midi.start( 0, 1, %0000, 31250 ) repeat RecordON pst.dec(recstate) PUB MidiRecord: midibyte pst.str(string(" testMidiRecord ")) 'indicate the MidiRecord has began if (midibyte := midi.rxcheck) <> -1 return midibyte PUB RecordON repeat while rectog == 0 recstate := 0 pst.str(string(" rec OFF ")) repeat while rectog == 1 recstate := 1 pst.str(string(" rec ON ")) repeat while rectog == 0 recstate := 1 pst.str(string(" rec ON ")) repeat while rectog == 1 recstate := 0 pst.str(string(" rec OFF ")) PUB PetalBounce | counter, val repeat if (val := INA[1]) == 0 rectog := 1 counter := 0 repeat while counter <> 400 if INA[1] == 1 counter ++ if INA[1] == 0 counter := 0 else rectog := 0
But when I comment out the "midi.start( 0, 1, %0000, 31250 )" line it works fine. Like so:
... PUB Main | mbyte, track, counter cognew(PetalBounce, @stack) pst.Start(115200) 'midi.start( 0, 1, %0000, 31250 ) repeat RecordON pst.dec(recstate) ...
Whats the deal? Thanks!
Comments
Thanks Mike!