Just cascade 3 times 4017. It cheapest and reliable way to do it.
https://www.ti.com/lit/ds/schs027c/s...oogle.com%252F
Just cascade 3 times 4017. It cheapest and reliable way to do it.
https://www.ti.com/lit/ds/schs027c/s...oogle.com%252F
its not one division its three with a 90 deg phase shift on one of them.I would like to understand why I see all those "counts" for one division
one div would be like this
Code:;In simple terms toggle a pin on every 125th cycle ;start:;set gpio pin high ;delay 124 cycles ;set gpio pin low ;delay 122 cycles ;goto start CNT VAR BYTE BANK0 TRISIO=110 ASM START BSF GPIO , 0 MOVLW 40 ;2 MOVWF _CNT ;1 DL1 ;119 DELAY = 2+3(CNT-1) DECFSZ _CNT GOTO DL1 NOP ;1 NOP ;1 BCF GPIO , 0 MOVLW 40 ;2 MOVWF _CNT ;1 DL2 DECFSZ _CNT ;119 DELAY = 2+3(CNT-1) GOTO DL2 GOTO START ;2 ENDASM
Last edited by richard; - 3rd February 2021 at 01:29.
Warning I'm not a teacher
thanks Richard I don't see my first reply
so I was saying
"I am not spleeping just trying to undersatnd your asm example ..."
hold the line !
regards
i tested my code while i had the sim running, seems i cant count well
this is better
Code:#CONFIGcfg = _HS_OSC ; HS oscillator: High speed crystal/resonator on GP4/OSC2/CLKOUT and GP5/OSC1/CLKIN cfg&= _WDT_ON ; WDT enabled cfg&= _PWRTE_OFF ; PWRT disabled cfg&= _MCLRE_ON ; GP3/MCLR pin function is MCLR cfg&= _BODEN_ON ; BOD enabled cfg&= _CP_OFF ; Program Memory code protection is disabled cfg&= _CPD_OFF ; Data memory code protection is disabled __CONFIG cfg #ENDCONFIG ;pic12f675 ;In simple terms toggle a pin every 125 cycles ;start:;set gpio pin high ;delay 125 cycles ;set gpio pin low ;delay 123 cycles ;goto start CNT VAR BYTE BANK0 TRISIO=%11111110 ASM START BSF GPIO , 0 MOVLW 41 ;2 MOVWF _CNT ;1 DL1 ;122 DELAY = 2+3(CNT-1) DECFSZ _CNT,f GOTO DL1 BCF GPIO , 0 MOVLW 40 ;2 MOVWF _CNT ;1 DL2 DECFSZ _CNT,f ;119 DELAY = 2+3(CNT-1) GOTO DL2 NOP ;1 GOTO START ;2 ENDASM
Warning I'm not a teacher
I got a very nice answer on that subject
here
Hello François
Have an eye Here: http://www.leapsecond.com/pic/picdiv.htm
Alain
Great idea. They use external signal as PIC clock and then execute a timed delay to toggle output. So the output has the precision of the input clock signal! Brilliant!
Ioannis
thanks for your reply, i know ths solution with divider like 74xx390 etc ... CD4017 at 10 mhz ... not sure ...
objective : have a small unit to do the job !
thanks
francois
Bookmarks