

The whole IC gives the output 4 bits which counts from 0 to 15 in binary. The IC is made up of two counters one is mod 2 counter another one is mod 8 counter. The 74LS93 IC comes up with two reset pins, two clock pins, and four output pins. We can use the microcontroller or timer IC for pulse input. It consists of 4 JK flip flops which act on the input pulse no matter how we gave the input pulse. Here we will discuss 74LS93 which is a four-bit counter. Both these types of counters use the flip flops to count the binary digits. Counters come up in two form Asynchronous and Synchronous counters. The output of the counters can be used in multiple devices as pulse counting or for generating interrupts, etc. Counters have a major role in every electronics device. Each digit should be equal to its value divided by two (simple shift right), plus either five or zero depending upon the state of the next higher digit's LSB.74LS93 or SN74LS93 is a 4-bit binary counter. Incidentally, it's possible to use the reverse approach to convert a BCD number to binary. When using more than two digits, somewhat fancier logic is needed, but it may still be worthwhile to use the same registers for holding the binary number and BCD result. In the particular case of two digits, one could preload the bottom three bits of the register with the three MSB's of the number, and the top 4 bits with the bottom four bits of the number, and simply not bother with any BCD logic for the upper digit (since it should be 0-9 anyway). For the general case, you'll have to arrange logic so that the portions of the register which hold part of the number in binary format have the BCD logic disabled so they act as straight shifter.

If desired, one may use the BCD register to shift out the original number. This approach may be used with binary or BCD numbers of any size, observing that the carry out of one stage can't immediatley affect the carry out of the next stage until the next clock cycle. Feed such a circuit a binary number MSB first and after all the bits have been shifted in it will hold that number in BCD. The cheapest method in terms of circuitry is probably to have a clocked circuit which, loaded with some number N in BCD format, and fed an single-bit input C, will load itself with 2*N+C on the next clock cycle. Many, many things in FPGAs reduce to "write the code in whatever way solves the problem without too much fuss and let the compiler do the dirty work." Code generator programs are your friends.ĭoes the device have to do the conversion in a single step, or can it be an iterative process?

v file and feed it to your FPGA compiler and let it do the dirty work. doesn't matter, as long as you're familiar with it) that generates the following output.Īlways for each number from 0 to 99, generate this group of lines: 7'd_: beginįill in the appropriate values where the _ are. You're supposed to do this with an FPGA? Write a program in some language (C, C++, Python, Perl.
