Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21588 Discussions

Counter with setpoint

Altera_Forum
Honored Contributor II
2,089 Views

Hi everybody. 

I'm doing a project, that I have to make a counter using JK flipflops, and then i have to make a setpoint. 

 

The counter counts from 0-9... When i turn on the setpoint key, the counting must count from 0 to the number i chose. 

 

For example, i turn the key on when the counting is at number 7. Then the counter must go from 0 to 7. 

 

I just have done the counter, and it works perfect. But in every try the setpoint fails. How can i make this setpoint? 

 

Hugs and thanks, sorry for my english, im brazilian. 

 

P.S: Thats the counter image. The two blocks are the frequency divider (cause im using the 50MHz clock, and i need 1Hz) and the converter from the binary counting to show it in the 7 DIGIT display.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
951 Views

No one? 

People, i've been trying to do it all day long. Nothing works. 

 

Im using D flipflops; when the setpoint key is pressed, they get the actual number in the counter and store. then, i use xnor gates to see if the storage of the flipflops are equal the outputs of the counter; if yes, it may set the clear of the counter to zero. 

 

so, it counts from 0-9. then, i press the key, for example, when the 5 appears, i press. then the D ffs get the 5 and store. so, when the counting of the JKs get to 5, the xnor gates send all 1. then, i put all 1 in an and gate and send it to the counter to clear. 

 

ive been having problems to make this. every try, it fails. WHAT CAN I DO? haha 

 

thanks
0 Kudos
Altera_Forum
Honored Contributor II
951 Views

how does it fail? Could you show us your design?

0 Kudos
Altera_Forum
Honored Contributor II
951 Views

AAAH I'VE DONE! 

 

I just used D ffs to get the actual counting point (a key is the clock to the ffs). Then, when i press the key, the actual counting goes to the output of the ffs. 

 

The output of the counter (subtracted 1) goes to xnor gates with the outputs of the ffs, and it all goes to an AND gate and goes to the CLR of the counter. Then, if its equal, it goes to zero. 

 

Its cool. 

 

I cant post links yet, so if anyone wants the design, just send me a PM. 

 

= )
0 Kudos
Reply