For all you guys who have time to spare , could you please take a look at this: I'm creating a MIDI device which has to send a program-change command. For you guys who don't know the MIDI-protocol: 31.125 KHz serial data, 1 startbit (LOW) , 8 databits, LSB first, 1 (or more) stopbit (high). ( ==> 1 bit == 32 cycles@4MHz clock) That's about what the following routine's should do... The problem is, it won't transmit program-changes with program-numbers >99 . I just dont get it.. ;This one should do the byte-sending incl. start-stopbits: LIST p=16c84 MIDI_Sendbyte ;********************* Cycles Send MIDI byte. Data is in Databyte MOVLW 0x09 ;1 9 times. Startbit in Carry MOVWF Counter ;1 BCF STATUS,0 ;1 Set startbit == logic 0 Do_serial ;send 8-bit serial CALL Send_bit ;28 Cycles RRF Databyte,F ;1 DECFSZ Counter ;1(2) GOTO Do_serial ;2 BSF STATUS,0 ;Set stopbit CALL Send_bit ;Send stopbit NOP NOP NOP NOP RETURN ;This one should send a singe bit, and delay for a while Send_bit ;********************* BTFSC STATUS,0 ;2 Test carry GOTO Bit_high ; GOTO Bit_low ;2 Bit_low BCF MIDI_port ;1 GOTO Bit_send ;2 Bit_high NOP BSF MIDI_port ; GOTO Bit_send ; Bit_send ;Total 7 cycles MOVLW d'5' MOVWF Delaycount Bit_loop DECFSZ Delaycount GOTO Bit_loop NOP NOP ;18 RETURN ;total : 26 w call 28 ;And here's the one that sends a complete command (SHOULD send one ;) ) MIDI_prgchg ;********************* Program change MOVF Prog_change,W MOVWF Databyte CALL MIDI_Sendbyte MOVF Prog_nr,W MOVWF Databyte CALL MIDI_Sendbyte RETURN ;It almost has to be a timing-problem, weird thing is that byte 1 is sent ;OK, byte 2 (program-number) not.