Hi bigmac
I notice that the code within the file main.c differs from the posted code snippet in that the STROBE signal is becoming inactive after each byte received. The STROBE line should remain low for the duration of the 16-bit transfer, as shown in the snippet.
Yes thats true it's just a problem of save as ... sorry for the mistake.
I notice that you have also defined DATA as the pin corresponding to MOSI. While this may be a spurious macro definition, I presume that the actual connection between the encoder and the MCU is DO -> MISO (PTBD4)?
Yes it is.
The following line seems to contain an error:resL = ReceivedByteH & 0x70;
Yes it should be ReceivedByteL, anyway I will test all of your porpousal, seems to be more easy to manage it.
I tested the code that you wrote to me (thxs) but I still having the same problem (maybe I need to read more carefully the encoder doc) when I spected to receive 1000 I received the 24 (the complementary data), and I'm not able to localize the satuts bit, I will explain it with an example:
Iamgine that the magnet over the enconder is in the 90º (256) (359º equals 1024), I can adjust the position using the PWM output from the encoder, so the data transmit should be:
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 OCF COF LIN MIN MDEC EPAR
0 0 1 1 1 1 1 1 1 1 0 ? ? 0 0 ?
I'm searching for the angular position and for the COF bit or MIN + MDEC, but I can decode 270º(768):
D9 D8 D7 D6 D5 D4 D3 D2 D1 D0 OCF COF LIN MIN MDEC EPAR
0 1 1 0 0 0 0 0 0 0 0 ? ? 1 1 ?
thta's my problem, I supossed thta I'm doing something worng, and then I started to make samll changes with no result.
thxs for all
Cram