
 Originally Posted by 
nomad
					
				 
				does using a 12f629 to count pulses and toggle an output after every 25th pulse sound like the way to go?
			
		 
	 
 I didn't read the post thoroughly before...
Awhile back, I needed a divider for an output from an 18F4685 running at 40Mhz (which is wayyyy too fast at it's slowest) to drive a auto tachometer (which needs much slower input freq).
I took a regular ol' 12F675, set it up to just do a 'blinky LED' with a few pauses here and there to divide it just right and drove the 12F685's OSC1 input with the output from the PIC18F4685 that I needed to divide.  Does that make sense?
The code looked like this:
	Code:
	'73 used, 16 lines, PIC12F675 'expensive divide by' chip
@ __CONFIG _CPD_OFF & _CP_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _EC_OSC
DEFINE	NO_CLRWDT	1	'no extra clear watchdog timer instructions
DEFINE	OSCCAL_1K	1	'reload osc cal value
DISABLE
CLEAR
led var gpio.4 : tachout var gpio.2
delay con 75
cmcon = 7 : ansel = 0 : trisio = $2b	'digital pins, inputs and outputs set up
mainloop:
	led = 0 : tachout = 0 : pauseus delay
	led = 1 : tachout = 1 : pauseus delay
	goto mainloop
ENd
 I ended up with a 'divide by 58' chip.  The output wasn't exactly a 50% duty cycle, but it was close enough to drive the tach.  You can see the tach running off the PIC on youtube.  Do a search for skimask87, check video #5.
				
			
Bookmarks