sosc: in std_logic; -- This is the input.
...
signal soscc: unsigned(2 downto 0) := (others => '0');
signal soscr : std_logic;
signal soscx : std_logic;
soscx <= (to_x01(sosc));
soscr <= (something that will be '1')
...
uxo(0) <= std_logic(soscc(0)); -- Lit LED
uxo(1) <= std_logic(soscc(1)); -- Dim light pulsing LED
uxo(2) <= std_logic(soscc(2)); -- Dim light pulsing LED
uxo(3) <= soscc(0); -- Lit LED
uxo(4) <= soscc(1); -- Dim light pulsing LED
uxo(5) <= soscc(2); -- Dim light pulsing LED
uxo(6) <= soscx; -- Visually fine. 3/4 second blinking.
uxo(7) <= sosc; -- Visually fine. 3/4 second blinking.
...
process(soscx, soscr) is
begin
if soscr = '0' then
soscc <= (others => '0');
elsif rising_edge(soscx) then
soscc <= soscc + 1;
end if;
end process;
No oscilloscope? How many hours did you spend debugging JUST THIS PROBLEM? Several? You know you can get new scopes for like $200 and used ones more like free for hauling away. What is your time worth?
Of course availability and economic feasibility do depend on your region and personal circumstances.
But you say the solution has to be low cost which implies a commercial volume production interest so in such a case, again, what is your engineering time worth such that you can't have a simple oscilloscope?
74HC4060
74LVCU04
32kHz
How about a cheap as chips Chinese watch module - one pulse per second/1Hz for the second hand?
Personally, if deriving the 1Hz from the existing circuitry is in any way problematic, I would have gone for the 555 timer option.
The 555 is ubiquitous. It is used in all manner of equipment and has been found on some pretty significant boards - not just a beginners breadboard. You only need the 555, 2 resistors and a capacitor to get it working - plus another capacitor on the "control" pin, just to bypass any spurious signals.
Yes, they are easy to use, are very flexible and do a great job. It is probably the first IC many beginners start playing with. There is even a publication called the 555 Timer Cookbook ... which is all about that little chip.
Be prepared, though. If you have any respect for an analogue multimeter, this is cringeworthy....
Have you considered a Schmitt Trigger oscillator based on a single gate chip?I agree. That would be what I would have suggested too. If a buffered output is required, then there's a two gate variant, which doesn't take up much more room and only costs a little more.
Something as this: SN74AHC1G14 (http://www.ti.com/lit/ds/symlink/sn74ahc1g14.pdf), 2-5.5V, SOT23 so not incredibly small to hand solder.
At about 10 cent apiece even in smallish quantities (in EU e.g. on RS (http://se.rs-online.com/web/p/schmitt-trigger-inverters/0526381/), don't know in AU), you just need to add a couple of passives (possibly three, if we include a decoupling cap)..
Any 555 will be more expensive, require more PCB real estate and more passives.
Of course, if the problem is signal integrity, this might not be the right cure.
Still, we're looking at 1Hz not 1MHz+.
Have you considered a Schmitt Trigger oscillator based on a single gate chip?
Something as this: SN74AHC1G14 (http://www.ti.com/lit/ds/symlink/sn74ahc1g14.pdf), 2-5.5V, SOT23 so not incredibly small to hand solder.
At about 10 cent apiece even in smallish quantities (in EU e.g. on RS (http://se.rs-online.com/web/p/schmitt-trigger-inverters/0526381/), don't know in AU), you just need to add a couple of passives (possibly three, if we include a decoupling cap)..
Of course, if the problem is signal integrity, this might not be the right cure.
you don't describe the timeout you're trying to detect,
Have you considered any of the microprocessor supervisor ICs, commonly called watchdogs? ... but you might be able to directly apply a watchdog chip. They are the classic implementation for detecting wonky micros...
A very quick search found STWD100 from ST - this comes in a few (fixed) timing varieties, but more interestingly has a mode where you can have it constantly re-triggering which could give you a single part low frequency oscillator. Just an idea and probably not fully baked..
Not the cheapest solution probably though at about $1, but I'm sure there are many other options..
Another idea: If your design needs a real time clock, many RTC chips have a 1Hz output option.
I agree. That would be, what I would have suggested too. If a buffered output is required, then there's a two gate variant, which doesn't take up much more room and only costs a little more.
https://assets.nexperia.com/documents/data-sheet/74HC_HCT2G14.pdf (https://assets.nexperia.com/documents/data-sheet/74HC_HCT2G14.pdf)
I will assume you have good quality decoupling.
If you are using solderless breadboards, then it is traditional that you will spend more time debugging the breadboard than your circuit.
The period (1s) is almost irrelevant from a signal integrity PoV. What does matter is the rise/fall time, which is probably 1ns or so.
Realise that a traditional rule-of-thumb is BW=0.35/tr, and you will start to understand.
Back of envelope calculations...
Work out the capacitance, C, that an output is driving through voltage V. Work out the transition time, t. The current required to charge/discharge the capacitor is i = CV/t (from C V = Q = i t, ignoring exponential voltage rise)
Wires are inductors; assume 1nH/mm and work out the inductance in a ground or Vcc lead, L.
The voltage induced by the current spike charging/discharging the capacitor is v = Li/t (from v= Ldi/dt). That voltage appears in series with the signals on inputs.
Don't forget that you will probably be having several outputs changing simultaneously, which increases i and v :)
Would a simple multi vibrator circuit with some big electrolytics work? Like 470 or 47uf?
What about using a flashing LED as the signal source?
If component count is critical, 555 with resistor from pin 3 to pins 2&6 joined, cap from there to -ve. 3 components. Gives nearly equal mark/space, which is hard to achieve with standard circuit using pin 7. Limitation (of all 555 arrangements) is that it starts on an offbeat since the cap takes extra time to charge from 0v into the working range. If it's going to run continuously not an issue though.The 74HC14 circuit also has that issue too. The solution is to use two capacitors, to both supply rails.
The driving need is an emergency reset, which is for when the attached components (including MCU) get into an unrecoverable state. The idea is that you hold down all of the buttons for a few seconds, and it forces a reset. The "few seconds" bit is driving the need. My thinking was that it would also be useful for controlling anything else that requires long presses, timeouts, or similar.
Realise that a traditional rule-of-thumb is BW=0.35/tr, and you will start to understand.
Back of envelope calculations...
Work out the capacitance, C, that an output is driving through voltage V. Work out the transition time, t. The current required to charge/discharge the capacitor is i = CV/t (from C V = Q = i t, ignoring exponential voltage rise)
Wires are inductors; assume 1nH/mm and work out the inductance in a ground or Vcc lead, L.
The voltage induced by the current spike charging/discharging the capacitor is v = Li/t (from v= Ldi/dt). That voltage appears in series with the signals on inputs.
Don't forget that you will probably be having several outputs changing simultaneously, which increases i and v :)
Much of this is beyond my current understanding, but I'll do some reading and try to gain enough knowledge to put this to use. Many thanks for your thoughts on this one.
Why not get away from all the mess of sensitive high impedance circuits and large passives and program a PIC10F200 to produce the desired signal, either from its own internal oscillator, or by dividing down whatever faster clock you have available. You cant get much smaller than a single SOT23-6 or DFN package to do the job, and they are under $0.50 each in reel quantities, even after you add in the cost of factory programming with your code, so are fairly good on the cheapness as well.
If component count is critical, 555 with resistor from pin 3 to pins 2&6 joined, cap from there to -ve. 3 components. Gives nearly equal mark/space, which is hard to achieve with standard circuit using pin 7.
Limitation (of all 555 arrangements) is that it starts on an offbeat since the cap takes extra time to charge from 0v into the working range. If it's going to run continuously not an issue though.
The astable didn't work because the component values aren't very suitable. You need much lower collector resistors. It will work with base resistors in the range 10 to 100 times higher value than the collector resistors. Also, the Vcc must be less than 6v unless you have base protection diodes.
EDIT: stmdude: All buttons connected to CPLD, enough LEs for an AND-gate.
What about using a flashing LED as the signal source?
I can't tell if you're making a joke or if I'm missing the point. If the latter, could you elaborate?
Sorry about that. I wasn't very clear with my explanation. Get a blinking LED, like the one in the picture I attached. Put a resistor on the low side and put your probe between the resistor and LED. You're stuck with the frequency and duty cycle of the LED, but it's a pulse generator with two components.
QuoteSorry about that. I wasn't very clear with my explanation. Get a blinking LED, like the one in the picture I attached. Put a resistor on the low side and put your probe between the resistor and LED. You're stuck with the frequency and duty cycle of the LED, but it's a pulse generator with two components.
Right... so with the LED and the resistor and a supply of 3.3 V, there's a signal of perhaps 0.5 VPP (best/optimistic case)? Not really useful, in my opinion.
Assume C=5pF (one gate load, quite probably an underestimate), V=3V (might be 5), t = dt = 1ns (reasonable for a tp=7.5ns), L=50nH (2" of wire) in the ground lead.
Then the current spike from switching one output is around 3*5e-12/1e-9 = 15mA.
Then the voltage induced in the ground lead is 50e-9*15e-3/1e-9 = 0.75V.
So, can your circuit tolerate 0.75V spikes on the inputs, or will they cause internal logic to change state?
Don't forget that if you have more than one output changing in the same direction simultaneously, the spikes will be proportionately larger.
W.r.t. decoupling, ensure you have the right kinds of capacitor and that the leads are short and wide. Failure here will reduce the CPLD's PSU voltage, possibly causing internal state corruption.
Ok, cool.
So, the MAX V (in 3.3V LVTTL) needs at least 1.7V to register an IO pin as high. If you can get a pin on the CPLD to go high when all buttons are pressed, all we need is some external analog circuitry that takes (about) a second to rise from 0 to 1.7V.
This sounds a lot like an RC filter to me, and would be _a lot_ cheaper than using 555s or other chips.
Now, there is a slight downside to this approach. There's no "reset" of the charge in the capacitor, so if the user presses the keys for 0.5s, lets go of them for a very short time, and then press them again for 0.5s, it would count as a "1"/reset.
( It does discharge/reset though, but it takes a second or two before all the energy in the capacitor has drained )
74HC4060 oscillator/divider. The RC oscillator is two resistors and a cap. Set the oscillator frequency to 16 kHz and you'll have manageable (and cheap) component values. Runs fine at 3.3 V, consumes almost no current and costs a few cents.
Sorry about that. I wasn't very clear with my explanation. Get a blinking LED, like the one in the picture I attached. Put a resistor on the low side and put your probe between the resistor and LED. You're stuck with the frequency and duty cycle of the LED, but it's a pulse generator with two components.
How about a cheap as chips Chinese watch module - one pulse per second/1Hz for the second hand?
An interesting idea. If there was a part from a reputable manufacturer that I could purchase, yes. Otherwise, definitely not. Low accuracy is fine, low reliability is not.
CRAZY IDEA use a motor that spins at 60 rpm and put a cam on the shaft to activate a switch :D
I use the guts of 1.5v wall/desk clocks. The two outputs for the coil can be diode-ANDed for 1Hz, 30mS pulses.
Movements are quartz tuned and work fine for a long time plus are dirt cheap. But here's a link to someone else's take on this:
While ridiculous and impractical 'solutions' are on the table what about a bimetallic flasher bulb (http://www.microminiatures.co.uk/acatalog/Flashing-Filament-MES-Bulbs.html) driving the base of a power transistor? >:D :popcorn:
I bought this scope on Bangood and I am well impressed. Will work well enough for you to see your signal for $69 US.
https://www.banggood.com/search/dso112a-upgrade-version-2mhz-touch-screen-tft-digital-mini-handheld.html (https://www.banggood.com/search/dso112a-upgrade-version-2mhz-touch-screen-tft-digital-mini-handheld.html)
Peaceful zen or other psycho mantra thing. Bi.
.. it is enough to make sure that the attached MCU can be reset
.. it is enough to make sure that the attached MCU can be resetBut is it?
Personally I'd replace the FET with a schmitt-trigger input logic gate, e.g. a 74*14, where * can be almost anything including 74*1g14. That will circumvent some of the problems you mention.
Personally I'd replace the FET with a schmitt-trigger input logic gate, e.g. a 74*14, where * can be almost anything including 74*1g14. That will circumvent some of the problems you mention.
Thanks for the suggestion. I was thinking it might become necessary to do something like this. Unfortunately it starts to push the cost into the territory of the clock-based solutions.
I'll have to give this some further thought.
The 74HC14 circuit also has that issue too. The solution is to use two capacitors, to both supply rails.
(https://www.eevblog.com/forum/beginners/can-your-typical-electronics-hobbyist-benefit-from-a-spectrum-analyzer/?action=dlattach;attach=343090;image)
LTSpice simulation (https://www.eevblog.com/forum/beginners/can-your-typical-electronics-hobbyist-benefit-from-a-spectrum-analyzer/?action=dlattach;attach=343092)
It pulls it down to 0.297Vcc, which is below the 1/3Vcc specified. It may be marginal. I haven't checked the data sheet. The resistor in series with the discharge pin wasn't my idea. I found it on another site, but can't remember. I'm normally good with siting references. Sorry, I let myself down on this occasion.The 74HC14 circuit also has that issue too. The solution is to use two capacitors, to both supply rails.
(https://www.eevblog.com/forum/beginners/can-your-typical-electronics-hobbyist-benefit-from-a-spectrum-analyzer/?action=dlattach;attach=343090;image)
LTSpice simulation (https://www.eevblog.com/forum/beginners/can-your-typical-electronics-hobbyist-benefit-from-a-spectrum-analyzer/?action=dlattach;attach=343092)
The two caps idea is neat, however aren't the two resistors going to form a potential divider such that the trig/thrs voltage can only be pulled down to about 1/3 Vcc? Since the internal schmitt resets at about that voltage it's going to be marginal as to whether it does, or not. If you take your feedback from OUT you don't have that issue.
If you're worried about output loading affecting the frequency that way, use DIS as an open collector output instead of OUT. Call it a role reversal if you like.
Thanks for the suggestion. I was thinking it might become necessary to do something like this. Unfortunately it starts to push the cost into the territory of the clock-based solutions.
I'll have to give this some further thought.
£0.20 for 5 down to £0.03 in larger quantities, e.g. http://uk.farnell.com/fairchild-semiconductor/nc7s14p5x/ic-nc7s-smd/dp/1467334 (http://uk.farnell.com/fairchild-semiconductor/nc7s14p5x/ic-nc7s-smd/dp/1467334)
Don't forget the cost of subtle malfunctions discovered after shipping.
CD4060 oscillator/counter
- I'll need an open-drain output for the reset line. It is shared and multiple devices can trigger. Although I did notice a few Schmitt trigger inverters do have open-drain outputs.
You beat me to it. I'd recommend a Schottky diode, such as the BAT54, as the voltage drop will be much lower, than a silicon diode (around 300mV, rather than 600mV at 1mA), which will make the low logic level more reliable.- I'll need an open-drain output for the reset line. It is shared and multiple devices can trigger. Although I did notice a few Schmitt trigger inverters do have open-drain outputs.
A series diode can emulate open drain behaviour.
Ensure circuit behaves well with a slow rising edge on the /reset signal, determined by RC time constants.
- I'll need an open-drain output for the reset line. It is shared and multiple devices can trigger. Although I did notice a few Schmitt trigger inverters do have open-drain outputs.
A series diode can emulate open drain behaviour.
Ensure circuit behaves well with a slow rising edge on the /reset signal, determined by RC time constants.
You beat me to it. I'd recommend a Schottky diode, such as the BAT54, as the voltage drop will be much lower, than a silicon diode (around 300mV, rather than 600mV at 1mA), which will make the low logic level more reliable.
Could you not use an external divider to divide the CPLD's clock down most of the way? A pair of SN74HC4020s for example? With a 1Hz clock you then need to trigger a reset pulse of the appropriate length.
So I have been watching this for a while didn't know there was so many ways to do it. I would have done the multivibrator but I like to make analoge things. Which worked best for you?Could you not use an external divider to divide the CPLD's clock down most of the way? A pair of SN74HC4020s for example? With a 1Hz clock you then need to trigger a reset pulse of the appropriate length.
Thankyou for the suggestion. It might be a bit costly compared to the other solutions mentioned, both in terms of price and space. However, it could work well on a project that needed multiple power-of-two clocks.
So I have been watching this for a while didn't know there was so many ways to do it. I would have done the multivibrator but I like to make analoge things. Which worked best for you?
.. and, also a low voltage supervisory reset by using an ADC input to monitor your voltage source which in my designs, I find useful to stop other electronics when necessary.
get an attiny ,write a code like-:palm:
...
keep adding the nop(s) till the frequency is ok
get an attiny ,write a code like-:palm:
...
keep adding the nop(s) till the frequency is ok
Please explain besides it seems really lazy but I only know how to copy and paste code into the Arduino so I want to learn.get an attiny ,write a code like-:palm:
...
keep adding the nop(s) till the frequency is ok
Please explain besides it seems really lazy but I only know how to copy and paste code into the Arduino so I want to learn.get an attiny ,write a code like-:palm:
...
keep adding the nop(s) till the frequency is ok
DDRx |= 1 << whatever;
for (;;)
{
_delay_ms(1000);
PINx |= 1 << whatever;
}
Something else to consider - one common objection to using an MCU for simple functions is the hassle of programming it.
Now that Microchip own Atmel, you can use their programmming service to very cheaply pre-program ( and mark) parts, so they can be treated just like other off-the-shelf part.