Starting with Assembly

How to start with programming your own microcontroller with MPLab (V8.43)
The big lines:


Step 1.

First of all you need a programmer. A programmer is a device that is capable of programming your microntroller. There are a lot of different programmers around, but i will show you the one I use. It's a cheap and easy to use programmer and you can communicate with it with USB. You probably have to do some fighting with finding the right drivers. The Olimex programmer I use, is communicating through USB with a FTDI chip. Check this website.   olimex programmer
  This is the PIC-MCP-USB programmer. Check the website : https://www.olimex.com/Products/PIC/Programmers


Step 2.

You will need to install Microchips MPLab. With this software you can write, test, debug and program microchip products. MPlab is a big program, that will enable you to create complex assembly code. I only use a small part of the total software package; enough for me to make nice electronics! 


Step 3.

Make a choice which microcontroller you are going to use. There is a wide family of microcontrollers to work with. For my Ipson devices, I work with the following chips: PIC18F1220 :18 pin microcontroller PIC18F2423: 28 pin microcontroller, PIC18F4523: 40 pin microcontroller. The chips pointed out, actually are of the same family (8-bit microcontroller), but mainly the amount of pins (read inputs and ouputs) are different 


Step4.

Look for the right code that complies with your whishes of your project. You could start with some simple code, like a blinking led. I will add code examples on this website.

First thing you have to do is select your programmer. If you use the Olimex programmer, you have to select the 'PicstartPlus". If all drivers are there and if you selected the right port, the programmer will be happy to run. The next step is to load your .asm file into MPLab. In the case of the screenshots below, the file 'oscset3.asm' is already loaded.
You can see different colours in the code. Green means comment. All text with ; in front, is comment. The blue text is the command. The red text are labels.

mplab 1

Make sure you select the right device and the right configuration. Now you have to 'compile' your code into machine code and program the chip. This means that the compiler inside MPlab, "rewrites" your code into machine code, that will fit into the chip. Normally this is a file with the extension *.obj or *.hex.

The 'Build succeeded' means that the object code is generated.

mplab 2

Now you still have to upload the code into your chip. So place the chip in the socket, and make sure you have pin-1 on the right position. Go to 'programmer/program' and the chip will be prgrammed. In the left corner you can see the indication of the process.
When the output window indicates 'Programming/Verification completed successfully', your chip is ready to go. This means by the way, that the chip is exactly working according to your code. This does not mean that your electronics is working perfect.  You probably still have to re-program your chip with minors (or mayor) modifications, before your electronics does exactly what you want it to do.

mplab 3


The screenshots are made of MPlab version 8.43. At this moment Microchip already has version 10 (X) out that works from within your web browser. I did not make that step yet, simply because I did not get it to work with my Olimex programmer (yet). At this moment I still program my microcontrollers with Windows XP (simulated on my Mac with Virtual Box). 




 Features of the different chips:

 PIC18F2423 and PIC18F4523

 p2423 features

 

 

 

 



PIC18F1220
18f1220 features