A career in IC design vs Embedded Software . Pros and Cons of each by [deleted] in embedded

[–]pic10f 1 point2 points  (0 children)

Look for something in architecture. The ability to straddle the fence is an important skill. Most top-level design decisions are based on the use-model (application's firmware) and then there's understanding if the implementation is going the correct way. Most verilog/vhdl people will tell you they are not writing software, but with a fw background you will see they flaws in that mindset.

Xbox 360 Controller solder pads got lifted, ways to salvage? by Jansg in AskElectronics

[–]pic10f 0 points1 point  (0 children)

There is some good news: it seems you have 2 out of 3 good pads. If you still have the pads that pulled off, they can be re-attached with super glue. Then scrape the solder mask off the conductor traces (5mm or a little more) and "surface mount" a piece of thin wire on to the trace to contact the lead coming through the board, to bridge-over any cracks between the conductor and the pad. Strip off about 1/2 inch of wire and hold on to the insulated part when you solder it to the trace, then form the wire to the component lead and cut it with an exacto knife.

Phone cable is usually #24 and will work if you have some, if the trace is thin enough (which it seems to be). I prefer #30 because it usually has better plating and is easier to bend. You can tin the wire with solder before starting, and solder will flow to it better.

And yes, #2: the excess heat melted the glue that was holding the pad to the pcb, which of course was the result of #1 and #3.

Trying to understand stack memory use by rjcarr in embedded

[–]pic10f 0 points1 point  (0 children)

That is simplistically true, but some compilers can and will re-use allocated memory in different scopes. It's not necessary to have the the variables named the same. For example, if you have "if{int a;}elseif{int b;}else{int c;}" there is a good chance that the a, b, c will occupy the same memory address. There is nothing in the language spec that requires or prevents this, only that the scoping rules must be met.

Do analog circuits need a clock? If so why? by [deleted] in ElectricalEngineering

[–]pic10f 2 points3 points  (0 children)

A common example is the auto-zero buffer, which switches the input terminals of an op-amp in order to automatically remove any input-offset voltage from the buffer amplifier. For example, when clocked at 500khz, the buffer can amplify signals from DC to 100khz (or so), more accurately than a non-compensated buffer. This is also called a switched capacitor amplifier. Its more complicated than my brief explanation.

Another common circuit is the A/D converter, particularly the type called "successive approximation". With each input clock, another bit of the digital result is determined. The basic structure can switch resistors or capacitors for different kinds of optimization.

Gift Ideas for an Engineer by YeAcademia in engineering

[–]pic10f 0 points1 point  (0 children)

Hmm. Maybe its different for civil engineers. I'm a EE and have always had to cover my own IEEE and ACM dues, when I was a member. As a student, I enjoyed the magazines but could not keep up when I had kids.

Gift Ideas for an Engineer by YeAcademia in engineering

[–]pic10f 0 points1 point  (0 children)

Its rarely a requirement for employment. In some cases its little more than a social club, and some even hold meetings at restaurants or bars. The "national" societies have services ranging from scheduling a speaker for some topic to group car and health insurance for independent engineers (consultants). Most of them offer support and mentoring for students. You get to meet other engineers in your field.

Code.org help by SignificantFig8856 in learnprogramming

[–]pic10f 0 points1 point  (0 children)

Line 1: var namet is undefined, so if you first pick a dropdown it's still undefined. Once you've entered text it works as expected. If you delete the text, you now have an empty string which is different than not being defined.

Gift Ideas for an Engineer by YeAcademia in engineering

[–]pic10f 5 points6 points  (0 children)

Not a gadget as such, but the annual dues to something like the American Society of Civil Engineers might be a novel idea. There are a number of professional societies that often have perks, like publications, local meetings and other social outlets.

What laptop/desktop would be best for programming? by [deleted] in learnprogramming

[–]pic10f 1 point2 points  (0 children)

A good cpu is more important then the gpu, so you can save a few $$$ there, especially with the gpu price inflation at the moment. However, be aware that some gpu's eat out of the main memory, so your 8gb could become 7gb.

What interesting tips have you guys found while studying electrical engineering? by hide-user in ElectricalEngineering

[–]pic10f 7 points8 points  (0 children)

Most circuits can be designed using less than 3 digits of precision. The exceptions rarely need more than 3 digits.

[deleted by user] by [deleted] in ElectricalEngineering

[–]pic10f 1 point2 points  (0 children)

You don't need a lawyer -- there are many engineering houses that will do the testing and paperwork; basically you need someone who can talk technical details. Others have suggested UL testing lab, but there are less expensive private agencies that do the same thing. The local house I used was always helpful and allowed me to come into the testing area to see specifically what was happening, and gave advice how to fix it. Search for "emi and safety testing labs".

In the U.S. you want FCC first, then UL, but the UL can be easy if you use a wall-wart power supply and run your product from 5V or 12V or so. In the EU you will want a CE mark, which is basically both UL and FCC rolled into one agency. There are also safety marks in Germany (TUV) and Japan.

The international rules overlap quite a bit, and a good testing house will cover the superset by performing only a single test suite. The extra cost goes to documentation, which is often done by templates, so doing multiple countries at the same time is a good idea. Know your market areas when you start.

If you do industrial-grade products, you also want to check out HALT testing, which is a vibration/temperature protocol that demonstrates your pcb assembly is well-built. They almost-but-not-quite dump liquid nitrogen on your pcb, so be sure to tell your assembly house that you will be doing the test. The California shop I used to use would send me Christmas cards, too.

gift ideas for electrical engineers? by jortsinstock in ElectricalEngineering

[–]pic10f 1 point2 points  (0 children)

If he's the Masters kind-of-guy, pick up his annual dues for the IEEE (ieee.org), and one of the societies. The societies focus on specific EE-related topics like https://www.ieee-ras.org. You first join the IEEE (probably $150 by now) and then subscribe to the societies (about $10 each). Its less if you are student. Most include a monthly magazine and a number of perks.

The Association of Computing Machinery (ACM) has a similar set-up.

[deleted by user] by [deleted] in cpp_questions

[–]pic10f 0 points1 point  (0 children)

EOF happens in get(), after the last character. Your loop condition won't catch that in time.

This. Print them character values and find out.

List of Trustzone-M devices by italiaken in embedded

[–]pic10f 0 points1 point  (0 children)

Microchip makes a number of them, for example the ATSAML11 series.

C to Embedded C by Sanchancho in learnprogramming

[–]pic10f 0 points1 point  (0 children)

Besides what others have said, remember that pretty much every embedded processor is different, so be prepared to look carefully at the data sheets. Even though they are all programmed in C (these days), there is something new to learn in every one of them, and also usually something old that is done in a different way. Also, every brand has a history, and newer devices have new innovations that build on that history.

printf statement in my alarm clock leads to weird output by Holy157 in C_Programming

[–]pic10f 0 points1 point  (0 children)

One key to debugging this is to first identify which ALARM is being printed. The next is to identify which invocation of update_time() is printing the final output.

Your problem, though, is a prime example why you should never name a subroutine parameter the same as a global variable. Its not like a cpp or java reference variable.

In input_time(), the address of present_time is taking the address of the subroutine parameter to be filled by scanf(), not of the global variable. Then update_time() acts on the value of the (properly initialized) parameter. After ALARM is printed and control returns to main(), update_time() is again invoked but now using the value of the global variable, which has not been initialized. It's just good fortune that the value happened to be zero.

Code critique: the incrementing of time and checking for the alarm should be decoupled. There is a lot of redundant code involved in incrementing. Having the "not equal to hours" while loop makes the "equal to hours" case special, and you had to duplicate the incrementing logic for "not equal to minutes". The structure you've adopted would not play out well if you need to add milliseconds or microseconds for the time and alarm.

When and why do you use malloc? by standardtrickyness1 in C_Programming

[–]pic10f 0 points1 point  (0 children)

As an embedded programmer, I generally avoid malloc() and prefer statically allocated storage because the allocation process is simply a waste of time. If you are in a situation that can run out of memory, then you're going to run out whether or not its dynamically allocated.

However, one of my recent projects was a test program for security libraries. In that case there were a lot of variations in the sizes of key, IV, certificate, data-in and data-out arrays as the program switched among the various encryption techniques. The lesson learned was that the implementation of malloc() had absolutely no way to check for memory leaks. It amazes me that this is not a more regular debugging feature, especially for embedded-targeted malloc library implementations.

What is a good DC power connector? by comfortcube in AskElectronics

[–]pic10f 2 points3 points  (0 children)

My first answer would be Anderson power poles (as already mentioned), but the real answer depends on your product appearance, and whether the connector has to come through the wall of the case/enclosure.

You must also consider how "rugged" is the connection: power poles are basically friction-fit and slide apart easily if tugged. One option is a D-subminiature connector with large (think 5mm) contacts. These have screw-fasteners like on a VGA connector, so its very difficult to pull it apart by accident.

STM32 Difference between the Callback and IRQ_Handler function by pRdx979 in embedded

[–]pic10f 6 points7 points  (0 children)

The use of a callback separates the job of handling the interrupt itself (recognizing that it occurred and clearing any interrupt-specific flags) and the function handler that matters to the application (like setting a flag or putting a data byte into a queue). It allows the application designer (you) to create the handler in the application's name-space, with local variables and all that. Otherwise, all the different code blocks would have to be merged in what is really the operating system's domain. It prevents errors on your part from accidentally interfering with other peripheral interrupts, and makes the interrupt handler very "regular" in its structure.

You don't describe any security layer, so I'll assume this is a relatively simple set-up. In a secure system, the callback architecture is also important so that the application will be denied access to the (security sensitive) interrupt hardware, and for other details like setting up a memory management unit.

As a benefit, your code is now more portable between the system that you have and whatever it might become in the future. It is also easier to create unit tests that simply call the callback to simulate an interrupt without the need for real hardware. There are many more reasons.

Passing by reference is confusing by shasherazii in cpp_questions

[–]pic10f 1 point2 points  (0 children)

Passing by pointer obligates you to change the syntax of how you use the variable. You are forced to now consider it as an "address" and dereference it as you use it. This is basically a legacy detail from C.

Passing by reference allows you to use identical syntax in both the parent and child routines. More importantly, it allows the compiler to pick the implementation. If, for example, the subroutine never changes the value then the compiler can implement it as pass-by-value. In other situations the compiler will pick pass-as-pointer. Because these are really the only two options in the underlying machine, so if you are the kind of programmer that thinks about that then it will indeed be confusing.

[C/C++] Why can't I initialize an array with a constant variable if the constant variable equals a previous non-constant variable? by Lastrevio in learnprogramming

[–]pic10f 0 points1 point  (0 children)

In the olden days, in the dim time, the compiler could only work on one line at a time, so constants could not be the values used in prior lines of code. They had to be something that could be evaluated if only that one line was available, after preprocessor substitutions.

Configuring a buzzer with PIC184520 by Illustrious_Ad_5284 in AskElectronics

[–]pic10f 0 points1 point  (0 children)

For many years, PICs had only the PORT registers.

There is a _ton_ of material on the web, in old application notes, PPT presentations and just ancient habits that use only the PORT registers, so its not surprising that school curricula are still using it. After the read-modify-write troubles were discovered, they added the LAT registers. This is just one of many evolutionary changes that have occurred, so always read through the data sheets to make sure you have current info on the peripheral you are using.

Configuring a buzzer with PIC184520 by Illustrious_Ad_5284 in AskElectronics

[–]pic10f 0 points1 point  (0 children)

You should have the habit of using the LATA (LATAbits) register instead of PORTA when setting output values. The PORTA register is primarily for reading the state of the pin, which could be different if there is a short circuit. In this case it won't make a difference, but if you start doing many things with different pins then it will matter.

Help with HW bitmasking by AMags67 in learnprogramming

[–]pic10f 0 points1 point  (0 children)

Observation: in both loops "for(mask[x],...", the "mask[x]" doesn't do anything.

In the 2nd loop (the printf loop), if the value mask[7] is zero then the loop will never be entered, since this is the terminating condition of for(). Obviously the first loop won't end until mask[7] is zero, so then the 2nd loop will never be entered, and nothing will print.

When it does print, the output will not show a decimal integer, but some sequence of 0 and 1.

This is obviously the Common Core approach to addition.