# enl

Members

341

22

## Reputation Activity

1.
Good points (not just 2).  I think some of the bigger points are relics of the past, though.

Sure, there are some really deep calculations where you want 14 digits precision instead of 7, but I found that to be rare.  In my opinion, if there's something you're doing that needs 14 digits of floating point precision, you are doing something wrong and should re-architect (well, almost all of the time).  If you're doing a one-off computational model, then it's a different issue.  Maybe this is where the legacy is from, when C was a language used for modeling.  It isn't anymore, it's used for production.  Python or Matlab are generally used for modeling.

Another possibility is to do intermediate calculations as single precision, against a wider-sense double precision variable.  I did a fast JPEG encoder this way, it worked great.
2. enl got a reaction from jpnorair in Diode to offset a voltage regulator?
If you are trying to raise the output by using a diode on the ground terminal of the regulator, the diode will NOT see load current. Load current is returned to ground independantly of the regulator. The diode will see the quiescent current of the regulator.

The LE33C has an ill-specified quiescent current of something less than 0.5mA to 3mA, depending on load (ignoring the inhibit state, where the output is, for practical purposes, floating).

This is a pretty wide range (factor of 6) giving a variation of about 50mV for the diode drop (conservatively). The current is low enough that any diode that can handle 5mA is fine (pretty much any small signal diode). Power dissipation is about 2mW max.

If you need more stable output than approx 50mV, use a 1.5K resistor from the output to the ground lead, so you have an ADDITIONAL 2mA current through the diode. This will restrict the current variation to less than a factor of 2, giving you about 15mV max variation. Presumably, a given device will be more stable, but you can't count on it. The enemy of good design is ignoring the min and max values in the spec, and unspecified values (like the min quiescent current) really play hob with non-linear relationships like the voltage-current relation for a diode.

See crude MSpaint diagram. Might need to up the cap across the diode to 1uF. The data sheet isn't complete enough to know it there will be stability issues with this one. fc is about 100kHz with 0.1uF, which is well within the spec of the regulator for stability, but raising the cap to 1uF will bring the frequency down to about 10Khz.

3. enl got a reaction from bluehash in Diode to offset a voltage regulator?
It works. Put the filter caps to ground, not the the ref/ground pin of the regulator. As you have it, the filter caps can not source more current than the regulator quiescent current (due to the diode), and when the caps are sourcing, your diode drop will be very unstable, as the diaode current will vary.

You may also want a resistor from the output to the anode of the diode, if you use a more modern regulator, or need to tweak the diode current. With the '140 as is, you get about 6mA, and for a small sig diode (like the 1N914) you are in the zone. If needed, select the resistor to provide the appropriate bias current for the drop you need.
THis can also help stabilize the diode current, and drop, against the transient response of the regulator. I would also put a 0.1uF cap across the diode.

See the data sheep for inre info about using the '140 as an adjustable reg.

Edit: Also note that the diode does not see load current. It sees only the regulator quiescent current (about 6mA). A small sig diode is sufficient. DIssipation should be approx 4mW
4. enl got a reaction from spirilis in Diode to offset a voltage regulator?
It works. Put the filter caps to ground, not the the ref/ground pin of the regulator. As you have it, the filter caps can not source more current than the regulator quiescent current (due to the diode), and when the caps are sourcing, your diode drop will be very unstable, as the diaode current will vary.

You may also want a resistor from the output to the anode of the diode, if you use a more modern regulator, or need to tweak the diode current. With the '140 as is, you get about 6mA, and for a small sig diode (like the 1N914) you are in the zone. If needed, select the resistor to provide the appropriate bias current for the drop you need.
THis can also help stabilize the diode current, and drop, against the transient response of the regulator. I would also put a 0.1uF cap across the diode.

See the data sheep for inre info about using the '140 as an adjustable reg.

Edit: Also note that the diode does not see load current. It sees only the regulator quiescent current (about 6mA). A small sig diode is sufficient. DIssipation should be approx 4mW
5. enl got a reaction from zinob in Diode to offset a voltage regulator?
It works. Put the filter caps to ground, not the the ref/ground pin of the regulator. As you have it, the filter caps can not source more current than the regulator quiescent current (due to the diode), and when the caps are sourcing, your diode drop will be very unstable, as the diaode current will vary.

You may also want a resistor from the output to the anode of the diode, if you use a more modern regulator, or need to tweak the diode current. With the '140 as is, you get about 6mA, and for a small sig diode (like the 1N914) you are in the zone. If needed, select the resistor to provide the appropriate bias current for the drop you need.
THis can also help stabilize the diode current, and drop, against the transient response of the regulator. I would also put a 0.1uF cap across the diode.

See the data sheep for inre info about using the '140 as an adjustable reg.

Edit: Also note that the diode does not see load current. It sees only the regulator quiescent current (about 6mA). A small sig diode is sufficient. DIssipation should be approx 4mW
6. enl got a reaction from oPossum in Year clock
(Code is for CCS)

Noting that the standard clock runs twelve hour cycles, and that there are 12 months in the year, I thought, "What if I use the hour hand for months? What can I do with this?"

The result looks like a clock, uses a standard single phase quartz movement from the art store (cheaper and more consistant than the full clocks from Wally-world or Target, plus, I get the fun of making the face), but the hour hand shows months and the minute and second hands indicate point in month, using the standard Sumerian system, with minute hand being 60ths and the second hand being residual 3600ths of the month.

To keep the month indication correct, the rate must be compensated for the length of the month. There are four month lengths (28, 29, 30, and 31 days), and the cycle is four years. Sorry, no compensation for the year divisible by 100 coming up. This will require manual intervention. Then, of course, the batteries will have to be changed roughly 10 times before then, so not a big deal. The months are 1-48 to cover the four year cycle, with the beginning of the cycle being the year following leap year (no special reason, but since this is 2013, it means that I didn't have to bang the button a lot during testing). The 32KHz crystal provides a timebase.

The interface is dirt simple, but in no way elegant. NO pushbuttons to ground with pullup resisters and capacitive debounce for setting each of the month, day of month, hour, and minute. Feedback is in binary on six LED's. Simple. I used the Launchpad LED lines for the clock drive to make debugging easy. The interface is interrupt driven and not optimized for power-- I used a dummy loop rather than going to sleep while in the set state-- since it is infrequently used and the LED's will take one or two orders of magnitude more power than the processor while in set mode. See comments in the code for details.

During run, the timer interrupts every 8sec on rollover (16 sec doesn't work evenly in a month with 29 or 31 days, increasing software burden. Energy usage not significantly more than for logic to alternate interval size) and the interupts are counted. When the count reaches 1/3600th of a month (12 min for a 30 day month, less for 29 and 28, more for 31... see the table in the code), the clock mechanism is ticked, the counter is reset, and, if hte last tick for the month has been done, the month is changed.

Lessons demonstrated for new programmers:

Tables are your best friend, if the memory is available. Const tables go in ROM, and need not initialization, so they take no time to set up. Saves a lot of computation during run time.

Don't worry about efficiency (within limits) for something you only do once. The time/date set uses multiplication and division, which the '430 generally doesn't do in hardware. THere are warnings galore on compile. Doesn't matter, since there is plenty of memory even the smallest '430's for the software, and the power and time issues are irrelevent since, to paraphrase Daffy Duck, you only gotta do it once.

Inherently floating point operations can often be done with integers. It is worth spending the time with pencil and paper. The initial setting for position in month requires, on first look, real number computation. By a we bit of algebra and appropriate sequence of operation, only the single divide is needed (note that there are 7200 half-seconds per hour...) The initial setting is within 8 sec (one timer cycle) of one minute, and could have been more accurate  with another input for the second and precomputing the timer counter. In this case, it isn't worth it.

Simple input schemes can be used effectively.

Pushbuttons don't need debounce if they only get used once (the launchpad button on P1.3 for entering run)

Use #define as a way of building your test cases into code. #ifdef and #endif bracket the test cases to prevent compile into production code, but there are in the source for debugging later if needed, and for use if changes are made to re-feature/upgrade

Things that are open:

better interface

Self setting-- set the hands to 00:00, set the date/time, and the '430 steps the mechanism until it is in the appropriate location. May take a good part of  6 hours to synch (these mechanism's step at about 2/sec max)

In my case, much better shield for the programming interface. There is no pic for a reason. I built it from the junk pile. 4 mismatched buttons with loose, uninsulated wie all over.

If there are any questions or criticisms as to the software, let me know. It is not beautiful. I did not include a video, as it is quite boring to watch. About 12 min, tick, about 12 min, tick, etc.
main.c
7. enl got a reaction from spirilis in residing in NJ
New to forum, but not new to controllers and computing and doing things the hard way because I can.

Started with 8080, Z80, 6502, 8031, and IBM system 360 mainframes, doing software, then hardware and have only recently let myself drift to out-of-date. Wrote an IEEE floating point library for CPM on the 8080 (mumble mumble) years ago, did 44.1KHz ADC for Z80 systems (I stil have fond memories of the alternate register bank and non-memory I/O space), and have been teaching both hardware design and software for (mumble) decades. Used an original Basic Stamp as an ignition control for a bike back in the early 90's to replace the mechanical points. Still have one of the wire wrapped Z80 control boards I did for a job back in the 80's.

Picked up a handful of launchpads around newyears to play with. Done a few projects (8 channel temp monitoring/logger for the house to replace the industrial thermcouple sets I used to plan heating and AC -- attick, up, down, and basement, outside three sides, bathroom using DS18B20's; some clock projects; a few others), and have more on the table. I also spend time trying to convince my students that these are real computers, and are more powerful than what I used back in the day for word processing and computational work in engineering.  I sideline as a welder/machinist and mechanic for an NBIC boiler shop. (not much of a machinist, but the job gets done)... ahhh. The joys of an undirected life and mis-spent youth.....

Project posting or two to come soon.
×
• Blog

• #### Activity

×
• Create New...