Programming in Assembler

In these lessons you will be introduced to programming the microchip using a language called assembler. Assembler is called a first generation language because it is only one step away from machine language (machine language is entirely ones and zeros). Assembler is a relatively easy language because there are only a limited number of commands and the commands are easy to interpret. However assembler cam be very tedious since every machine cycle must be programmed, and it does require a fairly detailed understanding of the computer architecture.

Assembler is very useful to know and is used often by professional embedded systems designers. Often a higher level language, like basic or C, may not have enough commands to do what you wish. Most higher language compilers used for microcontrollers allow for the direct insertion of assembler code into the higher level code. This allows commands to be developed and added when needed.

The example that is included in this lesson has to do with more accurate timing than we can do with a higher level language. Assembler is useful for accurate timing since you can account for every clock cycle in the code. In Basic is is not easily possible to know how many clock cycles are used for a command to execute and as a result it may not be the best language to use in projects when accurate timing is required.

This lesson involves; (Details are linked to the description)

Step
Description
Hardware and software used
1
Use a text editor to create an assembler file (from an example).
Any text editor, example Notepad
2
Assemble the file
MPASMWIN - free from Microchip
3
Program a microcontroller
ic-prog, the JDM modified programmer, PIC16F628A
4
Connect the circuit and test the program
breadboard, 5 V power supply, 32768 Hz Xtal, 2x 15-30pF caps, 0.1 uF tantalium, 1k resistor, 10k resistor and an LED
5
Analize the code to make sense of it.

 

Technological Design Home