very interesting, i will and have to finish the course with this Fundamental of Designing with Microcontrollers. This is advantage in my case in the advancement of automation towards building services...

once again, i appreciate the value on how mr. jon delivered his presentation...

@clia: On slide 17, signal PWM0-RSSI In is a pulse train where the pulse width carries information. When passing across the filter, it filtered out the carrier frequency, and let the analog information (voltage proportiobak to pulse width) pass.

Thanks for the intro and looking forward to working through both this and the Advanced MCU courses. I do MCU programming as part of my job, but it is mostly self-taught so it will be good to go through this and cover things I may not have encountered.

I learned about these lectures well after they occurred, and I was wondering if anyone goes back and checks on additional comments for these lectures for those of us that are listening to them from the archive.

Q: Hi, How do I listen the archived classes? I just can download slides. Thanks in advance!!

A: Hello. Check your audio config on your computer. I was able to click on the archived link and a separate page came up, complete with an Adobe flash player which played the DesignNewsRadio class excerpt. make sure you have the latest Adobe Flash installed.

The time here is after 6:00 PM (1800h), so I've wrapped up answers to questions and am off to dinner. I have tried to answer most of the technical questions. If you didn't get a direct answer, I apologize. You can find a lot of information with a Google search and MCU-vendor Web sites and application notes provide much helpful information, too. All the best. --Jon

Q: How do we decide what is the minimum RAM and FLASH do we need before starting the project?

A: You cannot decide beforehand. It's best to look at an MCU that belongs to a family so you can go "up" the family tree to get more memory, or go down the tree to save money. It would be nice to have a code-estimation tool, but I don't know of one. Perhaps others have ideas they can share.

Q: What is the main difference between I2C and CAN? Their block diagrams seem to be

the same.

A: Use I2C for short-distance chip-to-chip communications. I2C devices use a common clock signal, CAN does not. Use CAN for longer-distance comms between a computer and a machine-tool, for example. CAN uses a sophisticated protocol that included a cyclic-redundancy code, error flags, acknowledgements, message identifiers, and do on. It's a robust form of communications.

A: Actually both. The MCU provides the hardware that implements the bus timing and a state-machine. For information, see the PIC18F2455 data sheet at: http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf. Also see Jan Axelson's book "USB Complete." You need a good knowledge of how the USB operates before you implement it. You will need a software stack, too.

A: Yes, you just change the order in which you test the flag bit for the devices that can cause an interrupt. To give a UART higher priority than an ADC, you test the UART flag first and if it is set, you run the UART-related code. After you handle the UART interrupt you test the ADC flag, and so on. The last flag you test has the lowest priority.

Q: What is the input range of the ADC? What is the educational value of the kits you presented.

A: The input range has a maximum of the supply voltage of the microcontroller. An MCU with a +3.3-volt power source cannot accept a voltage over 3.3 volts on any input, although MCU manufacturers include a bit of tolerance. The ADC range depends on the reference voltage, so read the data sheet for the MCU you plan to use. For a 2.500-volt reference, for example, you can digitize a signal between 0 and 2.500 volts. Some MCUs have an internal reference you can select, or you supply an external reference.

Q: Typically, does the MCU have a higher power requirement than the CPU?

A: Most MCU manufacturers don't specify the power drawn by the CPU alone. Perhaps you mean does a microprocessor draw more power than a microcontroller? Yes, usually. a high-end Pentium-class MCU needs a heat sink. MCUs do not.

Q: Are there MCU that can drive a 110V motor directly, or would you interface through solid state relays?

A: A solid-state relay would be good. You could also use an MCU to trigger a triac through an opto-isolator. I have seen some schematic diagrams that use an MCU to directly drive a triac, but in the interest of safety, I'd want an opto-isolator, or opto-coupler between my MCU and line voltage. Do a Google search for microcontroller triac optocoupler.

Q: Can you prevent Interrupt priority inversion with a watchdog timer?

A: Sure, that's one way to do it, but the watchdog timer will run continuously, which can make debugging a pain. Right in the middle of some debugging, the WDT can trigger a reset. Priority inversion occurs when a low-priority device monopolizes, or blocks, a system resource that a higher priority device needs to use. One way to prevent priority inversion is to write short interrupt-service routines. A real-time operating system or scheduler can help reduce this type of problem.

Q: For a mechanical/biomedical engineer with little background in electronics, what would you recommend for me to come up to speed?

A: Take a look at the BASIC Stamp modules and educational materials from Parallax: www.parallax.com. The BASIC Stamps provide a good way to get started and Parallax has many books about electronics. I also recommend the book, "Make: Electronics," from O'Reilly Media, ISBN: 978-0-596-15374-8. It's an excellent book with many helpful illustrations and diagrams.

A: You determine the intervals by the clock source you select. Most MCUs use the system clock and divide it by a value you set, likely a power of 2; that is, divide by 2, 4, 8, 16, etc. You can use an internal timer to click every 1 msec, for example, and then every time the timer ticks over, increment a counter. Then after 10,000 counts you have a 10-second period. The timers and counters are very flexible.

Question: In industrial automation, do microcontrollers find use in developing smart sensors? Are FPGAs anothoer solution for embbeded programing.....and if so how do I decide - FPGA vs microcontroller?

Answer: Yes, MCUs fit nicely into smart-sensor applications. They have memory for code and, if necessary, can linearize sensor outputs to convert them into units such as pounds, newtons, mm mercury, PSI, etc. I think an FPGA would be overkill for a smart sensor.

If you had to choose between SPI and I2C on a single board, which one would it be?

I'd use SPI if I had one or two chips and only needed simple transfers of data from one internal register. Use I2C if you have a chip such as the Analog Devices AD7991, which has several registers to set operating modes. I2C is the only way to connect to it. Look for the external devices you need first and let them govern the type of MCU interface you need. --Jon

Well we're talking about embedded stuff here. You want to squeeze the maximum amount of computing you can out of a system. So it's kind of "required" that you "build the op-amp" to do so. Libraries are fine if your applications don't change much from product to product.

@s.schmiedl It's nice to know what the basic internal operation of an OpAmp, but it kind of helps when you can get one from a grat company when the objective is assembling a guitar amplifier instead of assembling an OpAmp.

@nateholio I agree that letting everything be just a lego is not good, but some libraries are very useful. I tried working with no libraries at all and some things become just a waste of time, reinventing the wheel. Using a library would speed up the work and maybe its implementation was already tested and checked by many other people, granting me some assurance of its quality.

It can still be manageable and error-free if you code your own subroutines/ISRs/&&c and use those as a base for programming on top of.

@franch...I mean an enviornment where you have a bunch of libraries full of lego blocks and you just have to put them together in the right order to make what you want. Not even a need in some applications to know what an ALU, barrel shifter, I/O address for a control register is, &&c anymore.

too many hidden fiddly bits and magic switches. I'm not sure how much longer I will be able to be part of a culture where n errors in m lines of code is considered acceptable. MCU code, at least at my current level, is of a size that is manageable

Jon mentioned timers...depending on the uC this might result in code that is more simple than using IRQs. However, you will eat up power every 100ms. If battery life is your concern then I would go for IRQs

@s.scmeidl As an example, I made a simple system with AT89S52 with a 16-key keyboard with and LCD display to show the input and 2-buttons on the interruptions to scroll up and down the display. I looped they keyboard to read the input, but I needed the scroll to work right away, so they were plugged in the External interruptions.

Button presses a few times a day. I'd put the MCU into a deep sleep to save power and wake it upon receiving an interrupt from the button. This assumes the MCU doesn't do anything until someone presses the button. You also could set a timer to wake the MCU, say, every 100 msec and check the button.

@s.schmiedl This type of thing depends. If you need the button to stop whatever the MCU is doing to process its request, you should use an interruption. If you can loop and read those buttons indefinitely, there's no need to interrupt the MCU.

Watch out for some of the PIC MCUs. I have experimented with the PIC16F690, for example, but to use the MPLAB debug capability I would need a DIFFERENT 16F690 chip with more pins that provide access to internal MCU debug functions. Microchip offers that "special" chip on an adapter board that takes the place of a regulat 16F690 in your system. So, you need the adapter and a cable for some Microchip MCUs. Look closely to find out what you need to use ALL of the capabilities in MPLAB and other integrated development environments. You can't just go out and buy "stuff." It takes some research. I'll talk about these aspects in other sessions this week.

There are no universal compilers I know of. The GCC tools come the closest but you need a library for each type of MCU. You can get tools from IAR, Rowley, CodeSourcery, and others that let you work with different types of MCUs, but the tools are expensive unless you use the code-limited versions.

Are there simulation software platforms available to assist with prototyping prior to commiting to a particular microcontroller within a manufacturer's product range?

Not that I know of unless you want to buy The MathWorks MATLAB and Simulink, which are expensive. Those tools let you simulate a complete system. I suppose you could also use National Instruments LabVIEW. I don't know how well either set of tools would simulate a small MCU. They handle mainly high-level control systems.

Inexpensive dev systems? TI has free limited code-space versions of Code Composer Studio. The Renesas HEW IDE is free and has no limits, as far as I know. The AVR Studio is fine, too. Several people have noted the GNU Compiler Collection (GCC), also free and available for many MCU families.

The GCC toochain IS a pain to set up and use, but once you have it set, using it with the Eclipse IDE is a pleasure. Especially for debugging step-by-step. And really especially if you don't have a lot of money to spend with Kiel.

Regardless, buying an IAR toolchain, or something from its competitors, isn't cheap, and not easy to do if you're just getting started, and can't yet justify the investment. The mBed board can be good, but you can't do assembly through the web IDE. :P

Many of the FPGAs available have either a hard-core or a soft-core MCU. You buy FPGAs with hard-core MCUs and use a program library to implement them as soft cores. I have experimented with the Altera Nios processors but haven't used one in a design. Worth looking into if you need additional capabilities for an MCU but want everything in one chip. --Jon

Jon, that's because you got the compiler from IAR, instead of trying to find an existing gcc toolchain. If you try the latter route, you aren't very likely to find a toolchain that meets unusual requirements.

I haven't looked at Space-grade MCUs, but you might find larger companies such as Cypress, TI, Renesas, and Freescale have space-qualified MCUs. I know the amateur-radio community has put small communication satellites in orbit with MCUs, so they must exist. Jon

Question: ARM chips can be a royal pain to get started with, if your chip or library requirements are odd; you need a completely different version of gcc just for every little thing. :P

Answer. I just worked with an ARM-based MCU from Energy Micro and had no problems with the libraries for the IAR compiler. They did what I expected and made it easy to configure the chip. Energy Micro could give more information about some aspects of using the peripherals, though.

Some tools, such as the Microchip MPLAB, include simulators that let you give your code a preliminary test before you load it into an MCU's flash memory. I have not used that simulator, so I can't tell you how well it workd. I'm more of a load-it-and-try-it guy. --Jon

I agree with thimme this is crazy communication One-To-Many as in the babel tower passage. It is very difficult following replies to questions. Is there any way to reconfigure this for future webinars?

CAN vs. RS485. The RS485 spec only controls the signaling levels and doesn't offer a protocol or even compatibility with other devices. I like CAN when the communications require several drops, device addressing built into the protocol and communication priority. Look for a short CAN tutorial on the Internet. --Jon

For timers, your low end resolution is constrained by the clock speed your timer is being run at. The high end you can use counters to further enhance your timers. So if you have a timer that clicks off every 100ms, you can count those ticks with a basic int and track seconds, minutes, hours, days, years, eons, etc.

@TT: I use arduino in a professional setting, they're great for building test fixtures. I haven't done product development with them, but I've seen lots of people building very involved devices with the available shields.

I like COde composer better. I dont use much of Grace because I like the register writing. Yes the Code composer will do everything up to some code size limitation for the launch pad. I dont think that any of the microcontrollers suported by the lauch pad have more memory than the free code composer can compile.

@mike_rossiter Yes i agree. I try to tell beginners who really want to understand to stray away from arduino's until they understand the innerworkings of ucs. Takes away from learning what is really going on i think

slk, I mean for lots of I2C devices over larger distances. The capacitance of the signal lines build up. I'm guessing, but I think that if you had lots of high resistors, maybe one for each device in parallel, the capacitance of the signal line might go down, allowing longer length and more devices.

CAN uses differential signals, meaning two lines are used for signals. There is no clock, similar to UART. This is useful for transmission over cable, as devices can be at different grounds and still communicate over the network.

I2C uses two lines also, but in this case one is for the signal, the other is for the clock. This is useful for use on a PCB where all IC are connected to the same ground.

By the way, you REALLY need to do some in-depth digging on your parts if you want to use Multi-Master I2C. Manufacturers often gloss over whether a part uses Multi-Master I2C or not, and whether it does it in actual hardware, or merely in software.

You can dowload slides above where it says 'Today's Slide Deck'. At 2 pm ET the radio player will automatically show up and you will be able to listen to the presentation and follow along with the slides posted above. You can also ask questions to the lecturer by typing them below. All sessions will also be archived here if you are unavailable to listen at this time.

Focus on Fundamentals consists of 45-minute on-line classes that cover a host of technologies. You learn without leaving the comfort of your desk. All classes are taught by subject-matter experts and all are archived. So if you can't attend live, attend at your convenience.