UPC EETAC Bachelor's Degree in Telecommunications Systems and in Network Engineering EEL

L8

Lecture 1

Chapter III: Introduction to microcontrollers. L9: µC basics and digital I/O

[P9] Description of microcontroller architecture. 

L10

[24/11]

3.1. Microcomputer architecture

3.1.1. Microprocessor (µP). Basics

3.1.2. Microcontroller (µC), RAM, ROM, I/O

pic-microcontrollers-examples-in-assembly-language-fig0-1

Fig. 1. The idea of microcontroller (or microcomputer) integrating a microprocessor, program and data memnories and many dedicated peripherals (or subsystems) in a single chip (picture ref.)

3.1.3. Harvard – Von Neumann architectures

Harvard architecture is used by Microchip PIC and AVR devices. Von Neumann is used by Intel 8051 microcontrollers.

hardward

Fig. 2. Harvard architecture has separated buses for program and data memories.

3.1.4. PIC18F4520 chip architecture 8-bit microcontrollers from Microchip. The architecture of the PIC18F family

3.1.5. Microchip: PIC16F877A, ATmega8535, ATmega328P (the one used in Arduino boards)

Arduino platform (optional) is based on another microcontroller (ATmega328P) that has become very well known, so that you can program it using "*.ino" source files and its development environment, or instead using "*.c" files and Microchip MPLABX IDE. At the EETAC we have acquired the academic cloud license to simulate Arduino boards and applications in Proteus. Hence, you are invited to try your own projects. At Proteus unit there is a project sample.

 

3.1.6. Low-level assembly and high-level C languages

High level C language  is prefered over the assembler language because most of the hardware details of the micrcontroller remain hidden for a beginner user. Read from books in the library. For instance, this Chapter 1 in the Wilmshurst, Tim, Designing Embedded Systems with PIC Microcontrollers, Newnes, 2010. Available as an eBook at the UPC library.

More materials  to examine: (1) (2) (3) (4) (5), etc. etc. 

 

3.2. Other µC families and chips

3.2.1. Texas Instruments

3.2.2. Renesas

3.2.3. NXP

3.2.4. STMicroelectronics

3.2.5. Infineon (Cypress)

 

3.3. EDA tools for developing and testing

3.3.1. Microchip integrated development environment (IDE) MPLAB X>

3.3.2. C compiler XC8

3.3.3. Proteus VSM as the virtual laboratory simulation tool.

 

3.4. Digital I/O. Combinational circuits in C

3.4.1. Specifications

3.4.1.1. Truth table, symbol, timing diagram

3.4.1.2. Hardware-software diagram and software organisation

3.4.1.3. Software organisation: setup, main loop

Analysis of P9 highlighted project on the design of 1-digit BCD adder (Adder_BCD_1digit). What is BCD data, why an error signal, what algoritm allow us to add in BCD using components such Adder_4bit in P3?. Can you infer the circuit using a plan C2 as in P3 using Adder_4bit components? How such circuit is translated not now into VHDL but into C language?


Lecture 2

Basic I/O. Planning projects: general organisation of hardware and software.

 [P9]  Hardware circuit, init_system()

[29/11]

3.4.2. Planning

3.4.2.1. Hardware schematic

3.4.2.1.1. Connecting switches and buttons

3.4.2.1.2. Oscillator (OSC) and reset (MCLR_L) circuits

3.4.2.1.3. Interfacing LED

3.4.2.1.4. Tri-state logic gates and wire bi-directionality. Bus concept.

The idea of tri-state gates and bidirectional wires and buses.

3.4.2.2. Software program

3.4.2.2.1. RAM variables

3.4.2.2.2. init_system(): I/O port pin configuration register (TRIS).

 

Our goal: How to configure a port pin as input or as output. TRIS data direction register. 

 


Lecture 3

Basic I/O. Poll/read input values

[P9read_inputs()

[01/12]

3.4.2.2.3. read_inputs()

Our goal: How to poll/capture/read input port pins?

Mask, clean, shift and organise bits in convenient RAM variables. How to convert electrical signals, voltages and currents into RAM variables? Bitwise logic operations (AND, OR, XOR, NOT, SHIFT)

 Bitwise operations. This is an example on how to read/poll/capture a signal connected to a uC pin and convert it into a convenient RAM variable. The concept of samping an input at a given CLK active edge is a more complex concept to be explained later on.

 


Lecture 4

Basic I/O. Write pin values

[P9 truth_table(), write_outputs()

[01/12]

3.4.2.2.4. truth_table(), behavioural description, algorithm

The same algorith and ideas presented in Chapter 1: plan B, behavioural truth table interpretation.

 

3.4.2.2.5. write_outputs()

Our goal: How to inferface RAM memory bits to output pins? From internal RAM variables, write to output pins in a single instruction without modifying data available in pins of no interest. Bitwise logic operations (AND, OR, XOR, NOT, SHIFT)

 Bitwise operations. These are examples on how to write (1) - (2) a RAM variable to a port pin.

 


Thus, once again, you see how the same entity can be yet designed using another method in the list: implementing logic functions using microcontrollers and software programing (method 9).


Questionnaire on P5- P6 - P7 -P8  (30 min.)