Wednesday, June 8, 2011

pic programming tutorial

Introduction :
Welcome to the start of the PIC. These pages will form the basic structure of the device, right through methods and programming techniques. In addition, there will be suggestions on how to modify the code so you can adapt the PIC to suit your applications within Cybot. I will not be including internal architecture diagrams, as this can only lead to confusion. To view the data sheet, then this can be downloaded from the website of microchips.

For starters, let's look at the PIC.

Microchip PIC 16F84 Microcontroller

Microchip manufacture a series of PIC microcontrollers called. You can see the range of microcontrollers here. There are many different flavors available, some basic types of short memory, go straight through those who have analog - digital converters to the PWM even built in. I'm going to concentrate on the PIC 16F84. Once you have learned to program a PIC type, learning the rest is easy.

There are several ways to program the PIC - using BASIC, C or assembly language. I'll show you the assembly language. Do not be intimidated by this. There are only 35 instructions to learn, and is the cheapest way to program the PIC, as it requires no additional software beyond the gifts. 

Ther is a Pin configuration of PIC 16f84 and its Detail.

To RA0 RA4
RA is a bidirectional port. Ie can be configured as input or output. RA The next number is the number of bits (0-4). Thus, we have an address of 5 bits, where each bit can be configured as input or output.

RB0 to RB7
RB is a second bidirectional port. It behaves exactly the same way as RA, except that it is 8 - bits involved.

These are the power pins. VDD is the positive supply and VSS is the negative supply or 0V. The maximum voltage that can be used is 6 V, and the minimum is 2V

These pins are where we connect an external clock, so that the microcontroller has some kind of calendar.

This pin is used to erase the memory locations inside the PIC (ie, when we return to the programs.)In normal use, is connected to the positive supply rail.

This is an input pin that can be controlled. If the pin is high, we can make the program to restart, stop, or any other unique feature that we want. We will not use this one much.

This is another clock input, which operates an internal timer. Works in isolation from the main clock. Again, do not use this much

 How to Program The Pic
 Now, you want to know how to program the PIC, but apart from learning the instructions of assembly code, how you go about actually programming the information? Well, there are two ways - the easy way, and how to DIY. The easiest way is to buy a PIC programmer (about £ 35), which connects to the PC and you can program the PIC using the supplied software. The DIY way is to build your own programmer (cheaper is less than £ 20) and the use of Internet and free software program that way.

Go to next Section

1 comment: