Hi,
As last time this is completely untested. This builds and sends the command in steps which means that there will be some delay between the "preamble", "command" and "postamble". I don't know how tight the timing has to be so doing it this way may or may not work.Again, not tested so take it for what it is.Code:'**************************************************************** '* Name : Fratello_JVC.pbp * '* Author : Henrik Olsson * '* Notice : * '* : * '* Date : 2012-03-12 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** i VAR BYTE j VAR BYTE OutBuffer VAR BYTE[8] BitsToSend VAR BYTE Main: For j = 0 to 10 GOSUB VolUp Pause 1000 NEXT FOR j = 0 to 10 GOSUB VolDn PAUSE 1000 NEXT GOTO Main SendPreamble: ' 00000000 00000000 11111111 01110111 01110111 01010101 11 ' Each individual byte reversed: OutBuffer[0] = %00000000 OutBuffer[1] = %00000000 OutBuffer[2] = %11111111 OutBuffer[3] = %11101110 OutBuffer[4] = %11101110 OutBuffer[5] = %10101010 OutBuffer[6] = %00000011 BitsToSend = 50 GOSUB SendBits RETURN '----------------------------------------------------------------------- SendPostAmble: ' 01111111 11111111 11111111 11111111 11110111 01110111 01110101 010111 OutBuffer[0] = %11111110 OutBuffer[1] = %11111111 OutBuffer[2] = %11111111 OutBuffer[3] = %11111111 OutBuffer[4] = %11101111 OutBuffer[5] = %11101110 OutBuffer[6] = %10101110 OutBuffer[7] = %00111010 BitsToSend = 54 GOSUB SendBits RETURN '----------------------------------------------------------------------- '----------------------------------------------------------------------- VolUp: GOSUB SendPreAmble ' 01010111 10101010 1 ' Each individual byte reversed OutBuffer[0] = %11101010 OutBuffer[1] = %01010101 OutBuffer[2] = %00000001 BitsToSend = 17 GOSUB SendBits GOSUB SendPostAmble RETURN '----------------------------------------------------------------------- '----------------------------------------------------------------------- VolDn: GOSUB SendPreAmble ' 01111010 11110101 0101 ' Each individual byte reversed OutBuffer[0] = %01011110 OutBuffer[1] = %10101111 OutBuffer[2] = %00001010 BitsToSend = 20 GOSUB SendBits GOSUB SendPostAmble RETURN '----------------------------------------------------------------------- '----------------------------------------------------------------------- SendBits: BitsToSend = BitsToSend - 1 For i = 0 to BitsToSend PortB.0 = OutBuffer.0[i] PauseUs 536 NEXT RETURN '-----------------------------------------------------------------------
/Henrik.




Bookmarks