October 2017

SECTION VI-10: Executing a Program Byte by Byte

The list file program in previous section when burned into the ROM of a PIC18 chip, the following step by step description of the action of the PIC upon applying power to it:


SECTION VI-9: Placing Code in Program ROM

Lets examine the action of the Program Counter PC as each instruction is fetched and executed. First, we examine once more the list file of the sample program and show how the code is placed in the ROM of the PIC chip. The opcode amd operand for each instruction are listed on the left side of the list file.

SECTION VI-8: Where the PIC Wakes Up when it is Powered Up

The question is that, at what address does the CPU wake up when power is applied? Each microprocessor is different. In the case of PIC family, all members of the family and variation, the PIC microcontroller wakes up at memory address 0000, when it is powered up. By powering up we mean applying Vcc to the RESET pin. 

SECTION VI-7: ROM Memory map in the PIC18 Family

Some PIC family members have only a few K of on-chip ROM, PIC18F2220, and some such as PIC18F6680, have 64K of ROM. PIC18F458 has 32K of on-chip ROM. No member of the PIC family can access more than 2M of opcode because the program counter in the PIC is 21-bits wide, 000000 to 1FFFFF address range.

SECTION VI-6: The Program Counter and Program ROM Space in PIC

The role of the Program Counter (PC) in executing a program and show how the code is fetched from ROM and executed.

SECTION VI-5: "lst" and "map" Files in PIC

The lst (List) and map files are very useful to the programmer. The list shows the binary and soure code. The map file shows the memory layout of used and unused memory locations. These files can be accessed by an editor such as Notepad and displayed on the monitor, or sent to the printer to get a hard copy. The programmer uses the list and map files to ensure correct system design.


SECTION VI-4: asm, err, and Object Files in PIC

The asm file is also called the source file and must have the "asm" extension. The asm file is created with a text editor such as MS-DOS EDIT or Windows Notepad. Many assemblers come with a text editor. The assembler converts the asm file's Assembly Language instructions into machine language and provides the o (object) file. The PIC assembler produces the object and error files. The object file has an ".o" extension.

SECTION VI-3: Assembling and Linking a PIC Program

The steps to create an executable assembly language program are mentioned below:


SECTION VI-2: Structure of Assembly Language

An assembly language program consists of, among other things, a series of lines of Assembly language instructions. An assembly language instruction consists of a mnemonic, optionally followed by one or two operands. The operands are the data items being manipulated, and the mnemonics are the commands to the CPU, telling it what to do with those items.

SECTION VI-1: Introduction to PIC Assembly Programming

The CPU can work only in binary, it can do so at a very high speed.. To deal with 0's and 1's in order to program the computer. A program that consists of 0's and 1's is called machine language. In the early days of the computer, programmers coded programs in machine language. Although the hexadecimal system was used as a more efficient way to represent binary numbers, the process or working in machine code was still cumbersome for humans.

SECTION V-10: Rules for Labels in Assembly Language

By choosing label names that are meaningful, a programmer can make a program much easier to read and maintain. There are several rules that names must follow. First, each label name must be unique. The names used for labels in assembly language programming consist of alphabetic letters in both upper and lower case, the digits 0 through 9, and the special characters question mark (?), period (.), at (@), underline (_), and a dollar sign ($). The first character of the label must be an alphabetic character.

SECTION V-9: ORG - Origin, END, LIST, #include, _config, radix Directives

ORG, Origin :-

The ORG directive is used to indicate the begining of the address. It can be used for both code and data. The number that comes after ORG must be in Hex.

END Directive:-


More From Iamtechnical.com

Facebook Like For Iamtechnical.com !