标题:
请教我一下
[打印本页]
作者:
ben_shere
时间:
2014-1-9 21:21
标题:
请教我一下
#include "stc12c56xx.h"
#include "intrins.h"
#include "math.h"
#define PI 3.1415926
#define uchar unsigned char
#define uint unsigned int
uint count;
short sin_data;
void mcu_init();
void delay(uint x);
void main()
{
mcu_init();
for(count=1;count<270;count++)
{
sin_data=126*(sin(2*PI*count/270))+128;
}
while(1);
}
void mcu_init()
{
P1M0=0x00;
P1M1=0xff;
P2M0=0x00;
P2M1=0xff;
}
请教一下为啥当count值到3f时sin_data的值会与手工计算的值不一样
作者:
xieweihua12
时间:
2014-1-11 10:50
首先,你说的不一样不知道差别到底是多大。
再一个,你说的问题可能在于计算sin的精度不行
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1