I have legacy PIC assembly code for a 16C54 which creates three unique PWM outputs, switching between them based on input. Output are:
1. Stand-by mode. Fixed PWM.
2. Ramp-up mode. During first mirco seconds of applied Gate-input, increase pulse width from Stand-by pulse width to ON-mode pulse width. Duration of ramp-up is variable.
3. ON-mode. Fixed PWM.
The legacy code has input in parallel: 8 bits representing 0-100% pulse width. Even with tight code running with a 20mHz oscillator, it’s too slow for my new requirement (slow in the sense of switching between the 3 modes.... each clock-tick counts). I need:
a) Port the code to a new PIC: 40mHrz 18 pin DIP.
b) Implement programable frequency (the legacy code is pulse width only).
c) Change the input method to I2C slave mode. I can dedicate one input to act as a interrupt rather than checking the SPI status register continuously (consistent fast PWM output mode switching, without missing pulses, is the key).