For each problem list all references used or students consul

For each problem, list all references used or students consulted (see ECE 118 Collaboration Polity on blackboard) Turn this homework in digitally through Blackboard as a single PDF file. Feel free to either use a word processing system to create your PDF, or print this PDF out, write on the paper, anal then scan or take a picture to create a PDF to turn into Blackboard. What is the difference between an assembly instruction anal an assembly directive? Explain what each line of the following code does and what data is created and stored. Make sure to include all relevant memory locations if appropriate. EQU VAR1 0X2F MOVALW VAR 1 MOVWF VAR 1 Describe the three main addressing modes of the PIC 16 architecture discussed in class. For each of the modes include two examples. Write a PIC 16 assembly program which will accomplish the following instruction. 1 just want the section of assembly code which accomplishes this. Make VAR1 =0x22. VAR1 = 0X42 + (0XF0 AND 0XAA) - (0X12 OR0X34) Perform the above calculation by hand, showing all your work in binary.

Solution

1)Assembler Instruction is a task to the processor that is to be carried out during run time. They are converted in to machine code and are linked with the executale code. hence they occupy the memory.

The Assembler directive is the instruction to the assembler to how to treat the data. it is responsible for how the task is running but it does not provide any machine code hence does not consume any memmory.

EQU VAR1 0x2F: this assigns a value of 0x2F to literal VAR1.

VAR1=0x2F

MOVLW VAR1 :- move contents of literal VAR1 to W register(Accumulator) i.e Move The contents of VAR1 To W . So now W      contains 0x2F.

W=VAR1

MOVWF VAR1: move the contents of W to VAR1

VAR1=W

2)

The main adressing modes are
1)Immediate addressing mode
2)Direct addressing mode
3)indirect addressing mode

Immediate:Here the operand part of the instruction is either a number or constant;the operand section does not contain any address. It is the fastest mode.

eg:MOVLW 43h
   MOVLW 0Fh

Direct: this uses the 9 bit addressing.The last 7 bits i.e the operand part of the instruction is used to idenfy the address of the register memory and the remaining two bits are taken from the status register(RP1,RP0).
since the instructio directly provides address it is called direct addressing

eg:movwf TRISA

    ADDLW k

indirect: in this the instruction does not provide any address. the adress is fetched using the IRP bit of STATUS register and FSR. The address is accessed by INDF . INDF holds the address given FSR.
It is very Helpfull while using arrays.

eg: movwf FSR
    clrf INDF //clear address indicated by FSR
   
3)MOVLW 0xAA                                                    //W=0xAA

MOVWF a                                                             //a=W

MOVLW 0xF0                                                        //W=0xF0

ANDWF a,b                                                            //b=a AND W

MOVLW 0x34                                                        //W=0x34

MOVWF a                                                              //a=w

MOVLW 0x12                                                        //W=0x12

IORWF a,c                                                              //c=w OR a

MOVLW 0x42                                                          //W=0x42

ADDWF b,a                                                             //a=W+b

MOVLW 0x00                                                            //W=0x00

MOVWF d                                                                   //d=0x00

MOVF c,d                                                                   //W=c      SINCE d=0x00

SUBWF a,VAR1                                                             //VAR1=a-W

 For each problem, list all references used or students consulted (see ECE 118 Collaboration Polity on blackboard) Turn this homework in digitally through Black
 For each problem, list all references used or students consulted (see ECE 118 Collaboration Polity on blackboard) Turn this homework in digitally through Black

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site