
Originally Posted by
jyi1
If I were to run your code to test it would I code data0=0000001, data1=00000001, data2=00000101, data3=00001101 and then code data0=001000001, data1=00100001, data3=00100101, data3=00101101?
You said you are sending 4 bits of data. My example was intended to show you how to send the 4 bits twice in two different ways. One way is "as is" in the lower 4 bits of wb; the other way is as the bitwise complement of the 4 data bits in the upper 4 bits of wb. Sending it in two forms allows us to check for errors on the receiving end.
Assuming you want to send %1101...
Code:
data=%1101
wb=data
wb=~wb
wb=wb<<4 'bitwise complement %0010 in upper 4 bits
wb=wb+data 'data "as is" in lower 4 bits
The attached GIF shows the waveform for data=%1101.
Bookmarks