Thanks Pommie & William for getting back. This code is already written for a VFD clock, so if I start changing something in the code, the thing might not work. But I'll try it and see what happens.
Just in case - William what is that "toggle MPLABs target power control manually every time." How would I do this in MPLAB?
The Code
The PIC16F628A has just enough i/o for my purposes: 4 for the BCD-Decimal converter to drive the grids, 8 for the anodes, one each for the hours and minutes buttons, one for the 60Hz input, and one for the PWM output driving the boost converter. In other words, where there is a will, there is a way. To wit: B<7:4>,A<3:0> segments
B<3> dc/dc PWM out
A<6>,B<2:0> grid (BCD)
A<7,5> switches: hours, minutes
A<4> 60 Hertz input
Clock Multiplicity
The 60Hz counting part of this is the same as it's always been, except that I'm not interrupting on the 60Hz input; instead, I interrupt at a subharmonic (4kHz) of the PWM frequency (64kHz), trapping rising edges of the 60Hz clock while performing the grid muxing.
Why do it this way? Trying to be synchronous with two different clock sources whose frequency and phase relationship is not well known (and can change, e.g., with temperature, since we're using the onboard RC oscillator in the PIC) is a nasty problem. In digital design you call this clock domain spanning problems or the like, whereas in soft/firmware it generally shows its ugly face in the form of asynchronous interrupt contention. Instead, it's much better to synchronize the slower clock to the faster, which works well as long as you can take delays in the slow clock on the order of one cycle of the faster clock. Since we're just counting the 60Hz cycles, and not really synchronizing anything to them, we can certainly get away with it here.
To trap the 60Hz cycles, I'm still using timer 0 in external clock mode, but keeping the timer 0 interrupt disabled. Every 4kHz muxing cycle I poll the timer 0 flag (INTCON,T0IF), which is set even if the interrupt is disabled, and manually clear it and reset the prescaler when it flips over. This lets me take advantage of the hardware at my disposal to get rid of an appreciable chunk of code.
Here's a snipet of the code:
RADIX hex
processor p16f628a
LIST p=p16f628a
LIST n=0
LIST r=hex
LIST st=on
LIST f=inhx8m
include p16f628a.inc
__CONFIG _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_OFF & _INTRC_OSC_NOCLKOUT
__CONFIG _BODEN_ON & _CP_OFF & _DATA_CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _MCLRE_ON & _INTRC_OSC_NOCLKOUT
; DAC control bits
#define mswitch PORTA,0x05
#define hswitch PORTA,0x07
#define gridmsb PORTA,0x06
#define gridm2sb PORTB,0x02
#define _segper PORTB,0x07
#define gridpar grid,0x00
#define grswap grtmp,0x00
#define _is_pm ampm,0x00
#define _is_50 clkconfig,0x07
; A<0:3>,B<4:7> - segments
; A<4> - 60Hz inputs
; A<5> - grid MSB
; A<6:7> - min:hr inputs