Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. Byte 1: Recipient
  2. Byte 2: Sender
  3. Bytes 3-n: Payload
  4. Byte n: Checksum
  5.  
  6. Byte 0: Constant Sync value (magic number)
  7. Byte 1: Recipient
  8. Byte 2: Sender
  9. Bytes 3-24: Payload
  10. Byte 25: byte of 1st flipped bits
  11. Byte 26: byte of 2nd flipped bits
  12. Byte 27: byte of 3rd flipped bits
  13. Byte 28: checksum
  14.  
  15. transmit:
  16. cjne R1,#CHECKSUM_POINTER,notxe
  17. sjmp endtxdf ;end operations if we reached checksum pointer
  18. notxe:
  19. inc R1 ;Process next value (first value printed in triggering function)
  20. mov A,@R1
  21. cjne A,#SYNCVAL,tsync
  22. xrl A,#0FFh ;Next value is the magic number so carry is cleared and flip the byte
  23. sjmp etsync
  24. tsync:
  25. setb C ;Next value isn't magic number so carry is set
  26. etsync:
  27. mov SBUF,A ;Send value out on serial line
  28. ;then move carry into 24-bit value (bytes 25 through 27)
  29. mov A,byte_25
  30. rrc A
  31. mov byte_25,A
  32. mov A,byte_26
  33. rrc A
  34. mov byte_26,A
  35. mov A,byte_27
  36. rrc A
  37. mov byte_27,A
  38. endtxdf:
  39. ;transmit interrupt ends
  40. reti
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement