Hi, I don't think you can cross a byte boundary. Here, i've placed "," where your boundaries are:
xxxxx000,10111010,10101001,01111011 This line is trying to use bytes 1 to 9, but you can only do 1 to 7 (bit*7) or 0 to 7 (bit*8 ... at frame: 0) Var bit*8 checksum_byte at frame: 1 If you need to cross byte boundaries, you can define two bit*x, then put them together into a new variable. Matt. On Thursday, July 20, 2017 at 4:02:16 PM UTC-4, Rian De Rous wrote: > > I’m decoding the DCC-protocol. For This purpose, i programmed another > microcontroller to generate a frame that has address 23 (green), data: 170 > (blue) and yellow is a checksum. The checksum is the binary xor of data and > address (189). A frame is preceded by a preamble. I’m able to detect this > preamble. Afther the preamble, i’m shifting the bits of the packet in a > dword variable. > > Using a serial terminal, I discoverd someting strange. Using the print > library I printed the frame dword variable in binary to the terminal. As > you can figure out, the frame is correctly decoded by my Interrupt service > routine. The strange thing is that the terminal tells me that the address > is 47, the data byte 94 and the checksum 189 (instead of 23 and 170). So > only the checksum is correct. When you write 47 and 94 in binary it’s easy > to figure out that incorrect bits are used to calculate the value of > address_byte and data_byte. > > > > Received frame: xxxxx000101110101010100101111011 > (this frame is correct) > > Var bit*8 addres_byte at frame:19 00101111 > (according to the terminal, address is 47 instead of 23). > Var bit*8 data_byte at frame:10 01011110 > (according to the terminal, data is 94 instead of 170). > > Var bit*8 checksum_byte at frame: 1 10111101 > > > > What’s going wrong? When compiling a program jaledit tell's me that i'm > using version jalv24q5. > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/jallib. For more options, visit https://groups.google.com/d/optout.
