I need to validate the resolver output. The communication with the master controller is through spi. But i am sure how to validate that data. The spi data consists of position and velocity. Since the motor runs at a high speed i can control the speed but still how to make sure i am receiving correct data. Any ideas. Please help. The resolver is AD2S1210.
i am bit confused the with data output format. The angular velocity data is a 12-bit twos complement word, representing the velocity of the resolver shaft rotating in either a clockwise or counterclockwise direction. The angular velocity data format is twos complement, with the MSB representing the rotation direction. I have done the following calculations are they correct? please help
Assume:
1 - Clockwise
0 - Anticlockwise
Actual Value
0b 1010 1011 0101 - 0xCB5
2's Complement
Invert Bits
0b 0101 0100 1010
Add 1
0b 0101 0100 1011 -> 0x54B Velocity Clockwise Direction
It will be rotating 1355 rps clockwise direction. Whether the calculations are same for anti clockwise direction? Should i completely neglect 12th bit? Please suggest. I have attached the data sheet. A sample linux driver is given in the following link **broken link removed**
I did not understand the function
I am really sorry i don't understand what i am doing. OK as per your instruction can i write the code as follows
Code:
int main(void)
{
signed int l_read_miso_data_int16;
l_read_miso_data_int16 = transmit_mosi_read_miso();
if(l_read_miso_data_int16 < 0)
{
ditection = CLOCKWISE;
/*mask the last 4 lsb bits */
/* the result is the velocity */
}
else
{
direction = ANTI CLOCKWISE;
/* mask the last 4 lsb bits*/
/* the result is velocity */
}
return 0;
}
int transmit_mosi_read_miso(void)
{
/*
send spi data and read back the data
*/
return miso_data;
}
Thank you very much. I am sorry i forgot to ask there is a parity bit 0 what exactly is this? I am extracting 12 bits of velocity and seeing if there are odd number of 1's else i am considering it as invalid data. But please tell me what shall i do with parity bit?