Vous êtes sur la page 1sur 39
GET THE FIRST DATA DATA IL ACCUMALATOR ADD / SUB ( MULTIPLY / DIVIDE / AND /OR/ SQT THE DATA WITH THE ACCUMULATOR STORE RESULT: id Thus Program for ithematic and logical operations performed by using 8086 trainer kit. MEMORY ADDRESS = OPCODE LABEL | MENEMONIC ‘COMMENT ADDITION PROGRAM 1000 | C7 C001 0 MOV Ax,0001 Move first data to AX 73 02.00 MOV Bx,0002 | Move second data to BX o1p8 ADDAXEX | Add AX and ax 89 060011 MOV [1100],AX | Move result to 1100 Fa HUT Halt the program MEMORY ADDRESS | DATA 100 03 nor 00 ‘SUBTRACTION PROGRAM 1000 | C7 eo o4 00 OW AX,0008 | Move First data to AX 7000 MOV 8X,0001 | Move second data to BX 2308 SUB AX.EX | subtract AXand BX 3306 0011 MOV [1100),AX | Move result to 1100 Fa HLT Halt the program ouPUT Ry MEMORY ADDRESS | DATA & 00 oa \ = 2 mutt a PROGRAM 000 | C7 c0 05.00 MOV AK: first data to AX 730400 MOV 8x.000%, * Move second data to BX FTE yt pay, | multiply AXand BX 89 060011 VAX | Move result to 1100 Fa Halt the program ‘ouTeuT MEMORY ADDRESS | DATA 100 om no 00 DIVISION 1000 | C7 60.06 G0 MOV AK,0O06 | Move frst data to AK c7@303 00 MOV'BX,0003 | Move second data to BX FTF DIVAKEX | dvide AK and BX 85060011 ‘MOV [2100),AK | Move result to 1100 Fa HLT Halt the program OUTPUT MEMORY ADDRESS | DATA woo a 7 oe ‘AND: 1000 | C7 C001 00 MOV AX,0001 | Mowe first data to AX Ee 2188 AND AX,BX And AX and BX 89060011 MOV [1100],AX | Move result to 1100. Fa ‘HLT Halt the program ourPur MEMORY ADDRESS DATA ia 30 Sy ior 7 on ncaa sea [aren wo | ROA an gam eo aS 33 wore 89 06.00 11 ‘OW [1100),AX result to 1100 Fa HLT it the program aura : anime) une yy = = < 3 mor PROGRAM ima ae mT ra ie eA F700 (NOT AX complement the data 89060023 MOV (1100],AX | Move result to 1100 Fa ‘HLT Halt the program ourPur MEMORY ADDRESS DATA 00 # ior oo EX.NO:2, MOVE A DATA BLOCK WITHOUT OVERLAP-8086 To write an ALP to move adata block without overlap using 8086 microprocessor. APPARATUS REQUIRED: 8086 microprocessor trainer kit — 1 n0s Power chord — I nos Keyboard — Inos ALGORITHI String operations: RY) Initialize the index registers SI and DI & Initialize the counter . Clear the direction flag Move the string byte from SI to DI \ paws Repeat the loop until count equal to zero FLOW CHART: \ clear the direction flag RESULT: Thus Program to move a data block without overlap performed by using 8086 trainer kit. MEMORY ADDRESS | OPCODE LABEL MENEMONIC COMMENT [BLOCK DATA TRANSFER 1000 cece 011 MOWSi,1100 | initialise SIwith input address C77 0012 MOV DI,1200 | Initialise Di with output address 7105.00 MOV CX,0005 | move count to OX Fe aD clear direction flag A u MOvSB move string byte E201 LOOP LI repeat to loop L1 until count is equal to zero Fa HUT halt the pi ouTPUT MEMORY ADDRESS | DATA | MEMORY. DATA x 1100 AA 1200 mal \ 1101 88 1201 BB Q 3102 cc 3202 a 1103 DD 1203 D1 1104 EE 1204 ~ & EX.NO:3 (CODE CONVERSIONS AND MATRIX OPERATION -8086 AIM: To write an ALP for code conversion and matrix operation using 8086 microprocessor. APPARATUS REQUIRED: Ascii To Hexa: 1. Get the data in accumulator \ 2, Subtract 30 from the data Y 3. Compare the data 4. Jump on carry to stop the program & S. if not jump on zero-to stop the pra; 6, Subtract 07 from accumulator 7. Store the result a Matrix addition: 1. Initialize the index regt ‘and DI 2. Initialize the counter 3. Move SI to accumulator 4. Mave DI to hase: 5. Add AL and BL 6. Mave Al to DI 7. Increment DI and SI 8. Decrement CL 9 Jump on non zero to previous step labeled LI 10. If not stop the program FLOW CHART: intisise S01 CX regsters T —_——s mov $->AL end DBL i y 0d AL and BL and slo tesud cement ess regiser ene dec ere counlerregsier RESUL' ‘Thus Program for code conversion and matrix addition are performed by using 8086 trainer kit. S.. MEMORY ADDRESS | OPCODE LABEL | MENEMONIC ‘ASCILTO HEXA CODE CONVERSI PROGRAM 1000 cecoes MOV ALES t 068 30 SUB AL,30 ‘Anto convert into hexa 80F8 10 ‘CMP AL,10 "10 and Al content 7208 IBLE redult is below Althen jump to I 74.06 wu Dor ‘then check.if result=0 then jump to LL 30E8 07 SUB “<®|_ifnot.then subtract 07 from al 88060011 M PAL | move resulting hexa data to 1100 Fa u halt the program ouTPUT MEMORY ADDRESS | DATA CQ 1100 MEMORY ADDRESS | OPCODE | LABEL | MENEMONIC COMMENT MATRIX ADDITION PROGRAM 1000 ceci09 MOV G09 _ | initialise cx with count 766 0011 MOVSI1200 | initialise SI with first matrix input 7.7 0012 [MOV 1.1200 | initialise D1 with second matrix input aoa LI MOVALIS!] | move SitaAl 8A1D /MOVBL[DI] | move Dito BL 0058 "ADD ALBL | add ALand BL 8805 MOV /(DIJ,AL | move results to Di ts Te roa # mes_/ nema) aa ae — ao = Se Fa HLT Tait the progeare a FoR MEMORY ADDRESS DATA MEMORY ADDRESS | DATA DATA ne ar ae 3 nin per Peat Neon fs oe NN ns 1103 1203 O32 1104 1204 O32 hes ae oe [03 hor cores om [v3 & EX.NO:4 STRING MANIPULATION, SOI Qo scancianc 8086 AIM: Y To write an ALP to manipulate a string and 9 ate engi using 8086 microprocessor. . APPARATUS REQUIRED: & 8086 microprocessor trainer Power chord — I nos Keyboard — Inos Q ALGORITHM: String compare: 1. Initialize index and counter registers 2. Clear direction flag 3. Repeat string comparison 4, Load flag content to accumulator 5. Store the results Search adata: LARGEST NUMBER 1. Intiize the Count value. 2. Get the First data, 3.Compare with the next data. 4, Decrement the count till count becomes zero, 5. Store the largest of the Data. Sort the data: ASCENDING ORDER Load the array count in two registers C1 and C2. Get the first two numbers. Compare the numbers and exchange if necessary so that the two numbers are in ascending order. Decrement C2. Get the third number from the array and repeat the process until C2 is.0. Decrement C1 and repeat the process until C1 is 0. Pubee R e Q w FLOW CHART: & —_|ovarneemmnnne |, wort | —_, mC HE (OOM | ——— PAL ENG ( String manipulation search a data sort the data, RESULT: Thus the program to manipulate a string and to sort & search a data performed by using 8086 trainer kit MEMORY ADDRESS | OPCODE LABEL MENEMONIC COMMENT string manipulation PROGRAM 1000 700i MOVSI1100 | initialise Si with first input data c7c7 oo a2 MOV 01,1200 | initialise DIwith second input data 7.1 04 00 MOV Cx,0004 | move count to OX Fc <0 ‘dear direction flag FAAS REPECMPSB | repeat comparing string byte 5F ABE load fiag content to accumulator 8 2600 13 MOV [2300],AH | store results Fa HET halt the program ‘OUTPUT MEMORY ADDRESS | DATA | MEMORY ADDRESS | DATA | MEMORY. DATA see | wm my s 1101 cy 1201, 8B & 1102 « 1202 cc 2103 po 1203 D1 1108 fe 1208 EE ® Comins carry out of MSB of result enna Indicates if result has even parity AE: Contains earry out of bit 3 in AL Indicates if result equals zero SF: Indicates if result is negative OF: Indicates that an overflow eccured in rest IF: EnablevDisubles interrupts DF: Controls pointer updates during string operations TF: Provides single-step capability for debugging we [ololo) ae (1 fo a) MEMORY ADDRESS | OPCODE LABEL MENEMONIC ‘COMMENT ‘SEARCH FOR A LARGEST NUMBER PROGRAM 1000 cecio3 MOVCLO3 | move count to CL ceco00 MOVAL0O | move zero to AL c7ce00 11 ‘MOV'SI,1100 | initialise SI wjth input data ago ‘MOV 1,120 data SAIC a mov BL [SI] 38 D8 CMP AL.BL fand BL. 7302 INC 2 no carry ta L2 8808 MOV AL. 6 a INCSI FECS DEC 75 F3 i jump on non zero tol 8805 (OVDI|,AL | move results to 0i=1200 Fa Tait the program MEMORY ADDRESS | DATA DATA 1100 a1 00 os 2101 os 1102 MEMORY opcopE LABEL (MENEMONIC ‘COMMENT SORTIN ASCENDING ORDER PROGRAM 1000 C7 0600 MOV S11100 | initialise SI wit data a1 BA 0C MOV CL[SI] | move firsfinput FSi to CL as itis the count value FECa DEC CL L 7600 MOV SI,1100 | inidliseS with 1100 a a BAIC Mov CH jata of Sito CH FECD DECC screment CH 46 INC SI increment Si ry a Mi move Sito AL 46 inc increment SI 3A 08 P AL(Sl] | compare Al and St mos 1B jump on carry to 13 8604 XCHG AL,(SI] | xchange AL content with SI content fer swapping ata 6 4a FF YY XCHG ALS. | xchange AL content with SI-1 content for FM swapping data FECD B DEC CH decrement CH 75F0 INZL2 jump on non zeroto 2 reco DEC decrement CL 7563 INZLI jump on non zero to LI to repeat the loop Fa HLT halt the program ‘OUTPUT MEMORY maa memory wea 1100 oa 1200 oa 1101, 05 1201 00 1102 o7 1202 02 1103 06 1203 0s 1108 oo 1208 06 PROGRAMS EX.NO:5° BASIC ARITHEMATIC AND eerie AIM: g To write an ALP for basic arithmetic and logical Ae using 8051 microcontroller. APPARATUS REQUIRED: 8051 microcontroller trainer kit — YY ” Power chord — I nos Keyboard — Inos ee ALGORITHM: Addition: 1. Get the first data in A regi 2. Initialize DPTR 3. Add the second data with A register 4, Store the result in DPTR Subtraction: 1. Get the first data in A register 2. Initialize DPTR 3. Sub the second data with A register 4. Store the result in DPTR Multiplication: 1. Get the first data in A register 2. Get the second data in B register 2. Initialize DPTR 3. multiply B with A register 4, Store the result in DPTR 1. Get the first data in A register 2. Get the second data in B register 2. Initialize DPTR. 3. divide B by A register 4, Store the result in DPTR = e 1. Get the first data in A register 2. Initialize DPTR 3. And the second data with A register 4, Store the result in DPTR Q Or: 1. Get the first data in A register > 2. Initialize DPTR 3. Or the second data with A register Y 4, Store the result in DPTR SS FLOWCHART: ee (osrart > GET THE FIRST DATA DATA IN ACCUMALATOR ADD SUB / MULTIPLY / DIVIDE / AND /OR ‘THE DATA WITH THE ACCUMULATOR STORE THE RESULT RESULT: Thus the output for basic arithmetic and logical operations using 8051 microcontroller was executed successfully. MEMORY ADDRESS | OPCODE LABEL | MENEMONIC COMMENT ADDITION PROGRAM 4100 [ 90.42 00 MOV DPTR,#4200 | initialise data pointer 7406 MOV A,HOS move first data to.A 24 02 ‘ADD A,#02 ‘add second to the first data Fo MOVK@DPTR,A | move results to datapointer BOFE | HERE | SIMP HERE short jump to HERE for halt the program ‘OUTPUT MEMORY ADDRESS | DATA 4200 os ‘SUBTRACTION PROGRAM 4100 | 804200 MOV DPTR, #4200 | initialise data pointer 7406 MOV AOE ‘Tove first data toa ‘9802 ‘SUB AHO? subtract second to the first data FO MOVK @DPTR,A | move results to data ngihter BOFE | HERE | SIMP HERE short jump to HER program ouTPuT MEMORY ADDRESS | DATA = ——| 2 muti ee PROGRAM 4100 [ 904200 MOV DPR, inlgialise data pointer 7406 MOV A,HOG "move first datato A 75 FOO2 MOV, * | move second data to 8 aa My ‘multiply second to the first data Fo ‘move resuits to data pointer ‘Bore | Hi ERE shart jump to HERE for halt the program a ~ MEMORY ADDRESS | DAY 4200 oc DIVISION PROGRAM 4100 [ 90.42.00 MOV DPTR,#4200 | initialise data pointer 7406 MOV AOE ‘Tove first data toA 75 FOO2 MOV 8,402 ‘move second data to B ea DIV AB divide second to the first data Fo MOVX@DPTR,A | move results to data pointer BOFE | HERE | SMP HERE short jump to HERE for halt the program MEMORY ADDRESS DATA am 5 ‘AND acai 4100) 904200 MOV DPTR,#4200 | initialise data pointer 7406 MOV A,#06- move first data to A. 5a02 ANLA,#02 ‘and logic second ta the first data FO ‘MOVX @DPTR,A ‘move results to data pointer BOFE | HERE | SIMP HERE ‘shart jump to HERE for halt the program aH MEMORY ADORESS | DATA R a a oR = A 4100 | 504200 MOV DPTR,#4200 | injtialgdata hointer a SE 4402, “ORL A.#O2 second to the first data o sees ‘80 FE HERE | SIMP HERE ‘shart jump to HERE for halt the program ou a MEMORY ADDRESS DATA wie EX.NO:6 SQUARE, CUBE AND 2°S COMPLEMENT OF A NUMBER-8051 AIM: To write an ALP for square, cube and 2s complement operations using 8051 microcontroller. APPARATUS REQUIRED: 8051 microcontroller trainer kit — 1 nos Power chord — 1 nos Keyboard — Inos RY) ALGORITHM: © ee ve 1. Initialize DPTR Q 2. Got the first data in A register and Copy A in B 3. Multiply the B data with A register 4, Store the result in DPTR 5. Again multiply B with A Y 6. Increment DPTR . 7. Store the result in DPTR Ones and twos complement: & 1. Initialize DPTR Q 2. Get the first data in A regi: 3. Complement A 4, Store the result in 5. Increment A 6, Increment DPTR 7, Store the result in DPTR FLOW CHART: u Initialize DPTR TE Get the first data in A register Get the first data in Aregisier ay Copy Ain B Complement A TE Multiply the B data with A register ‘Stow the esult ia DPT ae E82 Store the result in DPTR Increment A ae Again muhiply Bwith A Increment DPTR ae Increment DPTR re Store the result in DPTR. Store the result in DPTR I SQUARE AND CUBE ce 1°S AND 2°S COMPLEMENT. RESUL' Thus the output for square, cube and 2"s complement operations using 8051 microcontroller was executed successfully. MENEMONIC comment square and cube PROGRAM 4100 | 9042.00 MOV DPTR,#4200 7402 MOV A#02 FS FO MOV AB At MULAB 70 MOVX @DPTRA at MULAB a INC DPTR FO MOVk @Di result of cube to data pointer 80 FE | HERE | SIMP HERE jump HERE ouTPuT ey MEMORY ADDRESS | DATA S 200 on a0 os | {V's and 2's complement PROGRAM #100 | 9046 MOV DPTR,#4200/ initialize data painter 7406 MOV A806 move data to A Fa CPLA complement A FO MOVX GDPTRA |store the 1's complemented result to data pointer ot INCA increment Ato get 2's complement a INC DPTR increment data pointer FO MOVK @DPTRA | move resultstoA 80 FE | HERE | SIMP HERE short jump to HERE OUTPUT MEMORY ADDRESS | DATA 3 a8 FA EX.NO:7 BCD TO ASCII ~—S AIM: To write an ALP for BCD to ASCII code conversion, \y 8051 microcontroller. APPARATUS REQUIRED: 8051 microcontroller trainer kit — 1 nos Power chord — 1 nos Keyboard — Ines oP ALGORITHM: ee ‘Square and cube: 1. Initialize DPTR 2. Get the data in A regis 3. Add 30 with A register 4. Store the result in DPTR FLOW CHART: Q\" Thus the output for BCD te ASCII code ont using 8051 microcontroller was executed RESULT: successfully. a MEMORY ADDRESS OPCODE LABEL nc COMMENT ASCII CODE CONVERSION PROGRAM 4100 | 90.42, MOV DPTR#4200 | initialise data pointer EZ MOV A#O2 move data to A 2430 ADD A,#30 ‘add 20 te data for converting it into ASCI FO MOV @DFTRA | move results to data painter SOFE HERE | SIMP HERE short jump HERE ‘OUTPUT MEMORY ADDRESS | DATA INTERFACING PROGRAMS RY) e Q \ Y we & exnos <3” mamcusir cosmos To Write an ALP to Interface Traffic Light Controller using 8086. APPARATUS REQUIRED: 8086 microprocessor trainer kit — 1 n0s Power chord — 1 nos Keyboard —Inos Traffic light controller kit ~ 1 nos Bus interface eard — 1 nos ALGORITHM: Traffic light controller: 1. Start the Program 2. Call forward program 3. Call E to W program 4. Call N to'S program 5, Repeat the steps FLOW CHART: RESULT: Thus the output for Ti Controller operation using 8086 microcontroller was executed successfully. MEMORY ADDRESS | OPCODE | LABEL | MENEMONIC ‘COMMENT TRAFFICLIGHT CONTROLLER PROGRAM cw 26 PORTA | 20 PORTS | 22 PORTC | 2d LooK uP | 1073 10: LABEL 7F ‘1000 | ce co 80. MOV ALO ‘move control word to al £626 (OUT 26,AL ‘send al value to port 26 C7@3 73.10 | REPEAT | MOVBX,LOOK UP | move look up value to bx C7C5 7F 10 MOVSLLABEL | move label value to si £83300 CALL OUT perform call operations Ed MOV ALISI] move the content of sito al reg £620 OUT 20,AL send al value to port 20 84000 CALL DELAY perform call operations with delay label a6 INCS! increment si a INC BX increment bx £82700 CALLOUT, Ed MOV AL ISI) F622 OUT22,AL CALL DELAYI INCSI INC BX £81800 cauLour' perform call operations sA0a AL ‘move the content of sireg to al an Bagtap” onthe dant part ¥ £83500 DELAYE perform call operations with label delay a6 CSI increment si SO ee Ey cALLOUT perform call operations saca Mov AL SI) ‘move the content of sireg to al £624 OUT 24,AL send al value to port 24 a INC SI increment st SAGA MOV ALISI Tove the content of sito al £620 OUT20,AL send the al value to port 20 £82400 CALL DELAYI ‘perform call operations with label delay £9 C2 FF IMP REPEAT 0 to label repeat sag7 ouT | MOV AL {ex} ‘move the content of bx reg to al 624 (OUT 24,AL ‘send the al value to port 24 a3 INC BX increment bx reg Eu MOV ALIBX] ‘Tove the content of Bx regto al E622 OUT 22,AL send the al value to port 22 43 INC BX increment bx reg aA07 MOV ALIEx] ‘move the content of bx reg to al £6 20 ‘OUT 20,AL ‘send the al value to port 20 £8 01 00 CALL DELAY ‘perform call operations with label delay e] RET return the program 77 4000 DELAY | MOV DI,0040, move the value 0040 todi reg C7 C2 FF FF MOV DX,OFFF move the value Off to dx reg 4A A DEC DX decrement the dx reg a — [ki — [nal —[ rt ne 5 eS Ter BATT WTI — mm ae C7C2FFFF | B MOV DX.OFFFF move’ Off to dx reg co B1 DEC DX dureg oa not —— ¢gerssen ae DEC DL vent di label 7575 NEBL emer z rN sur rT Gr mRON TNT MEMORY ADDRESS: DATA a wn ao 5 = : zi S ri Fi - : vas ime a a S 43 04 Reerese Loca Conmmotsen, Pa pe a az _ fa | feo | oe VA] l [23 peswive Leet Cl’ Te grow) [ Aemermve wer Coe 70 quow) 50 PIN BUS INTERFACE CART. EX.NO:9 STEPPER MOTOR CONTROL - 8086 To Write an ALP to Interface stepper motor Controller using 8086. APPARATUS REQUIRED: 8086 microprocessor trainer kit — 1 nos Power chord — 1 nos Keyboard — Inos ‘Stepper motor controller interface kit — I nos ( ) Bus interface eard — 1 nos Drive cable— I nos \ ‘Stepper motor—1 nos ALGORITHM: . Stepper motor control: 2. Load index data to accumulator 1. Initialize D1 and counter register y 5, Repeat the steps FLOW CHART: CQ 3. Load to driver port v > 4. Call delay program, ay Initialize Di and counter resister Load to driver port \ RESULT: Thus the output for stepper motor Controller operat KR 0 ‘microcontroller was executed successfully. MEMORY ADDRESS | OPCODE LABEL cOMMENT . Pi CONTROL PROGRAM 1000 ago} MOV DI,1100 | move the value 1100 to di reg ECL 08 MOVCLO4 | move the value 04 to cl reg A085 MOVAL,[OI) | move the content of di reg to al Ex) OUT COAL | send the al value to port cO a MOVDX1010 | move the value to dx reg aA B DEC DK decrement direg 75°D INZL3 jump on nan zero to label a INCI increment di reg BF LOOP 2 loop label ES ES FF IMP LL jump to label 2 (OUTPUT - CHECK STEPPER MOTOR ROTATION MEMORY ADDRESS | DATA MEMORY ADDRESS «= DATA (CLOCK WISE ‘ANTI CLOCK WISE 1100 09 1100 0A 201 os EECry 06 ” Permanent Magnet Stepper Motor Stator Permanent Magnet Poles = Jo} ef lo ||P] ea [=x] = ol} ps a eu none 8 a ¥ STEP ANGLE ‘90 DEGREE STEP SIZE 4 STEPS. 03,05,06,0A STEP DIRECTION OF ROTATION | CLOCK WISE AND ANTI CLOCK WISE ‘STEP SPEED AND DELAY Dx=1010 STEPPER MOTOR INTERFACE TO 8086 50 PIN BUS DRIVER INTERFACE CABLE STEPPER CAR MOTOR DRIVER EX.NO:10 DIGITAL CLOCK - 8086 To Write an ALP to Interface digital clock using 8086. RY) APPARATUS REQUIRED: & 8086 microprocessor trainer x Power chord — 1 nos \ Keyboard — Inos Digital clock kit — 1 nos Bus interface card — 1 nos ALGORITHM: ye Digital clock: * 1. Load the data Hrs, Mins and Secs in nage in Registers 2. Initialize Hr, Min and Sec. 3. INC Seconds until $9. 4. If it is greater than 59 then the 's incremented by | and the Seconds are initialized to Zero. 5. If minute is greater than S9,thel Our starts incremented by 1 and the Minutes , Seconds are initialized to Zero. 5. When the hour is g1 . then the Seconds and Minutes are initialized to Zero. And then the Hour is initialized to-One. 6, Again the clock starts

Vous aimerez peut-être aussi