Hi,
I'm building a power inverter that needs a high frequency clock at about 25Khz and a low frequency one at 50Hz. I have access to various crystal speeds, and as the choice of high frequency is not vital I can see how by choosing prescaler values I can use TMR0 to give me a suitable square wave to control my bridge. However, the 50Hz output is causing more problems - it needs to be exact, but crystal speed divided by 4 divided by 256 divided by prescaler doesnt equal 50 for any crystal/prescaler combination! I realise I could use a simple op-amp and cap/resistor network to get a 50Hz square wave, but I'm hoping to be able eventually to get the PIC to give me a nice quasi sine wave (square wave with deadtime). However, If I can't get the frequency right this is a non-starter!As is probably evident, I am very innexperienced with the PIC, so any advice would be very welcome.
I'm building a power inverter that needs a high frequency clock at about 25Khz and a low frequency one at 50Hz. I have access to various crystal speeds, and as the choice of high frequency is not vital I can see how by choosing prescaler values I can use TMR0 to give me a suitable square wave to control my bridge. However, the 50Hz output is causing more problems - it needs to be exact, but crystal speed divided by 4 divided by 256 divided by prescaler doesnt equal 50 for any crystal/prescaler combination! I realise I could use a simple op-amp and cap/resistor network to get a 50Hz square wave, but I'm hoping to be able eventually to get the PIC to give me a nice quasi sine wave (square wave with deadtime). However, If I can't get the frequency right this is a non-starter!As is probably evident, I am very innexperienced with the PIC, so any advice would be very welcome.