AVOP-ELEKTRO-VLC-011

Download Report

Transcript AVOP-ELEKTRO-VLC-011

Training program: Mechanic - electrotechnician
Program name:
Digital processing - microprocessors
III. class
Microcontrollers
Elaborated by: Vlastimil Vlček
Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/04.0002
je spolufinancován Evropským sociálním fondem a státním rozpočtem České republiky.
Project setup for Microchip ICD-2
This setup is valid for all tasks and exercises stated hereinafter.
Create a new project (use Project Wizard) with the following setup:
PIC16F883 microcontroller.
Microchip MPASM Toolsuit (check the correctness of paths to the files).
Enter the project name and the path to the place of saving.
Insert the source file.
Check and confirm the correctness of the assignment.
Save the project.
Project setup for Microchip ICD-2
 Connect the MPLAB ICD-2 debugger to the USB port of the computer
 Check (in the PC device manager) whether the device was installed
correctly.
 Connect an instruction board to the ICD-2 and connect the supply voltage
of 9V to the instruction board.
 In the MPLAB-IDE program, select the MPLAB ICD-2 mode.
Project setup for Microchip ICD-2
In the Debugger/Settings menu, check:
Connect Status (Connected)
Self Test (PASS)
Power (presence of supply voltages)
Item “Power target circuit from MPLAB-ICD2” (Power) = inactive
Item “Program after successful build” (Program 2) = active
Item “Run after successful program” (Program 2) = inactive
Project setup for Microchip ICD-2
Set up the configuration bits in this way:
Oscillator Selection bits - XT oscillator
Watchdog Timer Enable bit - WDT disabled
Power-up Timer Enable bit - PWRT enabled
RE3/MCLR pin function select bit - RE3/MCLR pin function is MCLR
Program memory code protection - disabled
Data memory code protection - disabled
Brown Out Reset Selection bits - disabled
Fail-Safe Clock Monitor Enabled bit - disabled
Low Voltage Programming Enable bit RB3 - digital I/O
Brown-out Reset Selection bit = 2.1V
Flash Program Memory Self Write Enable bits - off
Project setup for Microchip ICD-2
The MPLAB-IDE enables the setup of the configuration bits in two ways:
By inserting the configuration word into the source text by means of the
__CONFIG (e.g. _CONFIG 0xC1E0) directive
By setting up the individual configuration bits in the table (Configure
Configuration bits)
It is necessary to indicate/ not to indicate the selected method in the left upper
corner of the table of configuration bits
Project setup for Microchip ICD-2
 Display the source text
 Activate the “Output” window
 Activate the “Watch” window
 Arrange all windows suitably on the desktop
 Save the desktop setup
 Save the project
Summary of the subject matter - exercises
 How do you find out whether the USB device of the ICD-2 was installed
correctly?
 Can an instruction board be supplied from the ICD-2?
 During the work with the ICD-2, is it necessary for the oscillator of the
microcontroller to work on the instruction board?
 What is the principle of the activity of the “In Circuit Debugger (ICD)” mode?
Where is its advantage?
Summary of the subject matter - exercises
 What is the use of so-called “configuration bits”? Is it always necessary to
use them, or can we, in some cases, do without them?
 Where do we find the meaning and function of individual configuration bits?
 What purpose does the “Code protection” function serve?
 What is the function of the “Watchdog timer” in a microcontroller?
References




Datasheet Microchip PIC16F882/883/884/886/887 DS41291E
(http://www.microchip.com)
Microchip.com: Getting Started with PICmicro MCUs
Microchip.com: MPLAB IDE User’s Guide
Microchip.com: Quick Guide to Microchip Development Tools