Not applicable
May 03, 2016
07:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 03, 2016
07:43 AM
Hi,
To calculate sin(30 degree) I have to call XMC_MATH_CORDIC_SinNB with 0x155555.
To calculate sin(-30 degree) I have to call XMC_MATH_CORDIC_SinNB with 0x955555 ? So simply negate the sign bit?
To calculate sin(30 degree) I have to call XMC_MATH_CORDIC_SinNB with 0x155555.
To calculate sin(-30 degree) I have to call XMC_MATH_CORDIC_SinNB with 0x955555 ? So simply negate the sign bit?
#include
#include "XMC1300.h"
//30*8388608/180 = 0x155555 : CORRY=0x3FFFFE00
//sin(-30) = 0x955555 : CORRY=0xC0000100
//14.47751219*8388608/180 = 0xA4B8C : CORRY=0x1FFFFC00 (arc sin = 0.25)
#define N 3
int main(void)
{
/* variable initialization */
XMC_MATH_Q0_23_t angle= { 0x155555, 0x955555, 0xA4B8C };
XMC_MATH_Q0_23_t calculation_result;
/* sine of angle calculation */
// CON.ROTVEC=1, CON.MODE=1 (rotation mode and circular mode)
for (int i=0; iXMC_MATH_CORDIC_SinNB(angle);
while(XMC_MATH_CORDIC_IsBusy()); // wait for calculation to end
calculation_result = XMC_MATH_CORDIC_GetSinResult();
}
while(1);
}
- Tags:
- IFX
1 Reply
May 03, 2016
08:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 03, 2016
08:17 AM
Hello,
I think that you have to use -30/180*2^23, corresponding to 0xFFEAAAAA.
I think that you have to use -30/180*2^23, corresponding to 0xFFEAAAAA.