# COUNTER CODING IN FPGA

20 Jan 14

Sir,
I working with the FPGA (XC3S400) UNIVERSAL DEVELOPMENT BOARD. i had a doubt about the counter coding,i want to count by segment upto 10,000,but i don't know how to write the coding for that. because the eight data lines for six segment are same.selection lines only different for each segment.so i don't know how to write the coding.

25 Jan 14

Hi Sekar,
If you wanted to show 2 different numbers at the same time you could use multiplexing. Multiplexing means that the 2 displays are on one at a time. This can be done by activating a common anode and setting the data with a number and then activating the other one (deactivating this one of course) and changing the number. If this is done very fast you will have the ilusion that both displays are active at the same time.
This trick works because the human eye can't perceive motion or things lighting up and shutting down if that happens at a rate of 50 HZ or faster (TV uses a similar technique). In the 2 display case for example a frequency of minimum 100 HZ is needed in order for you to think that they are active at the same time (50 HZ for e display * 2). If the frequency is a little lower, flickering will appear. If it's higher there's no problem; it's actually better because the displays will be a bit brighter.
Let's take an example: we start with anode1 at '0' level and anode2 '1'. They will be changed with a frequency of 200 HZ(so 100 HZ * 2, making them brighter). The data ports are set at first with the value 1111001 (1 in decimal). After 200 HZ the anodes will interchange values and the data ports will be set with 0110000 (3 in decimal). While the displays light up at the same time, you will only see the number 13 at all time.
With the above logic you can implement counter code. The Counter output should given to 7-segment display with above mentioned logic.

hope this one give some idea to implement your logic.

25 Jan 14

Sir,
thanks for your explanation.I understand the concept.but I don't know how to implement this concept in VHDL coding.So plz send one Sample coding for this program.

28 Jan 14

Hi Sekar,
Please find the attachment for counter coding from 0 to 1000 which shows output in seven segment display.
It is good habit to try yourself before posting.