Chapter IV        Microcontrollers

Our general approach: Take advantage of the three previous chapters to learn to to develop microcontroller-based projects:


(Visio drawings)

We have our own CSD coding style, the same way that we have our VHDL coding style:


Using the C language to write source code is just part of the entire software development process. There are many considerations that fall outside of writing the code and the desired operation of a program. These considerations include:

• Readability and maintainability of the software

• A documented development process

• Project management

• Quality control and meeting outside requirements such as ISO9001 and ISO9003

• Configuration management and revision control

• Design-rule and code-style requirements of your company or organization

• Verification and validation processes to meet medical and industrial requirements

• Hazard analysis

As you begin to develop code for products and services that are released into the marketplace, these aspects will become as much or more a part of the development process as writing the actual operating software. Many companies have software “style guides” that define how the software should be physically structured. Items such as header block format, bracket and parentheses placement, naming conventions for variables and definitions, and rules for variable types and usage will be outlined. This may sound a bit ominous, but once you begin writing using a defined style and development criteria, you will find it easier to collaborate and share effort with others in your organization, and you will have fewer errors in your code from the outset, as well.

(*) Source: Barnett, R.,  O’Cull, L., Cox, S., "Embedded C Programming and the Atmel AVR", 2nd edition, DELMAR CENGAGE Learning, 2007, ISBN-13: 978-1-4180-3959-2, pp 81.

The example below shows how may be controlled a home appliance like the washing machine as a FSM, the alternative to the classic flow chart. In this way, in this Chapter 4 the same FSM design strategy will be required, but for microcontrollers instead of PLD. Picture source: Wilmshurst, T., "Designing Embedded Systems with PIC Microcontrollers, Principles and applications", Elsevier, 2007

Whasing machine


Unit 4.1. Self-directed learning skills.

Unit 4.2. Architecture of a microcontroller system: Microprocessor (CPU) + Program memory + Input/output.

Unit 4.3. Commercial microcontrollers: Microchip PIC, Atmel AVR, Philips/Intel (and others)  8051.

Unit 4.4. Microchip families of PIC16F /PIC18F microcontrollers. Installing MPLAB. Example program in assembler.  Atmel ATMega family of microcontrollers. Installing Atmel Studio. Example program in C from the web.

Unit 4.5. Digital Input/Output pins. Polling techniques for reading inputs. Examples programs in C language.

Unit 4.6. Microchip MPLAB XC8 C Compiler. Examples programs in C language.

Unit 4.7. Example of a project running in a PICDEM 2 plus board.

Unit 4.8. In circuit debugger / Programmers ICD2/ICD3.

Unit 4.9. Tutorial on the CSD FSM-like programming style. Using interrupt-driven techniques to handle push-buttons and other peripherals.

Unit 4.10. Real time using Timer 0.

Unit 4.11. Using the LCD display.

Unit 4.12. Timer 1.

Unit 4.13. Analogue to digital (A/D) converter.

Unit 4.14. Timer 2.

Unit 4.15.Asynchronous communication UART - RS232 . Communicating the embedded system to host computers. LabView - LabWindowsCVI. 

Unit 4.16. I2C/SPI synchronous buses.

Unit 4.17. CAPTURE/COMPARE/PWM modules.

Unit 4.18. Comparator module.