Lab Procedure: Opening an Existing MPLAB...

Post on 13-Sep-2018

228 views 0 download

Transcript of Lab Procedure: Opening an Existing MPLAB...

Lab Procedure: Opening an Existing MPLAB Project

CTEC1904/2015W Microprocessor Technology

1.  Connect  the  Board  to  PC  First,  plug  the  power  supply  into  the  jack  on  the  PICTRAINER  BOARD  and  then  to  an  AC  outlet.    Boot  up  your  PC  and  log  in  using  your  username  and  password.    Plug  in  the  red  USB  cable  into  a  USB  jack  on  the  front  panel  of  the  PC.    Windows  7  should  recognize  the  PICkit  3  device  as  a  “Human    Interface  Device”  (HID).  

2.  Download  the  Project  Archive  from  the  course  web  site  or  from  Blackboard  

3.  Save  the  Archive  to  the  Desktop  

4.  Extract  the  Archive  

•  Right  click  to  use  7-­‐Zip    

5.  Open  MPLAB  IDE  

•  File  |  Open  Workspace  …  

Open  MPLAB  (2)  

•  Choose  the  project  folder  that  you  just  extracted  …  and  then  the  Workspace  file  …  

Project  Opened  

Work-­‐space  

Output  Window  Source  Window  

6.  Build,  Program  and  Run  •  You  can  perform  these  steps  either  using  the  Project  menu  or  the  toolbars…  

•  Step  1  is  “Build  All”  

Build,  Program  and  Run  (2)  

•  In  the  Build  tab  of  the  Output  window,  you  will  see  various  messages  …  ul`mately  “BUILD  SUCCEEDED”  

Build,  Program  and  Run  (3)  

•  The  build  assembles  the  source  code  into  PIC18F  machine  code.  

•  The  Program  bubon  uploads  the  machine  code  to  the  PIC18F8722  microcontroller  on  the  board,  through  the  PICkit  3  device.  

Build,  Program  and  Run  (4)  

•  The  PICkit3  tab  in  the  Output  window  will  show  communica`ons  messages  between  the  PC  and  the  PICkit  3  device.  

•  Looking  for  “Programming/Verify  complete”  

 

Build,  Program  and  Run  (5)  

The  Run  bubon  starts  the  program  on    the  PICTRAINER  BOARD.    MPLAB  will    show  an  anima`on  at  the  bobom  of    the  window,  and  a  green  arrow  in  the  Source  window  (at  the  first  instruc`on.)  

7.  Halt  and  Reset  

The  Halt  bubon  stops  the  program  …  the  Source  window  places  the  green  arrow  at  the  instruc`on  where  the  program  was  stopped  at.    

Halt  and  Reset  (2)  

The  Reset  bubon  sets  the  board  to  a  “Power-­‐On  Reset”  (POR)  state,  and  puts  the  green  arrow  at  the  first  instruc`on  in  the  program.  

8.    Close  the  Workspace  

•  File  |  Close  Workspace      

(If  you  have  made  changes  to  either  the  code  or  the  workspace  windows,      you  are  prompted  to  save  the  workspace  before  MPLAB  closes.)