Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by enl

  1. For the sampling strategy, you probably don't want the repeated strategies. If it were me, I would use ADC_SEQofchannels for the two channels. As for the dead zone, I generally estimate then adjust it during testing. The value I tend to start with is about 5 degrees (2.5 to either side of the zero)or 2 to 3 percent for linear slides, unless the pot has very small mechanical range (less than 180 degrees, shorter than 10mm for linear). You don't set this in the ADC. That is pure arithmetic after reading, with an approach described above. There are other approaches.The one above doesn't do
  2. I can't address everything you asked (I haven't used the eComp) , but as to bidirectional control, that doesn't matter. Presume you get a value in the range [0..0xfff] as your control value. There are several approaches, but they all boil down do, essentially, subtracting 0x800 from the read value to put half of the range negative, and half positive. For the PWM, if you have a bidirectional driver (inputs are a direction and a PWM pulse) you use the sign for the direction output and the magnitude (absolute value) to set the PWM, probably with scaling. For a driver like th
  3. You have a wide variety of clock options from 48MHz down to about 10KHz, on board, the ability to use external clocks (crystals or other sources), and direct support for 32768Hz crystals (and others). You can't reliably go beyond 48MHz, but the internal clock generator will give a fairly smooth range down to the low end (I don't recall the bottom end of the DCO, but the LFO-- ultra low power, low frequency onboard unit- is below 10KHz) Most libraries and language families will provide a way to select which clock and set the rate for the DCO or other source. See http://www.ti.com/
  4. It is a clever solution, and I learned a few things I hadn't realized about the interrupt flags, but I do think it is a solution in search of a problem. To me, it isn't that the interrupt handler is the only way, or always the best way, but that it is simple and has a low penalty in cycle usage and power, relative to polling this way. Fewer clock cycles per loop (single mask to check one bit, rather than several changes to control register states and masks), and, since this is likely to be a rare event at code speed, net minimal hit. Without working out the numbers, I would guess that eac
  5. The few times I have needed to do this, I used interrupt handlers that did nothing but set or reset a bit to reflect the state.
  6. As a general rule, you should never use file or directory names with spaces in them. They tend not to work well with many tools, and tend not to work well across platforms, and do not work at all with some environments/platforms. We have all seen the abomination that occurs when a URL contains a space, and some of us have seen environments where some superstar realizes that, on windows, a filename or directory name can consist of nothing but spaces. Have fun with that. It does not help that Windows does not handle paths consistently across contexts, and, though better than in the days of Win95
  7. Best advice I can give you is to breadboard it. The LM3915 is pretty rugged, as long as you don't mix up the power supply pins, and everything else except the analog switch is, as well. The frequencies are low. This is very bread-boardable. The 4000 series IC's are not as static sensitive as some, but they do take some care. ALL unused inputs should be connected to ground or V+. I generally use about a 10K resistor, rather than direct connection, primarily because there are some failure modes that can occur during power cycling if the inputs are direct connected to V+ or ground, and the resis
  8. See, for example, https://web.stanford.edu/class/archive/physics/physics105/physics105.2002/datasheets/Analog_Linear_OpAmp_ICs/LM3915.pdf pages 8-21 I like this IC family, and have used them many times for many things. I miss them, but not much.
  9. Does anyone have recommendations for a current probe for use with an oscilloscope? I borrow a Tektronix from work when I need one at home, but a friend now needs one for field work and needs to be able to look at moderately short pulses (1 microsecond-ish), and he needs to buy out of pocket. The low end Tek, which would do the job, are about $700, but there must be other options that are decent these days for 1mA resolution. The specs for the Hantek CC-65 don't really do it, other than price. Suggestions?
  10. I am not sure what you are trying to ask, or what processor you are working with, but it appears that you don't have a good understanding of fixed point representations The value from the DS18B20 is a signed (2's complement) fixed point, 16 bit value. Cutting off the last four bits using a right shift that shifts zeros in to the left removes the sign. The shift can be done so as to preserve the sign by using the appropriate arithmetic right shift (arithmetic right shift RRA in assembler on the MSP430, or right shift operator in C on CSS). This will give an integer in 16 bit 2's co
  11. Depending on the flash unit, the max current during charge may be quite high, 5A or more, judging by my Vivitar. The LM317 will current limit (the exact value depends on the version and manufacturer of the device), and the supply you are sourcing the LM317 from may also limit current. If the LM317 isn't warming up, it is likely the supply, not hte regulator. Another possibility is that the supply for the lm317 isn't high enough voltage for the regulator to do its job. It is not low drop out, and the max current goes down as the drop across the regulator goes down. Again, the exact voltage depe
  12. Could you tell us the issue so that others can avoid it, or recognize it when a mistake is made?
  13. "if (bar[0]==NULL)" won't look at the pointer value, but instead the memory the pointer references, so that is right out, unless you want to know if the parameter is an empty string (only the null terminator) "if (bar == NULL)" should work, in particular if you explicitly pass NULL in since you are comparing a value to itself, as should "if (!bar)", since NULL should be 0. I just checked both (using gcc on a windoze machine) and they work as expected, so I can offer no insight as to why you would have a problem. I would suspect that you are seeing a symptom of some other issue than p
  14. In my first reply to the "true random number" thread, the last code block gave weird behaviour. The code editor opened, but refused to close. The code shows in a code block, but, when editing the post, the block can not be selected and acts like regular text.
  15. (continued, due to editor throwing a fit on last code block in previous post) Your example: ( {1839765.71, 1839765.79} ) ... But only move the last digit (from 1 to 8) Presuming that you mean the last digit is selected from [1, 2, ..9], could be written as randomd(1839765.71,1839765.80,9); Again, note that the randomd() function DOES NOT include the right endpoint, so b is one least count greater in the function call than in your example. If you want the upper bound included, the function gets an n-1 for the division in offset.
  16. Notation: [ and ] indicate that the endpoint is included, ( and ) indicate a range that is open (endpoint not included) First, I will presume you have a way to produce a random sequence of values (standard function or your own). Depending on the toolchain and libraries you use, the most common results of this are: A float (or double) [0..1), an unsigned (int or long int) over the full range of the type, or an int in a specified interval [0..n). The function to produce a bounded integer can be written several ways, but the two most common are // return a random value from the interval
  17. A good bench is at the top of the list. I have an industrial assembly bench as my primary space with a work area of 1500mm by 700mm. It came with outlets mounted in the shelf faces, the front of the work area, and the back f the work area, but I ended up adding several more duplexes (4, for a total of 8 more) as well as a few 2A USB sources and an IEC320 strip (I scored a bunch of 600mm IECmale to female cords at Eli Heffron's back in the late '80s. They still come in handy) Power is key, and not just for electronics work, These power the scope, logic ananyzer, several meters, computer, monito
  18. Am I reading correctly that this is with the LM35 not connected to the input pin? In other words, there is nothing connected to the input pin? If this is the case, then the potential on the pin will float, generally to about half of the power supply, give or take (depends on the device) and, being configured as an input, it will have very high impedance, so it will pick up noise. You would be measuring more the properties of the multimeter and its interaction with the floating input than a real potential.
  19. Most of his talk was not about C++, but about how to social engineer others into adopting in a non-supportive environment. It was a religious rather than technical exposition, as many Java talks, for example, also are. As to the data, I buy it. The technical points made are that strong typing reduces run time bugs is true, under the umbrella that only certain flavours of bug are caught, but these flavours lead indirectly to bugs of kinds not caught directly. Another advantage of strong typing is that, properly used, it can let the compiler do better optimization. His test case, a
  20. Ah. I went through the log and saw that I had added the site as an exception on one machine (one I generally use for such) in 2015. Tried accessing from the shop machine today. I am surprised I haven't noticed before, but, then again, the shop machine has all of three bookmarks in the browser, since it is generally used only for the shop gear.
  21. It appears that 43oh is rejecting https connections (browser: mozilla, system windoze8, urls tested: https://www.43oh.com/ https://forum.43oh.com/ )
  22. I presently both practice and teach, so, in reference only to the engineering side, which is maybe 30% of my professional life these days: How many engineering positions have you had? *4 or so in the last 30 years. Current engineering position has been about 10 years, and is a different field than my degree (mechanical eng/welding is the core scope, but my degree is semiconductor fab/computer eng. I cover a wider base than that, mostly by being liaison between the company and clients or inspectors) I haven't actually worked primarily in my nominal field since the late 1980's.
  23. The board sockets on to the power header The 5-pin with the cable going to the right is for a button and double pole, center off momentary switch for adjusting the scale in operation. The software does linear interpolation from 0 to 100 degrees F, and allows for key points every 10 degrees. The three yellow wires go to the remote sensor (DS18B20). The mounting is leftover oak from redoing a floor. Glued up, planed, bored for the meter and the electronics, and finished to hang on the wall. The circuit board is mounted by putting epoxy in the pocket and dropping it in. Power board on. The
  24. I spent some time last year setting up an analog meter driver/thermometer for a client, and at the time, I went through my stock of junk^H^H^H^Hreclaimed parts and found a phase angle meter with degree graduations on it. I said to myself "since I alredy wrote the code and did the dev work on someone elses dime, I should throw one together for myself". A year and a half later, the holidays hit and I was looking for something to do instead of paperwork for work. So, I layed out a single sided board (the original was on a launchpad), cut it on the mill, and populated it. There was a
  25. Presuming you are talking about a processor with no support in hardware for division or multiplication: In the absence of hardware support, the fastest is bitwise calculation akin to long division. The cycle is basicly subtract then replace if less, followed by shifts. The structure is similar to long division, and is about the same number of cycles as a single division. This is one-cycle-per-bit in hardware, but a bit more work in software. Figure two shifts, a mask, and a subtraction, and either another mask or unsubracting, plus loop overhead. You may need a 32 (or 24) bit accumulator f
  • Create New...