17
Microcontrollers: Teaching and Simulators Teufik Tokić, Ivan Milentijević Faculty of Electonic Engineering, Niš

Microcontrollers: Teaching and Simulators

  • Upload
    isha

  • View
    27

  • Download
    0

Embed Size (px)

DESCRIPTION

Microcontrollers: Teaching and Simulators. Teufik Tokić, Ivan Milentijević. Faculty of Electonic Engineering, Niš. Microcomputer systems and I/O Devices. Undergraduate studies, CS department Two semester course (VII,VIII) Hours per week: 2+2+1. Why Microchip PIC 16F84 ?. Easy to learn - PowerPoint PPT Presentation

Citation preview

Page 1: Microcontrollers: Teaching and Simulators

Microcontrollers:Teaching and Simulators

Teufik Tokić, Ivan Milentijević

Faculty of Electonic Engineering, Niš

Page 2: Microcontrollers: Teaching and Simulators

Microcomputer systems and Microcomputer systems and I/O DevicesI/O Devices

Undergraduate studies, CS departmentTwo semester course (VII,VIII)Hours per week: 2+2+1

Page 3: Microcontrollers: Teaching and Simulators

Why Microchip PIC 16F84 ?Why Microchip PIC 16F84 ?

Easy to learn Flash programming Small instruction set (only 35 instructions) Harvard architecture Small price Wide application area in domestic industry

Page 4: Microcontrollers: Teaching and Simulators

High Performance RISC High Performance RISC CPU Features:CPU Features:

• Only 35 single word instructions to learn• All instructions single cycle except for programbranches which are two-cycle• 8-bit wide data path• 15 special function hardware registers• Eight-level deep hardware stack• Direct, indirect and relative addressing modes• 1000 erase/write cycles Flash program memory• 10,000,000 erase/write cycles EEPROM data memory• EEPROM Data Retention > 40 years

Page 5: Microcontrollers: Teaching and Simulators

Interrupt Sources

- External RB0/INT pin- TMR0 timer overflow- PORTB<7:4> interrupt on change- Data EEPROM write complete

Page 6: Microcontrollers: Teaching and Simulators

Pin DiagramsPin Diagrams

Page 7: Microcontrollers: Teaching and Simulators

Previous StatePrevious State

Four 7-segment Display

Main problem: The lack of enough copies of boards for Lab exercises

Small Development – Programmer System

We developed several boards for lab practicing.

Page 8: Microcontrollers: Teaching and Simulators

Small Development – Small Development – Programmer System Programmer System

Page 9: Microcontrollers: Teaching and Simulators

Four 7-segment Display Four 7-segment Display

PIC BCD to 7-seg. decoder

7-segment display

Page 10: Microcontrollers: Teaching and Simulators

Simulator – sollution for lack Simulator – sollution for lack in hardwarein hardware

One possibility is using of public available simulators like MPSIM.

Page 11: Microcontrollers: Teaching and Simulators

MPSIM SimulatorMPSIM Simulator

MPSIM requires two files: .ini and .sti

.ini file contains list of variables that we want to display.

.sti file contains stimulus changes (on processor pins) during program execution

Page 12: Microcontrollers: Teaching and Simulators

INI - fileINI - file

LO PlastikST PlastikSR XZPZRZTREP 84NVV WDW DAD T1AD FLAG,B,8AD POMAD TBEAD STATUS,B,8RS

Page 13: Microcontrollers: Teaching and Simulators

STI - fileSTI - file

ISTEP RA3 RA2 RA1 RA0 RB0 RB701 0 0 0 0 0 0 !Port initialization20 0 0 0 0 0 1 !Pressed START40 0 0 0 0 0 0 !Depressed START80 0 0 0 0 1 0105 0 0 0 0 0 0110 0 0 0 1 1 0160 0 0 0 1 0 0165 0 0 0 0 1 0215 0 0 1 1 0 0220 0 0 0 1 1 0300 0 1 1 1 0 0305 0 0 0 0 1 0340 0 0 0 1 0 0350 0 0 0 1 1 0

Page 14: Microcontrollers: Teaching and Simulators

MPSIM SimulatorMPSIM Simulator

MPSIM requires two files: .ini and .sti

.ini file contains list of variables that we want to display.

.sti file contains stimulus changes (on processor pins) during program execution

Using both those files is uncomfortable.

Page 15: Microcontrollers: Teaching and Simulators

PIC Simulator V1.0PIC Simulator V1.0- Example -- Example -

loop:if current PORTA0 != previous PORTA0 then

increment PORTBend loop;

Page 16: Microcontrollers: Teaching and Simulators

PIC Simulator V3.0PIC Simulator V3.0- Examples -- Examples -

EXAMPLE 2Put hexadecimal number ABCD on four 7-segment LED display.

EXAMPLE 1Put text “PIC” on four 7-segment LED display.

EXAMPLE 3Put number 76543210 on eight 7-segment LED display.

Page 17: Microcontrollers: Teaching and Simulators

ConclusionConclusion

Simulators are available to each student for home practice

We encountered 35% increase in average point number on the exams, for this topic.

Number of available lab equipment pieces increased from one to no. of available PC-s (much more then one)