Hi,
You're still off on the array.
This creates an array of 32 elements numbered 0-31 but you assign values to it starting at 1 and ending at 32 - not very good. There is no SineVal[32], when you read/write to that variable you're actually accessing the "next" RAM location, something I'm sure you don't want to do here.Code:Sinval VAR BYTE[32]
You can adjust the peak value by "scaling" the value in your sine-table but really, you're not even 2% off target.
Are you using a 4MHz x-tal like the code says or are you using something else?
If I'm not mistaken a reload value of 65505 with a prescaler of 1:8 running at 4Mhz gives an interrupt frequency of 4032Hz, you have 32 "steps" to your cycle so you "should" get around 126Hz....
For accuracy it's usually better to stop the timer and then ADD the preload value to the timers current value since this will take into account the interrupt latency etc. Stop it, copy it to a WORD, add the reload value, copy it back and restart the timer.
Any specific reason you're using a TMR1 prescaler of 8? Using a lower prescaler ratio will give you better "resolution" on the interrupt frequency.
/Henrik.
Bookmarks