Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Byte 1: Recipient
- Byte 2: Sender
- Bytes 3-n: Payload
- Byte n: Checksum
- Byte 0: Constant Sync value (magic number)
- Byte 1: Recipient
- Byte 2: Sender
- Bytes 3-24: Payload
- Byte 25: byte of 1st flipped bits
- Byte 26: byte of 2nd flipped bits
- Byte 27: byte of 3rd flipped bits
- Byte 28: checksum
- transmit:
- cjne R1,#CHECKSUM_POINTER,notxe
- sjmp endtxdf ;end operations if we reached checksum pointer
- notxe:
- inc R1 ;Process next value (first value printed in triggering function)
- mov A,@R1
- cjne A,#SYNCVAL,tsync
- xrl A,#0FFh ;Next value is the magic number so carry is cleared and flip the byte
- sjmp etsync
- tsync:
- setb C ;Next value isn't magic number so carry is set
- etsync:
- mov SBUF,A ;Send value out on serial line
- ;then move carry into 24-bit value (bytes 25 through 27)
- mov A,byte_25
- rrc A
- mov byte_25,A
- mov A,byte_26
- rrc A
- mov byte_26,A
- mov A,byte_27
- rrc A
- mov byte_27,A
- endtxdf:
- ;transmit interrupt ends
- reti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement