Presentation is loading. Please wait.

Presentation is loading. Please wait.

Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/

Similar presentations


Presentation on theme: "Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/"— Presentation transcript:

1 Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/04.0002
Anglicky v odborných předmětech "Support of teaching technical subjects in English“ 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/ je spolufinancován Evropským sociálním fondem a státním rozpočtem České republiky.

2 Practical exercises Task No. 2: Drat_2 Directive ORG, EQU, #DEFINE
Instruction IORLW Bit masking by means of logic functions Work procedure: Create a new source file and save it to the folder named “Drat_2” under the “Drat_2.asm” name. Rewrite the source text from the supplied task printout to the editing window. Check the finished source text and save it (rewrite the saved empty file).

3 Practical exercises Task No. 2: Drat_2
Create a new project (use the procedure from chapter 11): Project name: Drat_2.mcp, folder Drat_2. Insert the source file Drat_2.asm. Check and confirm the correctness of the assignment. Save the project.

4 Practical exercises Task No. 2: Drat_2
Connect the MPLAB ICD-2 debugger to the USB port of the computer. Connect an instruction board (to the ICD-2) and connect the supply voltage of 9V to the instruction board. Carry out the necessary setups and checks. Translate the program (Ctrl F10), eliminate possible errors.

5 Practical exercises Task No. 2: Drat_2 Launch the program (F9).
Check the correct function of the program: Press any button on the instruction board (except the Reset button). Check whether the corresponding LED diode is switched on when the button is pressed. Try out how the program reacts when more buttons are pressed at the same time. If the program does not work according to predictions, find the error by means of the procedures which were tried before and correct it.

6 Practical exercises Watch Window: The Watch Window is used for displaying selected Special function registers, user registers and variables. Adding a register: Right mouse button, select “Add” Select a register from the pull-down menu Select a display format Insert by the “Add SFR” button Close the window by the “Close” button

7 Practical exercises Step-by-step operation of the program:
STEP INTO (F7): one instruction is carried out and, in the Watch window, the content of the selected registers is displayed. STEP OVER (F8): the main program is stepped, the subroutines run at full speed. STEP OUT: ensures a quick return from the heart of the subroutine (advantageous especially in delay loops etc.).

8 Summary of the subject matter - exercises
Have you noticed any change in the behaviour of the program in comparison with the Drat_1 program? If so, are you able to explain its cause? Find a proper change in the program listing and explain it!

9 Summary of the subject matter - exercises
Try to explain the function of the OR instruction! How is this function used in this program? How would the program behave if we used the AND function at the same place of the program? Do you know some other logic functions?

10 References Datasheet Microchip PIC16F882/883/884/886/887 DS41291E ( Microchip.com: Getting Started with PICmicro MCUs Microchip.com: MPLAB IDE User’s Guide Microchip.com: Quick Guide to Microchip Development Tools

11 Appendices Appendix No. 2: Source text listing of the “Drat_2” program. Appendix No. 2, necessary to be translated in Notepad.


Download ppt "Projekt Anglicky v odborných předmětech, CZ.1.07/1.3.09/"

Similar presentations


Ads by Google