How best to convert from words to bytes to transfer word variables via I2C

wapo54001

Senior Member
I want to transfer three Word variables from a 14M2 to a 28X2 via I2C so that I can use the GET command in the 28X2 to save the word data to variables and use them for further processing.

Since I2C accepts only bytes, I'm floundering around looking for an easy way to do this. Is there one, or is the a huge "gotcha" when it comes to I2C?
 

hippy

Technical Support
Staff member
The best solution is probably to send the constituent byte parts of the variable. For example, to send 'w0', send 'b0' then 'b1', and do the opposite at the receiving end, take 'b0' then 'b1', and it will automatically have recreated 'w0'.
 
Top