' define CPU type cpu 12F508 ' constant definitions def gate = gp0 def ngate = gp1 ' variable definitions varb delay0 varb delay1 varb timerValue ' init registers low gate low ngate output gate output ngate clrwdt option = $87 ' switch gate and ngate with break-before-make each second ' wait 8 ms after each break start: ' precondition: both gates are low, FET with ngate conducting high ngate ' disable FET with ngate call wait8ms high gate ' enable FET with gate call wait991ms ' precondition: both gates are high, FET with gate is conducting low gate ' disable FET with gate call wait8ms low ngate ' enable FET with ngate call wait991ms goto start ' delay functions ' wait 991.232ms wait991ms: for delay0 = 1 to 121 for delay1 = 1 to 32 call wait256us next next return 0 ' wait 8.192 ms wait8ms: for delay1 = 1 to 32 call wait256us next return 0 ' wait 1/3906.25 s = 256 us wait256us: timerValue = TMR0 do while timerValue = TMR0 loop return 0