0% found this document useful (0 votes)
26 views

Embedded Systems 6

Uploaded by

farsdbysh45
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Embedded Systems 6

Uploaded by

farsdbysh45
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 184

PIC MICROCONTROLLER

• PIC
(USUALLY PRONOUNCED AS "PICK") IS A FAMILY
OF MICROCONTROLLERS MADE BY MICROCHIP
TECHNOLOGY, DERIVED FROM THE PIC1650
EMBEDDED SYSTEM

• An embedded system is a combination of computer hardware and


software designed for a specific function. Embedded systems may
also function within a larger system. The systems can be programmable
or have a fixed functionality.
SOME MEMBERS OF THE PIC18 FAMILY
THE WREG REGISTER IN THE PIC

WREG register, in the CPU, register are used to store


information temporarily, with an 8-bit data type
MOVLW instruction
ADDLW instruction
PIC WREG and ALU using literal value
MOVLW, ADDLW instructions
WHAT IS THE FINAL VALUE?
MOVLW 12H
ADDLW 16H
ADDLW 11H
ADDLW 43H

SOL; = 7CH
MOVLW, ADDLW instructions

• What is the output of each?


MOVLW 7F2H
MOVLW 456H
MOVLW 60A5H
FILE REGISTER (DATA RAM) SPACE
ALLOCATION IN PIC
• SFR (Special Function Register)
• GPR (General Purpose Register Or RAM)
MOVWF instruction
MOVWF instruction
WHAT DO YOU THINK?
EXAMPLE
• STATE THE CONTENTS OF THE FILE REGISTER RAM LOCATIONS AFTER THE FOLLOWING PROGRAM.
SOLUTION
ADDWF instruction

ADDWF FIleReg, D

IF D=0 → TO WREG
IF D = 1 → TO FILE REGISTER
EXAMPLE
• WHAT DO YOU EXPECT IN WREG AND GPR ?
SOLUTION

WREG = 88H
EXAMPLE
• WHAT DO YOU EXPECT IN WREG AND GPR ?
SLOUTION

WREG = 66H
EASIER FORMAT
EXAMPLE
• State the contents of RAM and WREG of the following.
SOLUTION

WREG = 22H
EXAMPLE
• State the contents of RAM and WREG of the following.
SOLUTION

WREG = 88H
WREG. filereg, and ALU in PIC18
COMPF instruction
•COMPF FileReg, D

Example: Write a simple program to toggle the sfr of port b


continuously forever
SOLTION
DECF instruction
MOVF VS. MOVFF instructions
MOVF fileReg, D
PIC18 STATUS REGISTER
STATUS REGISTER
MOVLW 38H MOVLW 9CH MOVLW 88H
ADDLW 2FH ADDLW 64H ADDLW 93H

C=0 C=1 C=1


DC = 1 DC = 1 DC = 0
Z=0 Z=1 Z=0
VALID FORMAT
INVALID FORMAT
USING EQU FOR FIXED DATA ASSIGNMENT
USING EQU FOR FIXED DATA ASSIGNMENT
USING EQU FOR SFR

HOW

WHAT’S THE SUMMATION?
MYVAL = 9

→ →

SUM = ?
QESTION
NEW CHAPTER
Looping in PIC
DECFSZ Instruction and looping

DECFSZ (Decrement filereg skip zero)


Flowcahrt for the DECFSZ instruction
EXAMPLE
Write a program to (a) clear WREG, and (b) add
3 to WREG ten times and place the result in SFR
of PORTB. Use the DECFSZ instruction to
perform looping.
SOLUTION
EXAMPLE
Write a program to (a) clear WREG, and (b) add
3 to WREG ten times and place the result in SFR
of PORTB. Use the BNZ instruction to perform
looping.
SOLUTION
QUIZ

What is the maximum number of times that


the loop in the previous example can be
repeated?
ANSWER
Loop inside a loop

Write a program to
A. Load the PORTB SFR register with value 55h.
B. Complement PORTB 700 times
SOLUTION


Looping 100.000 times


Other conditional jumps
EXAMPLE

Write to determine if filereg location 0x30


contains the value 0 if so, put 55h in it
SOLUTION
EXAMPLE

Find the sum of the values 79H, F5H, and E2H.


Put the sum in filereg locations 5 (low byte) and
6 (high byte).
SOLUTION


FOLLOW SOLUTION
GOTO to itself using $ sign
HERE GOTO HERE

We can use the following:


GOTO $
To keep the microcontroller busy
BRA to itself using $ sign
THIS WILL ALSO WORK FOR THE BRA INSTRUCTION, AS SHOWN
BELOW:
OVER BRA OVER
WHICH IS THE SAME AS:
BRA $ ;$ MEANS SAME LINE
CALL instruction
CALL LABEL
…………
LABEL ………
RETURN
EXAMPLE

Toggle all the bits of the SFR register of port B by


sending to it the values 55H and AAH
continuously. Put a time delay in between each
issuing of data to port B.
SOLUTION


Instruction cycle time for the PIC

1 instruction cycle = 4 oscillator pulse


If using oscillator = 4 MHZ
1 instruction cycle = 1µs
CAPACITOR SELECTION FOR CRYSTAL
OSCILLATOR
EXAMPLE
The following shows the crystal frequency for three
different PIC-based systems. Find the period of the
instruction cycle in each case.
(A) 4 MHz (B) 16 MHz (C) 20 MHz
SOLUTION

(A) 4/4 = 1MHz; instruction cycle is 1/1 MHz= 1 µs (microsecond)


(b) 16 MHz/4 = 4MHz; instruction cycle= 1/4MHz= 0.25µs= 250 ns
(nanosecond)
(c) 20 MHz/4 = 5 MHz; instruction cycle= 1/5 MHz= 0.2µs = 200 ns
EXAMPLE
For a picl8 system of 4 MHz, find how long it takes to
execute each of the following instructions:
(A) MOVLW (b) DECF (c) MOVWF (d) ADDLW
(e) NOP (f) GOTO (g) CALL (h) BNZ
SOLUTION
QUESTION
Find the size of the delay of the code snippet below if the
crystal frequency is 4 MHz:
ANSWER
We have a time delay of[(255 x 5) + 1 + 1 + 1] x 1µs =
1278 µs. Notice that BNZ takes two instruction cycles
if it jumps back, and takes only one when falling
through the loop. That means the above number
should be 1277 µs.
Delay calculation for PIC18
EXAMPLE; Find the size of the delay in the following program if the
crystal frequency is 4 MHz:


SOLUTION
Loop inside a loop delay
Find the time delay in the following subroutine:
SOLUTION

For the HERE loop, we have (5x 250) 1µs = 1250 µs. The AGAIN loop
repeats the HERE loop 200 times; therefore, we have 200 *1250 µs =
250000 µs, if we do not include the overhead.
MYREG EQU 0X8 EXAMPLE NOP 1
DELAY MOVLW D'200’ 1 NOP 1
MOVWF MYREG 1 NOP 1
AGAIN NOP 1 NOP 1
NOP 1 NOP 1
NOP 1 NOP 1
NOP 1 DECF MYREG, F 1
NOP 1 BNZ AGAIN 2
NOP 1 RETURN 1
SOLUTION

The time delay inside the AGAIN loop is


[200(13 + 2)] x 1 µs = 3000 µs.
NOP is a 2-byte instruction, even though it does not do
anything except to waste cycle time.
EXAMPLE

Write a program to toggle all the bits of SFR PORTB every I s. Assume
that the crystal frequency is 10 MHz.
SOLUTION

Delay 20 x 100 x 250 x 5 x 400 ns =


l ,000,000,000 ns = 1,000,000 µs= I s.
NEW CHAPTER
QUZI_1

Write a program to toggle the state of SFR of PORTC,


use 90.000 instruction cycle delay.
Use BRANCH instruction
QUIZ_2
Write a program to find the sum of the following
addresses you have to use DAW instruction
0X40 = 99H
0X41 = 88H
0X42 = 77H
0X43 = 66H
QUIZ_3
Write a program to find the sum of the following,
3B9C H
358A H
Use ADDWF & ADDWFC if needed.
SOLUTION_1
#include <p18f458.inc> LOOP3
L1 EQU 0X20 DELAY DECF L3,F
L2 EQU 0X21 MOVWF PORTC MOVLW D'9' BNZ LOOP3
L3 EQU 0X22 X CALL DELAY MOVWF L1 DECF L2,F
ORG 00H COMF PORTC,F LOOP1 MOVLW D'100' BNZ LOOP2
CLRF TRISC BRA X MOVWF L2 DECF L1,F
MOVLW 55H ;================ LOOP2 MOVLW D'100' BNZ LOOP1
MOVWF L3 RETURN
END3
SOLUTION_2
#include <p18f458.inc> MOVLW 0H SKIP2 ADDWF L3,W
ORG 00H MOVWF H_B DAW
L1 EQU 0X40 MOVLW 99H ADDWF L1,W BNC SKIP3
L2 EQU 0X41 MOVWF L1 DAW INCF H_B,F
L3 EQU 0X42 MOVLW 88H BNC SKIP1 SKIP3 ADDWF L4,W
L4 EQU 0X43 MOVWF L2 INCF H_B,F DAW
L_B EQU 0X20 MOVLW 77H SKIP1 ADDWF L2,W BNC SKIP4
H_B EQU 0X21 MOVWF L3 DAW INCF H_B,F
MOVLW 66H BNC SKIP2 SKIP4 MOVWF L_B
MOVWF L4 INCF H_B,F
END
SOLUTION_3
#include ORG 00H MOVLW 8AH
<p18f458.inc> MOVLW V1 ADDWF L_B,F
V1 EQU 3BH MOVWF H_B MOVLW 35H
V2 EQU 9CH MOVLW V2 ADDWFC H_B,F
H_B EQU 0X00 MOVWF L_B END
L_B EQU 0X01
I/0 PORT PROGRAMMING IN PIC18
NUMBER OF PORTS IN PIC18
SINGLE-BIT ADDRESSABILITY_OF PORTS FOR
PICI8F458/4580
PORTS' SFR ADDRESSES FOR PIC18F458
PIC FAMILIES
QESTIONS TO THINK

1- There are total of ports in the PIC18F458.


2- True or false. All of the PIC 18F458 ports have 8 pins.
3- List all PIC18F458 ports that have 8 pins.
PLACING CODE IN PROGRAM ROM
PLACING CODE IN PROGRAM ROM
PLACING CODE IN PROGRAM ROM


BCD (BINARY CODED DECIMAL) NUMBER
SYSTEM
BCD stands for binary coded
decimal. BCD is needed because in
everyday life we use the digits 0 to
9 for numbers, not binary or hex
numbers. Binary representation of0
to 9 is called BCD
DAW Instruction
The DAW ( decimal adjust WREG) instruction in the PIC 18
is provided to correct the aforementioned problem associated
with BCD addition.

MOVLW 0x47 ;wreg = 47h first bcd operand


ADDLW 0x25 ;hex(binary) addition (wreg = 6ch)
Daw ;adjust for bcd addition (wreg = 72h)
SUBLW VS. SUBWF Instruction
SUBLW K (WREG = K- WREG)
SUBWF Filereg , d

Second Complement
N Flag Vs. C flag
MOVLW 0X23
SUBLW 0X3F
MULLW Instruction

MULLW K ;W X K AND 16-BIT IS RESULT IS IN PRODH:PRODL

MOVLW 0X25
MULLW 0X65
OVERFLOW
When is the OV flag set?
In 8-bit signed number operations, OV is set to I if either of the
following
two conditions occurs:
I. There is a carry from D6 to D7 but no carry out of D7 (C = 0).
2. There is a carry from D7 out (C = I) but no carry from D6 to D7.
OVERFLOW
OVERFLOW
OVERFLOW
OVERFLOW
QUESTION TO THINK

Explain the difference between a carry and an


overflow.
AND VS. OR VS. EX-OR
ANDLW K
ANDWF FILEREG, D
IORLW K
IORWF FILEREG, D
XORLW K
XORWF FILEREG, D
QUESTIONS TO THINK
1- To mask certain bits of the WREG, we must AND it with _

2- To set certain bits of the WREG to 1, we must OR it with _

3- Ex-ORing an operand with itself results in


NEGF Instruction

NEGF (negate filereg) this instruction takes the


2's complement of a file register
Compare instructions
EXAMPLE

Write a program to find the greater of the two values


27 and 54, and place it in file register location 0x20.
SOLUTION
EXAMPLE
Assume that port D is an input port connected to a
temperature sensor. Write a program to read the
temperature and test it for the value 7 5. According to the
test results, place the temperature value into the registers
indicated by the following.

If t = 75 then wreg = 75
If t > 75 then greg =t
If t < 75 then lreg =t
SOLUTION
EXAMPLE

A program to monitor PORTO continuously for the


value 63H. It should stop monitoring only if PORTD =
63H.
SOLUTION
SINGLE-BIT(BIT-ORIENTED)INSTRUCTIONS FOR
PIC18
EXAMPLE

An LED is connected to each pin of port D. Write a


program to turn on each LED from pin DO to pin D7.
Call a delay module before turning on the next LED.
SOLUTION


EXAMPLE

Write the following programs:


(A) create a square wave of 50% duty cycle on bit 0 of port C.
(B) create a square wave of 66% duty cycle on bit 3 of port C.
SOLUTION _A
The 50% duty cycle means that the "on" and "off' states (or the high
and low portions of the pulse) have the same length. Therefore, we
toggle RCO with a time delay between each state.

ANOTHER SOLUTION
SOLUTION_B
A 66% duty cycle means that the "on" state is twice the "off'
state
EXAMPLE
Write a program and simulate it in Protus ISIS to perform the
following:
(a) keep monitoring the RB2 bit until it becomes HIGH;
(b) when RB2 becomes HIGH, write value 45H to port C, and
also send a high to low pulse to RD3.
SOLUTION
In this program, instruction "BTFSS PORTB,
2" stays in the loop as long as
RB2 is LOW. When RB2 becomes HIGH, it
skips the branch instruction to get out of
The loop, and writes the value 45H to port
C. It also sends a high-to-low pulse to
RD3.
EXAMPLE
Assume that bit RB3 is an input and
represents the condition of a door
alarm. If it goes LOW, it means that
the door is open. Monitor the bit
continuously. Whenever it goes LOW,
send a high-to-low pulse to port RCS
to tum on a buzzer.
SOLUTION
EXAMPLE
A switch is connected to pin RB2. Write a program to
check the status of SW and perform the following:
(a) If SW = 0, send the letter 'N' to PORTD.
(B) If SW =1,send the letter ‘Y' to PORTD.
SOLUTION

ANOTHER SOLUTION
EXAMPLE

“A switch is connected to pin RBO and an LED to pin RB7.


Write a program to get the status of SW and send it to the
LED.”
SOLUTION
ROTATE INSTRUCTION [ RIGHT ]
RRNCF filereg,d ;rotate filereg right (no carry)

In rotate right, the 8 bits of the filereg


are rotated right one bit, and bit DO
exits from the least-significant bit
and enters into D7 (most-significant
bit). After the rotation the result can
be in filereg or WREG, depending on
the d bit. See the code and diagram.
ROTATE INSTRUCTION [ RIGHT ]
ROTATE INSTRUCTION [ LEFT ]
RLNCF filereg,d ;rotate filereg left (no carry)

In rotate left, the 8 bits of the filereg


are rotated left one bit, and bit D7 exits
from the MSB (most-significant bit)
and enters into DO (least-significant
bit). After the rotation the result can be
in filereg or WREG, depending on the
d bit. See the code and diagram.
ROTATE INSTRUCTION [ LEFT ]
ROTATING RIGHT THROUGH THE CARRY
RRCF fileReg, d ;rotate fileReg right through carry
ROTATING LEFT THROUGH THE CARRY
RLCF fileReg, d ;rotate fileReg left through carry
SERIALIZING A BYTE OF DATA
Serializing data is one of the most widely used applications of
the rotate instruction. We can use the rotate instruction to
transfer a byte of data serially ( one bit at a time). The
following examples show how to transfer an entire byte of
data serially via any PIC pin
EXAMPLE

Write a program to transfer value 41 H serially ( one


bit at a time) via pin RB I. Put one high at the start and
end of the data. Send the LSB first.
SOLUTION


EXAMPLE

Write a program that finds the number of ONEs


in 0x97.
SOLUTION


SWAPF Instruction
SWAPF fileReg, d
EXAMPLE
A) Swap the contents of the MYREG register if it
contains 0x72.
(B) in the absence of a swapf instruction, how would
you exchange the nibbles?
SOLUTION
NEW CHAPTER
PROGRAM
MEMORY
MAP AND
STACK
FOR
PIC18F25
8/458
IMMEDIATE AND DIRECT ADDRESSING MODES
Write code to send 55H to port B. Include
(a) the register names.
(B) their addresses
REGISTER INDIRECT ADDRESSING MODE
In the register indirect addressing mode, a register is used as a pointer to
the data RAM location. In the PIC 18, three registers are used for this
purpose: FSR0, FSR1, and FSR2.
FSR (file select register)
One of the advantages of register indirect addressing mode is that it makes
accessing data dynamic rather than static.
REGISTER INDIRECT ADDRESSING MODE
• Special register is used as a pointer (actually three of them)
• FSRs (File Register Select) are 12 bit registers: FSR0, FSR1,
FSR2. Each is represented by two SFRs, e.g., FSR0 has FSR0L
and FSR0H.
– LFSR 1, 0x030 ; load 0x30 into FSR 1
– LFSR 0, 0x130 ; load 0x130 into FSR 0
REGISTER INDIRECT ADDRESSING MODE
The file register that the FSR is pointing to can be than reached in
INDF0, INDF1, and INDF2, respectively.
- MOVLW 55H
– LFSR 0, 0x130
– MOVWF INDF0 ; contents of W moved to fileReg 0x130
FSR0-2 REGISTERS USED FOR REGISTER INDIRECT

• Each FSR0-2 register is 12 bits thus consisting of two one


byte file registers.
• The low order 8 bits are in one byte (FSRXL) and the upper
4 bits in the low order bits (or nibble) of the second byte
(FSRXH).
EXAMPLE SOLUTION
MOVLW 55H
LFSR 0, 0x40
Write a program to MOVWF INDF0
copy the value 55H INCF FSR0L, F
into RAM memory MOVWF INDF0
INCF FSR0L, F
locations 40H to
MOVWF INDF0
45H using Register INCF FSR0L, F
indirect addressing MOVWF INDF0
mode INCF FSR0L, F
MOVWF INDF0
EXAMPLE
Assume that RAM locations 30-34H have a string of ASCII data, as
shown below. Write a program to get each character and send it to
port B one byte at a time. Show the program using: register indirect
addressing mode.

30 =(‘h’) 31=(‘e’) 32 =(‘l’) 33 =(‘l’) 34 = ('o')


SOLUTION
COUNTREG EQU 0X20
B3 MOVF INDF2,W
CNTVAL EQU 5
MOVWF PORTB
CLRF TRISB
MOVLW CNTVAL
→ INCF FSR2L

MOVWF COUNTREG DECF COUNTREG,F

LFSR 2,0X30 BNZ B3


AUTO-INCREMENT OPTION FOR FSR
EXAMPLE

Write a program to copy a block of 5 bytes of data


from RAM locations starting at 30H to RAM locations
starting at 60H
SOLUTION
MOVLW CNTVAL
MOVWF COUNTREG
LFSR O,OX30
LFSR 1,0X60
B3 MOVF POSTINC0, W
MOVWF POSTINCL
DECF COUNTREG,F
BNZ B3
EXAMPLE
Assume that RAM locations 40 43H have the
following hex data. Write a program to add them
together and place the result in locations 0x06 and
0x07.
40 = (7D) 41 = (EB) 42 =(C5) 43 = (5B)
SOLUTION


STORING DATA IN ROM
• The ROM (program memory) can be used to store constants (e.g.,
Strings) to save RAM.
• Assembler directive DB (define byte) can be used to Store bytes is
ROM:
READING TABLE ELEMENTS IN THE PIC18
(READING DATA FROM ROM)

Register indirect ROM addressing, i.e., Accessing ROM is done through SFR registers.
• A.K.A. Table processing
• TBLPTR is a 21 bit register (TBLPTRL, TBLPTRH, TBLPTRU) pointing to the data
Accessed in ROM
• TBLAT (table latch) is used to copy the data pointed by TBLPTR, once instructed.
TABLE READ OPERATION
PIC18 TABLE READ INSTRUCTIONS
EXAMPLE
In this program, assume that the word "USA" is burned into
ROM locations starting at 500H, and that the program is
burned into ROM locations starting at 0. Analyze how the
program works and state where "USA" is stored after this
program is run.
SOLUTION
ORG 00H TBLRD*
CLRF TRISB MOVFF TABLAT, PORTB
MOVLW 0X0 INCF TBLPTRL,F
MOVWF TBLPTRL TBLRD*

MOVLW 0X05 MOVFF TABLAT, PORTB

MOVWF TBLPTRH HERE GOTO HERE


ORG 500H
TBLRD*
MYDATA DB "USA"
MOVFF TABLAT,PORTB
END
INCF TBLPTRL,F
EXAMPLE

Assuming that program ROM space starting at 250H


contains "USA", write a program to send all the
characters to port B one byte at a time.
SOLUTION
RCOUNT EQU 0X20
CNTVAL EQU 0X3
LAB TBLRD*
TBLRD*+
MOVFF TABLAT,PORTB
ORG 00H
MOVLW 0X50
INCF TBLPTRL,F FOR AUTO
MOVWF TBLPTRL DECF RCOUNT,F INCREMENT
→ BNZ LAB
MOVLW 0X02
MOVWF TBLPTRH HERE GOTO HERE
MOVLW CNTVAL
MOVWF RCOUNT ORG 0X250
CLRF TRISB MYDATA DB "USA"
EXAMPLE

Assume that ROM space starting at 500H contains the


message "the promise of world peace". Write a program to
bring it into CPU one byte at a time and place the bytes in
RAM locations starting at 40H.
SOLUTION
ORG 00H BZ EXIT
MOVLW 0X00 MOVWF POSTINC2
MOVWF TBLPTRL BRA B8
MOVLW 0X05 → EXIT GOTO EXIT
MOVWF TBLPTRH ORG 0X500
LFSR 2,0X40 MYDATA DB "THE PROMISE
B8 TBLRD*+ OF WORLD PEACE",0
MOVF TABLAT,W END
EXAMPLE
Assume that the lower three bits of port C are connected to
three switches. Write a program to send the following ASCII
characters to port D based on the status of the Switches.
000 = ‘0’ 001 = ‘1’ 010 = ‘2’ 011 = ‘3’
100 = ‘4’ 101 = ‘5’ 110 = ‘6’ 111 = ‘7’
ASCI
MULLW 0X2
SOLUTION MOVFF PRODL, WREG
ADDWF PCL

ORG 00H RETLW '0'

SETF TRISC RETLW '1'

CLRF TRISD RETLW '2'

LAB MOVF PORTC, W


→ RETLW '3'

ANDLW B'00000111' RETLW '4'

CALL ASCI RETLW '5'

MOVWF PORTD RETLW '6'

BRA LAB RETLW '7'


END
EXAMPLE

Write a program to get the x value from port B and send x^2
to port C. Assume that RB3-RB0 has the x value of 0-9. Use a
look-up table instead of a multiply instruction. What is the
value of port C if we have 9 at port B?
X MULLW 0X2
MOVFF PRODL, WREG
SOLUTION
ORG 0
ADDWF PCL
RETLW D'0'
SETF TRISB RETLW D'1'
CLRF TRISC RETLW D'4'

LABEL MOVF PORTB, W RETLW D'9'

ANDLW 0X0F
→ RETLW D'16'
RETLW D'25'
CALL X
RETLW D'36'
MOVWF PORTC
RETLW D'49'
BRA LABEL
RETLW D'64'
RETLW D'81'
END
BANK SWITCHING IN PIC16F877A
Data memory organization
The data memory is partitioned into multiple banks which contain the
general purpose registers and the special function registers. Bits RP1
(status) and RP0 (status) are the bank select bits.
BANK SWITCHING IN PIC16F877A
BANK SWITCHING IN PIC18F458
• Max 4K of RAM
• only 256 bytes are addressable
• RAM is divided into a max of 16 banks
• MOVWF filereg , A
– until now we have ignored A
– if A=0 then default bank is used
– if A=1 then bank selector register is used to Determine
bank
BANK SWITCHING IN PIC18F458
MYREG EQU 0x40
MOVLB 0x2 ; use bank 2
MOVLW 0
MOVWF MYREG, 1 ;loc 0x240=0
INCF MYREG, F, 1 ; loc 0x240=1
INCF MYREG, F, 1 ; loc 0x240=2
• what would happen if we omitted the 1 at the end of The
instructions?
EXAMPLE

Write a program to copy the value 55H into RAM


memory locations 340H to 345H using direct
addressing mode.
SOLUTION
NEW CHAPTER

You might also like