Hello,

After not having used picbasic for a couple of years, I decided to create some code to produce MIDI information.
The intended use is to have five buttons to control a DAW.
The code compiles without a problem, but I don't get any MIDI (31.250 Baud) output. Xtal = 20 MHz, PIC = 16F628.
I think I made an obvious mistake, but I don't see what it could be...

Code:
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
'* MIDI Remote for Reaper            20 MHz resonator (HS)          
'* PIC16F628                         Watchdog timer OFF              
'* PORTA.0 = Output                                                  
'* PORTB.0 = Rewind                                                  
'* PORTB.1 = FastFwd.                                               
'* PORTB.2 = Stop                                                   
'* PORTB.3 = Play                                                   
'* PORTB.4 = Record                                                 
'* PORTB.5 = Switch between: Stop / Stop + Save
'* Version 1.0                                      
'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 

TRISB= %00111111                                 ' PORTB.6/7=Output 0..5=Input
CMCON =  7                                             ' Digitale mode
DEFINE OSC 20                                        ' 20 MHZ OSC.

Progstart: 

  if PORTB.0 = 1 then 
    Serout2 PORTB.7, 16384+12, [144, 44, 127]    ' Rewind
  endif  
  if PORTB.1 = 1 then 
    Serout2 PORTB.7, 16384+12, [144, 46, 127]    ' Fast Fwd.
  endif  
  if PORTB.2 = 1 then 
    if PORTB.5 = 0 then                          ' Normal STOP mode
      Serout2 PORTB.7, 16384+12, [144, 48, 127]  ' Stop
    else
      Serout2 PORTB.7, 16384+12, [144, 54, 127]  ' Stop + Save
    endif    
  endif  
  if PORTB.3 = 1 then 
    Serout2 PORTB.7, 16384+3313, [144, 50, 127]  ' Play  
  endif  
  if PORTB.4 = 1 then 
    Serout2 PORTB.7, 16384+3313, [144, 52, 127]  ' Record
  endif  

Debounce:
  Pause 20                                          ' ? shorter ?
  If (PORTB.0=1) or (PORTB.1=1) or (PORTB.2=1) or (PORTB.3=1) or (PORTB.4=1) then
    goto Debounce                                ' Button still pressed?
  endif  
  Goto Progstart