1992 views|6 replies

411

Posts

9

Resources
The OP
 

Please help explain this code, thank you very much~ [Copy link]

Regarding the points of the sine function, PI is 3.14; n and tablesize are two variables, and tablesize was previously defined as 256; I don't understand what the brackets mean, does anyone know? for(n=0;n
It is the integer sine value of a period

The sine wave value obtained by dividing a sine wave into 1/256 equal parts is multiplied by 2047 and then written into the sinTable array.

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2385829&ptid=652185][color=#999999]wenyangzeng posted on 2018-7-26 17:27[/color][/url][/size] Multiply the sine wave value obtained by dividing a sine wave into 1/256 equal parts by 2047 and write it into the sinTable array. [/quote] {:1_103:}

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2385829&ptid=652185][color=#999999]wenyangzeng posted on 2018-7-26 17:27[/color][/url][/size] Divide a sine wave into 1/256 equal parts and multiply the sine wave value by 2047 and write it into the sinTable array. [/quote] Why add 1?

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2385854&ptid=652185][color=#999999]Shijizai posted on 2018-7-26 18:37[/color][/url][/size] Why add 1? [/quote] How much to add is up to the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor.

[quote][size=2][url=forum.php?mod=redirect&goto=findpost&pid=2385868&ptid=652185][color=#999999]wenyangzeng posted on 2018-7-26 19:27[/color][/url][/size] How much to add depends on the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor. [/quote] Okay, I understand, thank you

Please help explain this code, thank you very much~


This post is from stm32/stm8

Latest reply

How much to add is up to the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor.  Details Published on 2018-7-26 19:27
 

4005

Posts

0

Resources
2
 
It is the integer sine value of a period
This post is from stm32/stm8

赞赏

1

查看全部赞赏

 
 

374

Posts

3

Resources
3
 
The sine wave value obtained by dividing a sine wave into 1/256 equal parts is multiplied by 2047 and then written into the sinTable array.
This post is from stm32/stm8

Comments

So why add 1?  Details Published on 2018-7-26 18:37

赞赏

1

查看全部赞赏

 
 

10

Posts

0

Resources
4
 
wenyangzeng posted on 2018-7-26 17:27 Multiply the sine wave value obtained by dividing a sine wave into 1/256 equal parts by 2047 and write it into the sinTable array.
This post is from stm32/stm8
 
 
 

411

Posts

9

Resources
5
 
wenyangzeng posted on 2018-7-26 17:27 Divide a sine wave into 1/256 equal parts and multiply the sine wave value by 2047 and write it into the sinTable array.
Why add 1?
This post is from stm32/stm8

Comments

How much to add is up to the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor.  Details Published on 2018-7-26 19:27
 
 
 

374

Posts

3

Resources
6
 
How much to add is up to the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor.
This post is from stm32/stm8

Comments

Yeah, got it, thank you.  Details Published on 2018-7-27 08:38
 
 
 

411

Posts

9

Resources
7
 
wenyangzeng posted on 2018-7-26 19:27 How much to add depends on the programmer. It may prevent the array data from having 0, which will cause problems when used as a divisor.
Okay, I understand, thank you
This post is from stm32/stm8
 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list