Presentation is loading. Please wait.

Presentation is loading. Please wait.

Training program: Mechanic - electrotechnician Program name: Digital processing - microprocessors III. class Microcontrollers Elaborated by: Vlastimil.

Similar presentations


Presentation on theme: "Training program: Mechanic - electrotechnician Program name: Digital processing - microprocessors III. class Microcontrollers Elaborated by: Vlastimil."— Presentation transcript:

1

2 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.

3 Practical exercises Task No. 1: Drat_1 Work procedure:  Create a new (for the time being empty) source file and save it to the folder named “Drat_1” under the “Drat_1.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). Instructions: NOP, BSF, BCF, CLRF, MOVF, MOVLW, MOVWF, GOTO. The meaning of the "d" symbol (destination)

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

5 Practical exercises Task No. 1: Drat_1  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 according to the procedure in chapter 11.  Translate the program (Ctrl + F10).  Check the correctness of the translation in the “Output” window.  If errors were reported in the course of translating, find out their cause and eliminate them.

6 Practical exercises Task No. 1: Drat_1  Launch the program (Debugger/Run)  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.

7 Practical exercises Task No. 1: Drat_1  If the program does not work according to expectations, check the source text and try to find an error. When doing this, use step-by-step modes “Step Into, Step Over” and error indication in the “Output” window.  Activate the “Watch” window, display the used registers in it, watch their content during the step-by-step operation of the program and compare it with the required values. In case of any interference in the source text, do not forget to translate the program again and program the microcontroller!

8 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.). Practical exercises

9 Summary of the subject matter - exercises  Why is it necessary to translate the source text before the launch of a program?  How do you best and fastest find out the kind of an error in case of an incorrect translation?  If the translation is carried out faultlessly, does it automatically mean that the program will work as it is supposed to?  What is the principle of the activity of the “In Circuit Debugger (ICD)” mode? In what is its advantage?

10 Summary of the subject matter - exercises  The NOP instruction (No Operation) does not do anything. What is it good for then?  Explain the function of the BSF and BCF instructions.  Explain the function of the MOVF and MOVWF instructions.  Why is the GOTO instruction labelled as a so-called “conditional jump”?  What comes, conversely, to your mind when you hear the term “unconditional jump”?

11  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 References

12 Appendices  Appendix No. 1: Source text listing of the “Drat_1” program.  Appendix No. 1, necessary to be translated in Notepad.


Download ppt "Training program: Mechanic - electrotechnician Program name: Digital processing - microprocessors III. class Microcontrollers Elaborated by: Vlastimil."

Similar presentations


Ads by Google