Things You'll Need
Instructions
Install the Hardware
Connect a standard 9-pin male-to-female serial cable to your computer serial port. The serial port might also be labelled as a COM port.
Connect the other end of the serial cable to the ICD2-Tiny PIC programmer. "ICD2-Tiny" is a reduced size version of the ICD2 programmer. ICD stands for "In-Circuit Debugger." The programmer also has an "ICSP" connector to attach the programmer to the development board.
Connect the ICSP cable to the development board, and attach the 15-volt power supply to the board.
Program the PIC
Create a simple program that will turn bit "0" of port "A" off and on every .3 seconds. Copy the PHP code snippet below in a Notepad or word processing document:
#include <p18f452.h>
while(1){
Compile and program the PIC with the code in Step 1.
Enter the DSP control software into the host computer to read the motor control code.
Connect a Host to the PIC
Download software to run the AC servo motor. MPLAB is an example to illustrate the process. Open the Project Wizard to begin the software configuration. Click "Next."
Choose your device from the list. In this case, it is the PIC controller. Once finished with the choices, click "Next."
Name and save your project. MPLAB provides a summary screen at various steps to recap what has been chosen. Click "Finish" to configure your project with the listed parameters.
Open this saved file and choose the PIC programmer again from the drop-down list.
Choose the COM port on the computer and click "Next."
Download the specific customized operating system for you hardware, verify the system configuration and click "Finish" to save the customized operating system that will run the AC servo motor.
#include <delays.h>
void main(void){
TRISA = 0x00;
PORTA = 0x00;
PORTA = 0x01;
Delay10KTCYx(150);
PORTA = 0x00;
Delay10KTCYx(150);
}
}
« End Code »