Microcontrollers: Teaching and Simulators
description
Transcript of Microcontrollers: Teaching and Simulators
Microcontrollers:Teaching and Simulators
Teufik Tokić, Ivan Milentijević
Faculty of Electonic Engineering, Niš
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
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
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
Interrupt Sources
- External RB0/INT pin- TMR0 timer overflow- PORTB<7:4> interrupt on change- Data EEPROM write complete
Pin DiagramsPin Diagrams
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.
Small Development – Small Development – Programmer System Programmer System
Four 7-segment Display Four 7-segment Display
PIC BCD to 7-seg. decoder
7-segment display
Simulator – sollution for lack Simulator – sollution for lack in hardwarein hardware
One possibility is using of public available simulators like MPSIM.
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
INI - fileINI - file
LO PlastikST PlastikSR XZPZRZTREP 84NVV WDW DAD T1AD FLAG,B,8AD POMAD TBEAD STATUS,B,8RS
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
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.
PIC Simulator V1.0PIC Simulator V1.0- Example -- Example -
loop:if current PORTA0 != previous PORTA0 then
increment PORTBend loop;
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.
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)