code_junkie

Protocols used to talk between an embedded CPU and a PC

Nov 12th, 2011
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Host --> [V02?] // Request voltage #2
  2. AVR --> [V02=2.34] // Reply with voltage #2
  3. Host --> [V06=3.12] // Set voltage #6
  4. AVR --> [V06=3.15] // Reply with voltage #6
  5.  
  6. struct PacketHdr
  7. {
  8. char syncByte1;
  9. char syncByte2;
  10. char packetType;
  11. char bytesToFollow; //-or- totalPacketSize
  12. };
  13.  
  14. struct VoltageSet
  15. {
  16. struct PacketHdr;
  17. int16 channelId;
  18. int16 voltageLevel;
  19. uint16 crc;
  20. };
  21.  
  22. struct VoltageResponse
  23. {
  24. struct PacketHdr;
  25. int16 data[N]; //Num channels are fixed
  26. uint16 crc;
  27. }
  28.  
  29. V0=3.20
  30. V1=3.21
  31. V2= ...
  32. D1=0
  33. D2=1
  34. D3=...
  35. and then start over --
  36.  
  37. 5=0
  38. 6=9
  39. 2=5
Add Comment
Please, Sign In to add comment