View previous topic :: View next topic |
Author |
Message |
guy
Joined: 21 Oct 2005 Posts: 297
|
CLC for JK FLIPFLOP |
Posted: Wed Aug 31, 2022 2:10 pm |
|
|
(PIC16F18855)
Hi! I want to use the NCO with a clock half the speed of HFINTOSC. For this I want to use the CLC set up as a JK FLIPFLOP (freq. divider).
Configuring the CLC correctly seems impossible...
If someone can post the setup code I would highly appreciate it.
Thanks!!! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19559
|
|
Posted: Wed Aug 31, 2022 11:41 pm |
|
|
This thread:
[url]
https://www.ccsinfo.com/forum/viewtopic.php?t=55128
[/url]
Has a CLC being setup as a flip flop.
Wrong clock source for you, but this is only the input selection.
Should give a good clue as to how to do this. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19559
|
|
Posted: Thu Sep 01, 2022 1:30 am |
|
|
Reading on, slightly puzzled. A divider would normally be done with a D
flip flop, not a JK flip flop.
You simply feed it's output inverted back to it's input and clock it from
your source clock. It's output then inverts every clock cycle. Result /2. |
|
|
guy
Joined: 21 Oct 2005 Posts: 297
|
|
Posted: Thu Sep 01, 2022 1:04 pm |
|
|
Ttelmah wrote: | Reading on, slightly puzzled. A divider would normally be done with a D
flip flop, not a JK flip flop.
You simply feed it's output inverted back to it's input and clock it from
your source clock. It's output then inverts every clock cycle. Result /2. |
Thank you Ttelmah, it only goes to show I'm no expert... I wouldn't know how to configure it that way, I just want to move on with the project.
Any help would be appreciated. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19559
|
|
Posted: Thu Sep 01, 2022 10:25 pm |
|
|
No, actually this is historical.
In the first days of logic gates, JK flip flops were the first ones introduced.
They also involve one less gate than D flip flops. So the earliest books use
JK's for everything. However once D's became common, for dividers they
'took over'. For the CLC, either can be done, and there are less connections
to setup to use the D. |
|
|
|