Vous êtes sur la page 1sur 10

Overview of a PIC16F877A Microcontroller

PIC16F877A is a 40-pin microcontroller which has 33 i/o pins; which consist of RA0-RA5(6 pins), RB0-RB7(8 pins), RC0-RC7(8 pins), RD0-RD7(8 pins), RE0RE2(3 pins).

Circuits for switching selection of running light

Figure 1 generated from ISIS7

The figure above shows the basic circuit for LED switching selection. Number of switches or LEDs depends on the coding. The simulator used is ISIS 7 by Labcentre Electronics.

Coding for switching selection of running light

Figure 2 PCW programmer

The above figure shows a basic coding programmed to display desired LED sequence based on the input given. The programming tool used is PCWH Compiler. The coding used is displayed in the appendix.

Using the PCWH

This is the interface of PCWH or PIC C compiler. To make new project; 1. Select the folder icon on the top left. 2. Click on new, a tab should open like the above. 3. Select source file. Insert the project name and where it would be save, then click OK. You will be redirected to the home screen of PCWH.

This is the home screen of a PCWH compiler. The white region is where you type in the coding for your project.

This is the toolbar that is commonly used. After you type in the coding, to check, you must compile the coding. It will check whether there are errors in the coding.

A text box like this should appear at the bottom after you compiled the coding. Make sure there are no errors. If there are no errors, the compiling will give out eight output files, such as .asm, .hex, .sym, .lst, and so on. But the most important file of them is the hex file, where it will be used for integration into the simulator and the hardware.

Using ISIS 7

This is the interface of ISIS 7. The box on the interface is where you design your circuit. On the left of the box is all the tools and the components. The components that you have used will be listed on the white box on the left. Components can be searched using the P button under the small box on the top left corner.

This is a sample of circuit design. To integrate the hex file into the PIC; 1. Double click on the PIC. A box should open.

2. Insert the processor clock frequency, which depends on the crystal oscillator used. 3. Click the folder icon at the program file row. Search for your file. 4. Then click OK.

This is the control that runs the simulation. After clicking OK, the simulation can be started by clicking on the PLAY button. This control can be found on the bottom left corner. To stop, click on the STOP button. Note that when simulating, none of the circuits can be re-designed.

Integration between Hardware & Software


The integration of hardware and software is done when the simulation is okay. The only way to check that the integration is successful is through testing method. If there are any problems, the hardware or software needs to be troubleshoots.

This is the interface of PICkit 2 developed by MICROCHIP Industries. This software is used to write the coding into the PIC Microcontroller. The PIC Microchip can be re-write and erase up to 1000 times, as long as it does not get broken or shorted when used. These are the steps to use the software.

1. 2. 3. 4.

Open the PICkit 2 software. Connects your PIC burner with the PIC Microcontroller attached. After connection, press TOOLS>CHECK COMMUNICATION. If the PIC is still not connected to the software, check USB connection, or PIC Microcontroller pin connection. If it still does not work, the PIC Microcontroller may have broken. 5. Once connection is established, press the READ button to see whether there are any coding written on the PIC Microcontroller. 6. To delete the coding inside the PIC Microcontroller, press ERASE. Once finish, click on BLANK CHECK. 7. To write the coding, press FILE>IMPORT HEX. Locate the designated hex file and click.

8. Then, click on the WRITE button. 9. Once the step is finish, click on VERIFY to make sure the coding is successfully written. 10. Once verified, disconnect the burner from your computer.

Vous aimerez peut-être aussi