# Overflow and underflow LED

Discussion in 'Homework Help' started by Legomaniac2311, Nov 12, 2014.

1. ### Legomaniac2311 Thread Starter New Member

Oct 2, 2014
14
0
I am working on a project that needs to provide overflow and underflow detection.

I'm not sure how to accomplish this task.

I am using 3 74LS190 chips as my counter stage

using 2 leds for overflow/underflow detection:

have one go on and stay on when the count goes below 0
and the other do the same when it goes above 0

both should return to the off state when the count is within 000-999

I know I need to use the TC output of the 74LS190 and create some sort of latch to hold the LED on during the time period where the count is over or under, but I am just at a loss of how to accomplish this.

Thank you!

2. ### Papabravo Expert

Feb 24, 2006
11,154
2,180
Your statement, as written is imprecise. The only values you can represent are 000-999. All possible values of the three counters are within this range. You might be thinking of using 10's complement notation where the unsigned values are mapped into a signed ranges such that positive numbers are in the range 000-499 and negative numbers are in the range 999-500. You might also be thinking of some mechanism to keep track of which direction things happen.
000 --> 999 is underflow, followed by
999 --> 000 is overflow, on successive counts
doesn't look like that works too well.
Can you elaborate on what representation you are thinking about and how you detect underflow and overflow.

3. ### Legomaniac2311 Thread Starter New Member

Oct 2, 2014
14
0
i understand that the only numbers represented via the 74LS190s are 000-999.

however, if the count continues to move forward i need led representation that the count is actually over 999 (up count)

for counting down when the count goes from 000-> 999 i need to show that the count is below zero via led representation

so for up count 000-999 is within range no LEDS.

so for down count 999-000 no LEDS; however when the count goes from 000->999 then the led will illuminate and represent that the count is out of range or underflow.

4. ### Papabravo Expert

Feb 24, 2006
11,154
2,180
You did not appreciate my example. Please pay attention.
Step 1: count goes from 000 --> 999 this is underflow LED goes on; so far so good.
Step 2: now count direction changes and goes from 999 --> 000; is this normal operation or overflow?
Point is you can't tell from just the values alone. If underflow is set then it is normal. If underflow is not set it is overflow. Is that correct?

Same thing happens with overflow
What happens if overflow is set and and you count up 1000 more times. Call this double overflow. Will I have to count down at least 1000 times to reset overflow?

5. ### WBahn Moderator

Mar 31, 2012
20,237
5,758
Think about what you are saying (and what Papabravo has been saying).

You say that both should return to the off state when the count is within 000-999. But the count is ALWAYS within 000-999! A three digit counter formed from '190 chips is not capable of representing any count that is not within that range.

So you need to think carefully about the behavior you want, which is tied directly to what it is you are wanting to accomplish (i.e., the WHY of it -- why you need to provide overflow and underflow detection). Think about the question that Papabravo asked in terms of what behavior you need if the counter counts up and overflows multiple times. When do you want the overflow flag to eventually be cleared?

If you need to capture multiple successive overflows or underflows, then you need to decide how many and what to do if that number is exceeded. If the number is small, say four or less, then you might consider using a fourth decade counter as a sign digit. If it is zero then you have no overflow/underflow. If it is 1-4 then you have overflows and you light the overflow LED. If it is 6-9 then you have underflows and you light the underflow LED. If it ever hits five then you light and latch both overflow and underflow to indicate an unrecoverable condition that requires a reset. At that point you have to decide if you reset just the sign digit or if you reset all of the digits. That would depend on the application.

Legomaniac2311 and Papabravo like this.
6. ### Legomaniac2311 Thread Starter New Member

Oct 2, 2014
14
0

I guess I didn't explain it properly, and I do appreciate the feed back!

basically i have a +- on my led as well. the only count generated from the 190's is 000-999 and when i change from up to a countdown 000-999

so when the TC output of my 190 goes high (to send out a signal saying overflow) (up count)
or when it drops below zero (underflow) (down count)

I need to some how latch the TC signal output as a high to keep my led illuminated during the time it is below zero. I'm sorry if I'm doing a terrible job of explaining this, but basically if my (-) on my led is lit showing a neg number I need to have the led on for underflow. and when the TC goes high on the up count sending out a signal for overflow I need to latch that signal until the count is once again within range.

(i am fully aware it never really goes out of range bc the counters will always reset after reaching a count of 999. Sorry for the delay in response as well. Ive just been over thinking this entire thing and thought that I had actually figured it out, but my leds are still staying on even when i am "within range"

7. ### Legomaniac2311 Thread Starter New Member

Oct 2, 2014
14
0
+/- on LCD (not led)

8. ### Papabravo Expert

Feb 24, 2006
11,154
2,180
You're right words just cannot describe what is going on and I give up. Without a schematic I doubt any relevant help will be forthcoming.

9. ### WBahn Moderator

Mar 31, 2012
20,237
5,758
You still need to address what happens AFTER you latch the overflow/underflow indication. Let's say it overflows. How long do you want the overflow indication to remain latched? Until you get an underflow indication? What if it overflows and then overflows again? Do you still want it to show normal after it sees an underflow, even though it will still actually be overflowed.

You need to detail PRECISELY what the intended behavior of the system is supposed to be.