At present you MUST be logged on as Administrator.
Open Device Manager (Start -> Run…, enter “devmgmt.msc” (without the quotes)
Click the "+" to the left of "Ports (COM & LPT)"
Right-click on "Communications Port (COM1)" and select "Properties" on the drop-down menu
Click the "Port Settings" tab. Make sure that you have these selections:
Bits per second 57600 or higher; I use 115200
data bits: 8
Parity: None
Stop bits: 1
Flow control: Hardware
Then, click the "Advanced" button and uncheck the box "Use fifo buffers..."
Click "OK" twice, close all the windows, and reboot your Windows machine. The necessary settings will not take effect without a reboot.
Place your C source code in a file with the extent “.c” in a folder on the C: drive. Do not use the desktop as user files there will be deleted. Suggested folder: C:\SophClinic\PIC_SC_Section<nn> where <nn> is your section or team number. You may begin with the sample file provided on the course web page.
You MUST have all of these with you to test and run your program:
Your PIC board.
The PIC board power supply.
The ISC-2 Tiny programmer, its power supply, and
the short cable that connects it to your PIC board.
You can write your program and compile it with the workstation alone, but you must have the PIC board, programmer with its cable, and power supplies to run or debug your code. You must have the RS-232 cable or you will have to mount the programmer on the back of the computer; use with the H-bridge and motors is very difficult without the RS-232 cable.
Ask Phil or myself to log you on as administrator to one of the machines in room 237. Connect your RS-232 cable to COM1 on the back of the workstation. Connect the other end to your OLIMEX PIC-ICD-2-TINY. Use the short white six-conductor cable for your ICD-2 to connect it to your PIC project board.
Plug your Olimex power supply in and connect it to the PIc-ICD-2-TINY. Make sure that your project board power supply is properly configured and that you have checked its output for polarity.
To test the H-bridge, you will need
An interface (or breadboard of an interface),
A power supply set up for 5 Volts, and
Two motors.
Copy the project quickstart baseline software, main.c, to the folder where you want to maintain your project. Start the MPLAB IDE program:
Start -> Programs -> Microchip -> MPLAB
IDE v.40 -> MPLAB IDE
Under the Project menu, select Project Wizard.
Step One:
For the Device, select PIC16F876A.
Step Two:
For the Active Tool suite, select "CCS C
Compiler for PIC 12/14/16/18"
Step Three:
For "Project Name," select a name for
your project.
For "Project Directory" navigate to
the folder where you previously placed the source code.
Step four:
Add main.c, the
project quickstart baseline software source code
file, to your project.
Summary:
You should see the Device, Toolsuite,
and File. Click Finish.
Under Debugger (or Programmer), select "Select Device" and then "MPLAB ICD 2." Ignore any errors.
Under the same Debugger (or Programmer) menu, select "MPLAB ICD 2 Setup Wizard."
Communications:
Baud rate: 57600
Power: Target has own power supply
Connection: Check "MPLAB IDE automatically connects to the MPLAB ICD 2"
Download: Check "MPLAB ICD 2 automatically downloads the required operating system." This may take two or three tries when the time comes; just keep going if you get an error on download.
Summary: You should see a list of your selections. Click Finish.
You will get a warning to disable your COM port FIFO buffers, and we did that first. Click OK.
Under the same Debugger (or Programmer) menu, select "Properties." Click the Status tab. You should see that the Connect Status is Connected, and a list of Self Test boxes all marked Pass. Click OK.
Under Project, select Compile.
Under debugger, select "Select Tool"
-> "MPLAB ICD 2."
Under View, select "Locals."
Under "Debugger" select
"Program."
Under Debugger, select "Step Over"
(or, press F8) and look at the Locals window.
You should see listings of all the variables in the program. In the window with the source code, a green
arrow in the left margin will indicate the next line of code to execute when
you press F8 again.