Jump to content
43oh

enl

Members
  • Content Count

    346
  • Joined

  • Last visited

  • Days Won

    22

Posts posted by enl

  1. Well, since no one else bit yet,.....

     

    I think the root of the problem is conceptual. It works when run using vis studio because you are running it on the host. The host has a file system, Python interpreter, etc, and also has a full operating system with command shell needed for the system call.

     

    Once you upload to the tiva, there is not a full OS, filesystem, etc, no Python interpreter, and no command shell to handle the system call.

     

     

    If you are trying to shell on your host PC, then you need to have your code on the tiva communicate to the PC (via serial, USB, TCP/IP, wifi, other), which is another can of worms. One model for this is build a PC side application that listens to a serial port, and your tiva application sends data via the serial port to the PC. The PC application can then handle the data itself or repackage it for something else, maybe via a system call.

  2. Deeper issues:

     

    The structure you have is actually fine if you want a SINGLE blink per input. Change the inner 'while's to 'if's.

     

    If you want repetitive blinking, with the inputs changing the state, the structure you have isn't really ideal, but can be used.What you might try is adding an additional condition to each of the inner while loops, similar to this:

    while (incomingByte =='1' && Serial.available()==0)
    

    This will cause the inner loop to end when another input is available, so that the outer loop can read it.

     

     

     

    A better overall structure for the code could be selected, as well, but I will avoid that for the moment.

  3. There are several ways to interpret the root issue, so I'll pick one:

     

    When the input is '1', the first inner loop is entered, but never exited, as incomingByte is never changed within the loop.

     

    I'll spend a few minutes to address some other things in another post...

  4. I have been continuing through the 3rd, and have continued to find that it is growth from the second. The only flaw (ok, confusing thing) is the references to the (forthcoming) ancillary text. The introduction makes it clear that the `x' references are to the ancillary text, but in reading, the frequent references were not as clear... they are nominally in italics, but ONLY the chapter number (for example `3x') is, and the size and form do not stand out. On the first reading, they appeared to be unresolved editorial marks, even though I had read the introduction where the form was described.

     

    I have made it through the third chapter, and still recommend it strongly, with the previous caveats (not a zero background intro, etc)

  5. After a good bit of waffling, I decided that it is more appropriate to bring back this thread than start a new one....

     

    Looking or information about a binocular scope....

     

    I just picked up a Nikon SMZ-U bin scope with diascopic illuminator stand, beamsplitter (for second path, primarily camera), C-mount adapter, and camera. Unforunately no co-ax illuminator (and I am NOT paying over $1000 for one), so I will be making up a ring, eventually. Right now using an old fluorescent ring bulb desk lamp.

     

    Questions I have, among others, are primarily about the camera and the stand: Techni-quiop Micro-mac VII (type HAD-CCD, mod t-Q/VDC) It has NTSC and Y/C outputs, but power supply is missing.  No clue what it wants. Anyone have a clue?

     

    Second, anyone know about the stand? It is missing the stage, the reflector (which I think is supposed to be specular/diffuse changable), and the reflector mount. Also, the power supply seems to be bad, but I can deal with that. Anyone ever seen the inside, or have a repair book?

     

    For a not-very old machine, that was maybe $5000 to $10000 new (depending on configuration) I was surprised that neither Nikon nor Techniquip show ANY info on their sites. TQ no longer does cameras, and Ican't find the microscope on the nikon site at all...Only the original SMZ, and the current numbered models, which are different.

     

    Ideas? (figured I'd start here before going to microscopy forums.... Can't hurt)

  6. There are several ways, and which way depends on the accuracy you need in the result and how frequently you need the result.

     

    For example, if you only need the light value every few seconds, using a counter to count the output pulses for 1sec gives you the frequency directly.

     

    If you need the light value 10 time per second, counting for 1/10s, and multiply by ten

     

    If you need the value on demand, quickly, then you can use a timer to measure the length of a single, or small number, of pulses (get the period, which is 1/f), and take a reciprocal to get frequency.

     

    The longer you can measure, the more precise the result, since the measurement will be done by counting pulses, and the count will always be +/-1 or +/-2 (depending on synchronization conditions). The net result of this is that at HIGH intensity, with HIGH frequency, best precision is by counting cycles from the sensor, the longer the better. At LOW light, with LOW frequency output, the best precision is timing the cycle from the sensor.

     

    For example: If you are interested in low light for photographic exposure, you would time the length of the pulse using a timer and capture mode. The output of the sensor goes to a capture input, the timer is configured (details depend on the application and language/programming package used) and the number of timer timer clocks  is counted and stored in the appropriate CCR automatically. This is automated in many libraries. For example, there may be a function such as "pulseIn" in the Arduino toolset to time the length of a pulse. Sometimes quite precisely, sometimes less so.

     

    For example: for high light levels, you can set the timer to cycle at, say 1/10th second. The output of the sensor again goes to an appropriate timer/counter input. Clear a counter at the beginning of the cycle, and read it at the end of the cycle. Again, this is a common process, so it is pretty well automated and many libraries provide a tool to do most of the heavy lifting for you.

  7. Solar cells have a pretty high output impedance, compared to a battery. The open circuit voltage can be a good bit higher than the design (loaded) voltage.

     

    In your application, the battery is acting to stabilize and regulate. With the battery, you get an equilibrium that is set by the battery charging rate/charge state/terminal potential/temperature relationship. This provides regulation in a manner similar to how the battery in a car or motorcycle stabilize and regulates (exactly how depends on whether the system is a generator or alternator, the regulator type-mechanical or electronic- and other things as well). Brighter sun, where the open terminal voltage of the PV cell would be higher, the battery draws a greater charging current, keeping the voltage down, with the current determined by the difference between the open circuit voltage, the battery voltage, and the effective internal resistance of the battery and the PV cell at the operating conditions.  When the battery is near full charge, the current drops, and the terminal potential goes up, leading to your need to load the PV cell to keep it down.

     

    More to it, but this is about the limit of my knowledge these days. When I was fresh out of school and in the semiconductor lab (I hate the suits) this was one of the things being played with there, but that was several generations ago. I remember something about source resistance being a function of carrier mobility, incident light flux, current density, and......

     

    This is why both battery charging systems and solar conversion systems are a specialty that should be left to the specialists for critical tasks.

  8. As a side note: I grab supplies from desktop computers on a regular basis. Modern ones generally provide 12V@5 to 15A (or more), as well as 5V@10A (or more) and 3.3V@10A (or more). They are often free from machines that have some other failure, such as hard drive, or so full of dust as to overheat the processor to failure.

  9. There are a bunch of issues here. I'll address a couple.

     

    First is the issue of isolation: In general, it is a good idea to isolate derived low voltage from the high voltage source

     

    Second is regulation: if the target required reasonably well regulated voltage, then some means is needed to ensure he regulation

     

    These lead to the commonly applied options (there are others, but they really shouldn't be implemented by someone that isn't quite conversant with power supply design and safety): Transformer voltage conversion and isolation, followed by regulation.

     

     

    The two traditional methods (over the last 50 years) are to use a transformer to reduce the potential, filter with a capacitor, then use either a linear or a switching regulator to produce the output voltage. Today, there are integrated switching solutions that make this the preferable method for currents greater than maybe half an amp. TI, National, Maxim, and pretty much every other manufacturer of power supply IC's have reference designs for such applications, and these should be implemented directly for reliable service.

     

    Rectification at high voltage (220V, in your case) will produce high, unisolated, voltage (300VDC or more in your case) that requires an experienced designer to safely deal with. DO NOT DO THIS. If you need to ask the question, you are 1) not ready to handle this, and 2) smart enough to realize that you are not yet ready to handle this. Good for asking. There are solutions for HV rectification (and many commercial supplies use them)  but they require good understanding of switching supply design to implement with proper isolation for safety.

     

     

    If I was going to make a recommendation, I would say transformer to 12VAC to 24VAC, rectify and filter (producing about 15 to 17VDC for 12v V or 30 to 34VAC for 24V transformer,with some ripple with the appropriate filter cap) and use a switching reg running at 100KHz or so. I am a few years out of date on this so don't know what the best choice today is. There are several TI options, as well as from other manufacturers. The last time I dealt with this was about 6 years ago, and the design was roughly 500W, converting -38VDC to +12VDC. Used a National 5pin switcher, which required a hand wound toroidal. Design was close to reference design from the data sheet. The topology you are looking for is a buck converter. These can be very efficient, even with low voltage drop, and provide very high current outputs.

     

    I would NOT recommend that you do this without more experience, but if I needed to do this without a transformer, I would use one of the available buck converter IC's designed for high voltage input. They are available, but come with some real risks for damage to equipment or personal injury/death if not imlemented correctly.

     

    EDIT: elaboration last two paragraphs

  10. I have, to this time, done close review through ch2. I have submit two errata (not bad for first print). There are about a dozen alreadty listed on the H&H site

     

    I have been quite happy with the changes overall, in particular to ch2 (bipolar transistor). I will update as I continue close reading, and would encourage any other that have the text to add their to this.

     

    There is some elaboration vs 2nd ed for switching with transistors, in particular a Schmidt trigger application, as well as a few new things appropriate for low voltage (3v) drive. They open with transistor as a switch, whereas previous editions opened with (linear) current amplifier. A little change in the pure analog side with an emphasis on current source that, to me, fits well with how I have approached things for years. In prior editions, they began with the emitter follower (a good approach when leading to the common emitter amp), but they now break it down into two conceptual pieces explicitly: current source and resistor to convert current to potential.

  11. There was a tremendous thump on my porch. The cat spun out hard, regained traction, and headed for under the couch. I opened the door to see the postman walking away and a large box sitting there. I opened it. A gold colored book. The third. has arrived. The cat reappeared, tail fur puffed out more than I have ever seen, sniffed the book, and promptly began dismemberment of the box.

     

    Then began the odyssey: reading the thing

     

    I have only done a partial look through at this time. It will take time. There are a LOT of changes. Much more a new book than a new edition, in many ways.

     

    Highlights:

     

    additional appendices and additions to the old ones. For example, a short intro to Spice. Nice for the students. It is correct, unlike many, many of the online tutorials. A short addition to the o'scope section for digital scopes.

     

    A decent (yes, this I read all of) chapter on microcontrollers. Not detail heavy. A good overview of use, architectures, some examples, a brief comparison guide. Pro: this now in the book. Con: not much to it. It is made up for by updates in the other digital electronics chapters. I will vote overall win, as WAY too broad an area, with too many options that change quickly, for much detail in a long-life, comprehensive text.

     

    New chapter on PLD's that looks good.

     

    Lots of updates to analog chapters.

     

    Missing is the section on construction techniques (unless it was blended into the main text somewhere). That was one of the parts I most often directed students to, as there really haven't been significant changes over the years. (protoboard, PC board, wire wrap, etc, though there have been changes in how frequently each is used with the dominance of surface mount components and easier PC board production compared to 20 years ago)

     

     

     

    Overall review/summary: it was worth the money to update. I have used 1st and 2nd ed.s since they came out as references for all of those things I don't use often, reference tables for part selection, and as references for students to look through. I would still recommend this to a student, in fact more than the outdated 2nd ed, with the caveat that this is NOT a barebones introduction to electricity. It has the target audience (advertising notwithstanding) of a student that has a basic understanding of DC circuits, math at the level of trig (or intro calculus), and basic physics concepts from an intro E&M  course.

  12. Ok... wow...

     

    First: the teacher will come out

     

    Use the code tag (the <> at the top of the window) to preserve formatting for code. It also helps preserve sanity....

     

    What algorithm are you trying to implement (insertion sort? selection sort? Bubble (shudder) sort?)

     

    Also, comments help a lot to indicate what you are trying to do, and help YOU to see problems as you write the code

     

     

     

    THat said, Your loops (the jnz at the end of the inner and the outer) are both jumping to the Swap label, and you are never doing the comparison after the first time. This is the core problem.

     

    THis is, in part why I ask what algorithm you are trying to implement, since the index handling and comparison/exchange schedule are not the same with different algorithms, so I can not help you fix the problem without more info.

  13. 8051 (and derivatives) will not die as long as a) there are applications for it 2) it is cheap iii) there are legacy applications where there is no reason to replace it/recode -..) manufacturers keep upgrading the peripherals to meet new needs

     

    That said, I haven't touched one in maybe 20 years. Or a PIC for a good 10.... I wasn't a great PIC fan when they hit the market, and still am not. Both architectures serve a purpose, and have done so for quite a few years, tho.

  14. OK... The data sheet (http://www. omron.com/ecb/products/pdf/en-g5v_1.pdf) shows that pins 5 and 6 are both connected to the common of the switch. Either or both can be used in your application.

     

    Lots of examples for using a transistor to control a relay... They all pretty much are the same thing, since it is a basic concept that has been around since vacuum tubes, and pretty much anyone working with electronics learns it sooner or later.

     

    Method one is build it from discrete components as in the crude attachment. Preferred for a single device. 2n3404 or 2n2222 for the relay you are using, a 2.2K resistor on the base (0.5mA base drive to insure saturation of the transistor for 50mA coil current), and any small sig diode for flyback (1n914 is fine)

     

    Method two is use a driver IC, which contains multiples of this basic block, such as the ULN2003 or ULN 2004, or one of the hundreds of similar IC's (these particular ones are darlingtons, which means they can sink more current than a single transistor, but at the expense of greater potential drop.... There are also simple bipolar drivers)

    post-30450-0-67955600-1427848675_thumb.png

  15. First, DO NOT directly drive it with the microcontroller without knowing more. The output of the microcontroller (any microcontroller, not just MSP430) can be damaged driving the inductive load and current demand of the relay coil if not done properly.

     

    That said, it is tough to give details without having the part number for the relay, so I will give some generalities:

     

    The recommended way to drive the relay is to use a transistor (an npn bipolar is traditional) as a switch to ground, and use a diode across the coil to shunt the inductive kickback when shut off. Directly driving is likely to damage or destroy the microcontroller, sooner or later, even with a protection diode. Not a guarantee, but, again, without part data, I would lean that way.

     

    A six pin SPDT relay could be the same as a five pin, with one unused or a redundant connection (often the common for the switch), or could be a double coil. Need to know what the model is. A double coil is generally a unipolar latching type: trigger one coil to latch to the NO position, the other to release to the NC position. Gotta look at the data sheet to see if coil current polarity matters. Some do, some don't.

  16. One other point: Many materials we think of as 'waterproof' are not. Many common polymers, such as styrene plastics and polyethylene films, will allow water molecules to diffuse through, over time leading to issues even without an actual leak. This isn't a short term issue, such as when using Saran wrap to keep leftovers fresh, but over longer periods, it is an issue. Tupperware, plastic boxes sealed with gaskets, etc, are not good long term environmental protection on their own for this reason.

     

    Not my specialty, by a long shot, but some of the jobs I have been involved with got me educated enough to know my ignorance. It is AMAZING what is done on oceangoing vessels to protect electronics, and what isn't.

  17. The options are 1) a complete sealed setup, using the appropriate sealed penetration connectors, capable of holding against the pressure inside and out due to temp changes, 2) run the containment at a slight positive pressure,  3) ensure that moisture can get out before condensing, OR 4) pot that sucker up

     

    I have been involved in option 1 a couple of times, and it is expensive to do well. An ammo can is a decent containment, as long as the gasket is good and the temp changes arn't too great. It will breathe under great enough temp change.

     

    Option 2 is what communications providers often use on trunk lines. They may pressurize with nitrogen and seal it, or use a compressor and air drier. The second of these is why you see some of the little green lights on the boxes on telephone poles. Those are small compressor/driers, and pressure monitors. They alarm if pressure can't be maintained, and provide a small volume of dry air to make up miniscule leaks. I don't know what the pressure is, but I would guess a few inches of water (24 inches of water is about 1PSI; 1 inch of water is about 2mmHg, or about 2.6millibar. Residential gas is about 10 inches in the US)

     

    Option 3 I have used a number of times. Enough ventilation is needed low and high that temperature changes will induce air to move, the electronics are protected from direct impingement, but will follow temp changes fairly quickly so as to not get condensation, and the electronics want to be the warmest thing in the containment. One technique I have used a double roof model: slight overhang with vent at the top, open bottom, like a small garden shed, and the electronics in a box inside with bottom vents, but no top vents. Drip loops on wires entering are a must. Direct solar exposure to the containment is a no-no, as that is asking for after a rain, at the most humid time, the electronics lagging behind the dew point and inducing condensation.

     

    Option 4 is common in automotive and ruggedized gear. Pot it solid. Gotta do it right so moisture can't get in where leads enter the potting. Can be done with wax, silicone, some petro-based rubbers and plastics, or many other materials. The antique auto guys still use pitch for some things, both for insulation and moisture protection. Goes in hot, so moisture is removed and can't get back.

     

    One other option, used by the tool and gun guys, is not appropriate here, due to practical requirements: a small heater. Raises the dew point to prevent condensation, but takes a bit of power as well as running the electronics hotter than needed.

     

    I would use option 3 or 4. Even a low power device, in a small enclosure, running at a few milliwatts, will produce enough heat to keep the containment a degree or two above ambient. As long as no liquid can blow in, and the space around it is generally below the dew point, there isn't an issue, as the electronics will usually be at or above the temp of the surround except during the most extreme rises.

  18. First, theory: The wikipedia page on aliasing isn't bad. ANY sample rate that is not a sub-multiple of your sine wave frequency (without considering phase) will give you data that looks like a sine wave at some frequency or another. The RMS and offset will be the same as the wave you are sampling, but the frequency will not.

     

    The original wave can be reconstructed from undersampled data in some cases IF there is other information available. This is how many oscilloscopes used to handle very high frequencies, and some still do, using low speed D/A converters. The TIMING of the samples on a 1ns scope is held to less than 1ns jitter, but the samples might be done very precisely at 500ns or more apart, timed at successively larger delays (1ns more per trigger) from the (repeating) trigger event. For a repetitive waveform, the waveform can be reproduced from samples spread over a large number of repetitions, as long as the max frequency is less than the 1ns (and a few other conditions are met.)

     

    Essentially, this is what you are doing, but in a free running way. If you know it is a stable sine wave, then all you need is the upper and lower peak to get RMS and offset. It does not matter which cycle you measure the peaks on. If you are trying to do true-RMS calculation, then you need more data, but, again, if the signal is stable and repetitive, it doesn't matter if all samples come from the same cycle. In fact, for these tasks, clock jitter and frequency aren't critical either.

     

    If you were trying to reproduce the waveform, not analyze  the basic properties, these would matter.

  19. You need to explicitly request the fuse be blown (or the flash equivalent on those without the physical fuse). I don't have a MSP-FET, and have never done it on these processors, but I have seen it in the documentation, and done it with other families.

     

    Blowing the fuse is like blowing a fuse in your electrical box: blown is blown. Once the fuse is blown, the JTAG interface is disabled on the device. Forever. It can never be re-enabled, even by reflashing the device via BSL.There is no going back. (see, for example, SLAS722g, page 36, `JTAG Fuse', note (1)-- this is for MSP430g2X12/2X52, but others with the fuse are similar)

     

    In the devices with no fuse (that use an enable code in flash instead), the status is checked at powerup, and the JTAG hardware not enabled unless the status (in flash) is correct. On reprogram  (via BSL), this can be reset.

     

    Again, the device can still be accessed via BSL, so you need to SET THE PASSWORD (32 bytes) to prevent the device memory from unauthorized reads. See SLAU319I, sec 2.7 for details (password is interrupt vector space; any that are not in use can be set freely) This also explains how to enable/disable the automatic memory wipe on incorrect password and/or disable BSL entirely.

     

    Edit: add ref to SLAS722

    Edit 2: ref SLAU319

  20. As @@bluehash said, to sample he input so as to get sufficient information to reproduce it, the sample rate needs to be greater than twice the maximum frequency in the signal.

     

    First, I messed up units in my post above. I intermingles 50 microseconds and 50 milliseconds. The concept still applies and content is correct otherwise...

     

    Second, we really need to know what you are trying to do for anyone to give a better response. Are you trying to synchronise to the input? Sample it like a digital oscillloscope? other? What development tools are you using (I presume from your post that the toolset you are using implements delay() as a millisecond delay, not microsecond)? What clock rate is your processor running at (if using  Energia, this is probably 16MHz+/- a few percent. If CCS, unless you change it, it is the processor default of 1MHz uncalibrated.) What is YOUR background (so we can go to the appropriate level of explanation)

     

    Short form: Nyquist demonstrated that to gain sufficient information about a sampled signal to reproduce it without aliasing (shifting frequency components to the wrong frequency), the sample rate must  be GREATER than twice the maximum frequency present in the input. (It is often stated that it must be EQUAL OR GREATER, but equal fails, as the sampled data then becomes phase dependent for the highest frequencies). It is better to sample at a minimum of 4 to 10 times the max frequency, as this reduces the need to interpolate and filter to get information, such as peak, power, frequency spectrum, and phase, and reduces the time required to gather enough samples to get this information (as there will be much less modulation due to interference between the sample frequency and the signal than if the sample rate is barely greater than the max frequency in the signal)

     

    The BEST way to do sampling is a stable clock (crystal controlled) and a sampling system with no jitter. This can be approximated on the MSP430 quite well by using interrupts and the hardware timers to control the process. In brief, you set a timer to interrupt at your sample rate, and the interrupt handler starts the next ADC cycle, giving a fairly well synchronized sample point. Having the ADC interrupt at the end of the conversion allows immediate handling of the result. This is not simple, but it isn't that complicated, either. To tell you more, we need to know more about what you are trying to do.

  21. Cutting the pin off is effective against casual tampering, but it isn't usually that hard to get contact to even a below surface stub. Then again, anyone that is going to go that far is likely to be able to dig far enough to get by most of the built in security, as well, if they have the incentive.

×
×
  • Create New...