12f629 freq divider?


Results 1 to 20 of 20

Threaded View

  1. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by nomad View Post
    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.
    Last edited by skimask; - 22nd October 2008 at 23:20. Reason: Pulled out the REAL code...

Similar Threads

  1. Input problems with 12F629?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 24th April 2018, 06:25
  2. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 22:33
  3. Basic help for 12F629
    By Gene Choin in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd September 2009, 04:06
  4. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd June 2005, 23:34
  5. HPWM on a 628 is not changing freq.
    By dtit in forum General
    Replies: 2
    Last Post: - 25th February 2005, 09:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts