Hi Adam, The data wil be send serial true some MCU pin using a DCC TrainControl Booster. This pattern is generated in the Booster: ; 1111111111 0 AAAAAAAA 0 DDDDDDDD 0 EEEEEEEE 1 ; DATA0 0 DATA1 0 DATA2 0 DATA3 1 And the result i need for testing must be: ; '1111 0 AAA' 'AAAAA0DD' 'DDDDDD0E' 'EEEEEEE1' ; DATA0 DATA1 DATA2 DATA3 I tryed this code allready but i seem to mis some bts during prosessing: bsf NEW_PACKET ;*new packet received bcf DCC4BYTE ;*if set there is a 4 byte packet movlw b'11111111' movwf DATA0 ;*Set preamble movlw b'11111111' movwf DATA1 ;*Set Byte One movlw b'11111111' movwf DATA2 ;*Set Byte Two xorwf DATA1, W movwf DATA3 ;*Set Byte Three rlf DATA3, f rlf DATA2, f rlf DATA1, f rlf DATA0, f rlf DATA00,f rlf DATA2, f rlf DATA1, f rlf DATA0, f rlf DATA00,f rlf DATA1, f rlf DATA0, f Harry -----Oorspronkelijk bericht----- Van: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] Namens M. Adam Davis Verzonden: zondag 10 augustus 2008 4:34 Aan: Microcontroller discussion list - Public. Onderwerp: Re: [PIC] Packets problem to be solved On Sat, Aug 9, 2008 at 3:18 PM, Harry H. Arends wrote: > I have problem that my mind cant get right. There are four pieces of > data that must be send serial in a certain pattern: > ; 1111111111 0 AAAAAAAA 0 DDDDDDDD 0 EEEEEEEE 1 > ; DATA0 0 DATA1 0 DATA2 0 DATA3 1 > ; '1111 0 AAA' 'AAAAA0DD' 'DDDDDD0E' 'EEEEEEE1' > ; DATA0 DATA1 DATA2 DATA3 You seem to be proposing two different patterns. > Between data0, data1 and data2 a zero must be included and at the end > of > data3 a one. Ok. > The value of EEEEEEEE in data3 is the bitwise exclusive OR from the > AAAAAAAA and DDDDDDDD data. Ok. > Thanks for any help, More than happy to help, but I don't understand the question, or there doesn't seem to be one. What type of communication is this? (RS232, SPI, CAN, ethernet, TCP/IP, etc?) What are the devices involved? What is the size of each data item (you seem to be assuming 8 bits per data)? Is the communication packetized - or what are the parameters of the communications channel( RS232 might be 8 data, no parity, 1 stop, for instance)? Are there data sheets we can look at to help you? -Adam -- EARTH DAY 2008 Tuesday April 22 Save Money * Save Oil * Save Lives * Save the Planet http://www.driveslowly.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist