Re: VARIABLE FREQUENCY
Maverickmax said:
Guys
You see, if I skip 2 time in the LUT which is 256, the frequency would be double. I know it is the possible solution to increase the size of LUT but I don't want to because of the limited RAM size.
I welcome to hear your suggestion
If you want to move through your table at a slower rate, you need a lower fractional byte for your counter.
If you advance by +1, you get a new value each time because you went up one index.
Instead of adding +1 each time, use a new lower byte and add +1 in it each time. If the lower byte has 0x01, then after 256 adds you get a carry into the higher byte, and your index goes up one. You go through the table at x/256th the rate. (This is not limited to +1, +16 in the lower byte will roll over after 16 adds, 256/x will tell how many loops until it rolls over..)
Binary works in fractions too. 00.00 The right bit from the decimal is 1/2, the next right is 1/4, etc etc. It is just 2 ^ -1 then 2^-2 etc..
Instead of index hex 01. counting 1 to 256 you use index hex 00.01 counting 1/256th. Add that then use the high byte as your index, there's a carry every 256 with 1 in the low byte etc. If you need even slower, use another lower byte for 1/65536th as the minimum. Hex 00.0001 adds 65536 times before there's a carry into the high byte and the index increments to 1. The byte above the decimal is still your index, you're just keeping track of smaller fractional increments instead of incrementing by the whole 1 each time. Hex 00.8000 is 1/2, you will get a carry into the high byte every 2 adds, 00.4000 is 1/4 etc etc.
Alan