To be quite honest, I copied them from the application note I reference in the example I gave. It shows you a little more about it in the notes in the assembly code. If you wanted to make your own, you just need to figure out how many steps you are going to make. If you were doing 36 steps, each step would be 10 degrees. Sin(10 degrees) * 102 + 128 = number. In the Microchip example, they had the max = 90 percent. So 90 percent * 255 = 230. 230 - 128 (the midpoint) = 102. So it will swing + or - 102 from the midpoint (128).
Then we can make a spreadsheet for our steps. I put the Microchip steps in on the left, then degrees for each step, then the formulated value on the right. As you can see, these pretty much match the Microchip values. You would have to do something similar for your 72 steps.
You will have to experiment with a scope to see what it comes out at. At least, that is how I did it. There are a lot of coming in and out of interrupts and such.Also for 50Hz,PR2 will be loaded with 78 for 20MHz oscillator frequency of 16f877,but i dont how to arrive in determination of the value loaded for variable'' timerone''.
Read my previous reply, I think I answered this already.Should i include DT_INTS-18.bas file or DT_INTS-14.bas file?it seems to me they perform different functions!which link will i get DT_INTS-18.bas file?
Only change what won't work on a PIC16877 to what will work on a Pic16f877Finally,is there any other modification i should do in that program that it could work better in pic16f877?
I have not checked to see all that is incompatible. You will have to do a little homework, checking the data sheets, and seeing if you get errors for registers that are incompatible. Seeing if the PWM is compatible, or if the way you address it needs to be changed. It's definately doable, as you can see from the Microchip application note which was written for a 16F device.
Bookmarks