PIC is the name for the Microchip microcontroller (MCU) family, consisting of a microprocessor, I/O ports, timer(s) and other internal, integrated hardware. The main advantages of using the PIC are low external part count, a wide range of chip sizes (now from 5-pin up!) available, nice choice of compilers (assembly, C, BASIC, etc.) good wealth of example/tutorial source code and easy programming. Once bought, the PIC's program memory is empty, and needs to be programmed with code (usually HEX files) to be usable in a circuit.
Q: What can I do with the assembly source code for the PIC microcontroller?
A: First, you need a compiler, which takes the source
code in the form of asm (assembly), inc (include), and lkr (linker script)
files. You can compile microchip assembly files with gputils or mpasm,
part of MPLAB.
(Gputils are command line utilities, mplab is a graphical development
environment)
The compiler will output a hex file, suitable for programming into
the device. You need a programmer device for that. It is an interface
between the computer and the microcontroller. I recommend using the
Pickit 2
or 3 this purpose.
Please read the pcbheaven pic
pages to get started with compiling code and programming the PIC
microcontrollers.
Q: How do I compile a HEX file from multiple source files (linked project or relocatable code) ?
Start MPLAB, and select project/project wizard. Choose the target microcontroller you see in the circuit diagram (for example, PIC16F628). Choose the MPASM toolsuite. Add all assembly (*.asm), header (*.inc) files and the linker script (*.lkr) to the project. Select project/build all. If asked, choose generating "relocatable code", and not "absolute code".Q: Where is all this assembly language documented?
A:You can find the PIC microcontroller instruction set documentation in the microcontroller datasheets at microchip.com. The PIC12, PIC16, PIC18, PIC24, PIC32 families of microcontrollers have different instruction sets. In addition, the general syntax of the code (labels, variables, macros, etc.) is described in the mpasm documentation.