[SOLVED] Understaning the code of following

Status
Not open for further replies.

thannara123

Advanced Member level 5
Joined
Jan 7, 2010
Messages
1,602
Helped
122
Reputation
244
Reaction score
116
Trophy points
1,353
Activity points
10,615
I am learning the sinewave generation a great member Thahamid posted a blog in edabord as follwos

i didnt understand the working of following code anybody help me ?

TBL_POINTER_SHIFT = TBL_POINTER_NEW >> 11;
DUTY_CYCLE = TBL_POINTER_SHIFT;

what are the values of TBL_POINTER_SHIFT variable
it gets 1 when the TBL_POINTER_SHIFT become 2048 ,with lower the value it will be zero
am curiuos how the technique behind it ?
 

The variable names are somehow contra-intuitive.

It's basically a DDS generator. What they call TABLE_POINTER_xx is usually designated DDS accumulator. The upper 5 bits are used as index into the sine table.
 

    thannara123

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…