The tachometer response is of 16 bits, and currently is sent by PIC in the Big Endian format (most significant byte first). This is an issue since x86-64 processors, and therefore MATLAB, store data in the Little Endian format. At the moment it is solved by swaping the bytes after doing a fread.
I can't really clean this until we decide to refactor previous MATLAB code, especially those where fread is used in multiple lines. Only worth doing if we decide to join an existing protocol, like Modbus.
Another thing that would benefit from changing protocol is that atm writing a duty cycle of 10 has no effect, since in the current protocol the value 10 is recognized as a '\n'.
The tachometer response is of 16 bits, and currently is sent by PIC in the Big Endian format (most significant byte first). This is an issue since x86-64 processors, and therefore MATLAB, store data in the Little Endian format. At the moment it is solved by swaping the bytes after doing a fread.
I can't really clean this until we decide to refactor previous MATLAB code, especially those where fread is used in multiple lines. Only worth doing if we decide to join an existing protocol, like Modbus.