M AM

You might also like

Download as pdf
Download as pdf
You are on page 1of 26
eg Experiment — 1 Date: 9 Aleta | Aim: To study s9¢51 Microcontroller Deve lopment Board, Inderstanding the teamnin, 18 Kil OF 8051 Microconteotier Develo # 8051 Microcontroller learning kit PMicnt Board, Pre Test: (MCQ ba sc/objective base) 1 Intet sos follows which architecture? i @. rchilecdur —> Thiel gost Bes Seal Are 2. 8051 Was developed using which technology? diddddddd d ing N- mos Technology. — Sos} ewas Alevelep col. us d ~ whe bu Sy 3. What is the width of the data bus? wolin ot g bias A Sy Fos | fC 15 Consis: d _* lane, &- bit 9 , ist the features ofthe 8051 microcontrollers? q am, -L-wegister \, Rom), 128 utes Cram’ clress bus, I > uKBC vs di ional cleda busy te bus ov = aap ) Conventers, ay 16-bit mers, AID I DIN Converters. a 1 J ad What is stack pointer in 8051 Microcontroller? } locectian lust useel 4 ints do the he 5 teuck, > stacte bee ey eater L ae tons Panter is pee e < ty ler? * Gest her Siena Sigal TRO, INTA, TNT, Tra, eit /TL. IC ret Jump if Carry is set INC rel Jump if Carry not set Post Test (MCQ base/objective base): ; ie : ; inteeee, 1 SR cramer lex2 Giphamameric Led inderte ; oubfic liga WAL mectyi a intetace, QS 232 VART, Lee, 12130 ‘er! moder Buzzer, digit Seven, Se: ot ‘splety , On hoewral Power Supply , A posgecemmir Table. 2. What is difference between LCALL and LIUMP instructions? ine, — The CALL Instruetian iguged to co a Subsout but the Jump rather tyeleten the eum Counter Value Grol point to cinatha locedtay inside Pre gacim. - as 2 Barn FSW reise with examples an B-bit veaister, abso nore iste. Contain that Stodus i . PSW Hoy -wogiten, Pty meme ene ecu [er [x]ye| Jot = [I ey OSWT- Soe / Fe eae iealaks aula for gener ro ~ povlu =) Register Bank Selector bred oe paws - Register Bark, Selector, bik.o, R50 - deigig hay eaflbuo Play oN Zz Psi. A User-dedinable: Hoa P=: Psw.o. Past Bigs mov Ay 7 i an 4 oaths , aa A Sinte thadis 4 carry b paar be Ac 7 D Since there is a cory faom % Jou" Bit, P= 0 Since even no. Of A's. ¥ ¥ ey al E av MiG ay TAW pepapD, PIO ae up 4 Teysree. | te prep Nd | “Py asap pepwEpSERST 24 Wise 9a Jo wots? |__sa'vasosluaiwans| | POP Sap Pest ee ee ti Fa@_'v day |N1. Gow Ene aad erent oR. HOE DEP Yahpeppo aay — ETS ‘9}durexa ouo asa] 32 a ua ‘Prous Wy HE U24U25 opynvENr>y BOL S sey Teupys POU 7 [Wo Lea b St YLS «4. suv day |) Wat aay [onerex™ | suo KMAESEE “PPA G1S08 40} Suononysu onauNe ou ane YORE “p Kowmado PIG-91 pry oh Pam g) DGay «+ “ypu da oon PP a joa si Gqy YoHOMEs UL BU. 4 (SoquipH! ond ppv or pasn s1 uonanusti YorA | wa (seq oanaafqoyaseq OOH) 11804, 20g SBE USeLa ‘p torsigr! TEX *P8Q aavayyos ‘SeHM Bunpauu0s ‘fjddng smog Sry +2]}oMMODOLOIyy :pasy aawALpAE “Od UE meaford op ping - 01 orden sel Pu sumsfoxd Su zy soy09 “HET sn o Moy uno, yn sopmG ss0an9afGQ “aALYOS "EY Bursn suonesado * OMaUNPLP [[P 114 § 19} J9I}ONUODOIOI 15968 204 (ay) wesdord aBensuel-fjquiosse we au roy [zj2V\\G roa } Z—wouadxg 4 j Y D JJ) )) SICETEEIIINGIIII f COOOL tee. ee MOV A, #121 Mov B, #41H ADD A,B MOV 41H, 4 END ORG 00008 MOV A, #4 MOV B, #441 SUBB A,B MOV 42H, A END ORG o000H MOV A, #A0H MOV B, #o4H MUL AB MOV 43H, A MOV AB MOV 44H, A END ORG 00001 MOV.A, #15H MOV B, #06H DIV AB MOV 45) MOVAB MOV 46H, A END Observation Table: _ ‘Operation Input/Output Location ae Input A -AVERH Addition B HE a. Output a Aeesy Input A HOB TT Subtraction B 4 UAH Output A + 40H Input A at ROH : B Hou | Output BH aa 44 HC H Input A SE ISH Division a f aLocH Output me 46H StusH | Output: 1) Add 20H & AOH > 4¢C@OH 2) Subiract 15H from BCH ”\4tscd 3) Multiply 12H with AAH : a REA 4) Divide CFH by 11H » | ay OBA Post Test (MCQ hase/objective base): 1. What content stored in an Accumulator after following program executed? MOV A, #3CH MOV R4, #66H ANL A,R4_ —> A }2uH oe hy t ble Conclusion: Af 4er performing -Hhis experianents we ate al : i pou ie sing de do att Gsiftmedic ¢ x Bi Seteware ; Faculty Sign: AWW fn, Experiment —3 ' pate: 4l4l22 Aim: Wri te of 89¢5], 17 assembly language program (ALP) to transfer data between specified memory locations Gbietirex Students will learn basic Embedded Programing, ‘ardware Used: Microcontroller Kit, Power Supply, Connecting Wires. Software Used: KEI Vision 4, Flash Magic, Pre Test: (MCQ base/objective base) 1. What is the difte ve structions? acle (DY y difference between MOVC and MOVX instruct tions’ c — > MOVE instoucton moves a bute from 4 Ge fe memory +o the accurubedor , orhi le the mor s ; (ms rechey % befaveen acoumulssor camel > ctor sneer, , > ( > , ) , 2. Explain following instructions with examples, a) XCHD A, Ro — > Here the value inside go 15 Consiclercol ay on address, Which holds the dele jo be tecensfersec| +o Aocurmmuledor —> Th Ro holds the Value JoH, and we heave adata 2EH Storesl é as LoHs then the value 2F will Gerctrinytiual do dentouloles offer Gxecuking instruction. { Be this b) MOV A, @RO . i inside RO is Conaideneel o8 an > h the vole oatltess, ashich holds the dala to be Jranitenedl. 40 if ¥ . —» Th Ro Twvalue JOH, anc ewe have a clades AEH esis teres ot the addlterss ado, then the value DEH cool Apcensterred to acorrmutetor, ater Erocubira Linie instruchon, Program: BACK: Post Test (MCQ baselobjcctive base): ORG oo00H MOV RO, #40H MOV RI, #50H MOV R7, #0AH, MOV A,@RO MOV @RI1, A INCRO INCRI DINZ R7, BACK END A v the address range for intemal program memory is 0008, OFFFH ) 00H, FFFFH ¢) 1000H, OFFFH 'FFFH 2. What is the total memory capacity of Microcontr a) 128 kB ©) 256 kB d) None of the answer Conclusion: i Qechon of sql. through this experiments Wecere ‘oble fen we ate potibesn specified Mereory Experiment — 4 1 Date: | 514) 22 -mbly language program (ALP) to for toggling the LED connected to Port-2.0 of 8051 ing timer-O and mode-, Objectives: Students wil | Bi Aim: Write an asse1 with 1 sec delay usi ‘eam how to interface LED with Microcontroller. ‘ardware Used: Microcontroller Kit, Power Supply, Connecting Wires. Software Used: KEIL Vision 4, Flash Magic. Pre Test: (MCQ base/objective base) J: Explain Timér/Counte register with one exampl WS) hos Oo Cony eal JHeners eshich cam be us Ghher a3 Amer to fenerafe a time delay or os Counter te Count events oppening ouside the onicrocentwollez. Yes To condaure the sTtheno as le-bit event couriter. and Tell, B-bit auyjo welead Counter, we A poctiern 00400104, ris EArialet to oot, it coe cant +o Poarcn the- i i a 6 TM 00 “vegister: asith this bit god Movtmod, apest | ~ Te qhove fnsteuction is cheacted, then the dimer {counter will be Contsolled ba the Softwiare. then = ‘ s ware Contgolteal wocle, he ea 2 as & geste esitl be Aoro11oa =ADK SeeSeeeeeoee jalled as the Driver). Simply, to Mictoconsetie ‘Port and the MC h, Bhis program is called as the 7 . Microcontroller portpin oe OO @ Observe carefully the interface LED 2 is in forward biased because the input voltage of Sv connected to the positive terminal of the LED, So here the Microcontroller Pin should be at LOW level and vice carn with the interface 1 connections, The sev ior is important in LED interfacing to limit the flowing Sirent and avoid damaging the LED> and/or MCU, + Interface 1 will glow LED, only if the ground, « Interface 2 will glow LED, only if the PIN value of the MC is Low as current flows towards PIN due to its lower potential, Calculations: { - \ Program: ORG 0000H Back: MOV p2, 0, 80H 4 LED-ON ACALL. Delay 4 Delay of | Sec MOV P20, 00H “LED OFF ACALL Delay 3 lay of 1 sec, SIMP Back Subroutine: Delay: MOV TMOD#01H 1 Select Timer-t & Mode-2 MOV TLO,#00H 4TLO& THO = 10msi(1, 085*10% ) 2400H MOV THO, #240, SET TCON.4 1 Timmer Start Loop: JNB TCON.S, Loop CLR TCON.$ 1 Clear Timer CLR TCO. 1/ Clear Flag bit RET END © eM Post Test (MCQ base/objective base): J. What is sourcing and sinking currents in LED? iqitel = — Seusce cussents wefers Jo the obi tity cof the. chigi ddd di ty Gtovent. ye ~~ Cee ee se oak we the ability of the pot seceive rooent. are able Conclusion: er perfooming this Experiments we to i g kits amd then + o We the LED "using mono meses with Aas matic Sotfeware Faculty “Ae (3) se ee eee liege? i _ ' Experiment- 5 \ Date: o4)02) 22 Aim: Write an assembl: Y ly language pro, continuously. Assumin, ’gram (ALP) for 8051 to transfer serially letter N at 9600 baud, 8 crystal frequency 11,0592 MHz Objectives: @ Understanding of bps and baud rate (ii) Transfer of particular with necessary baud arte Pre Test: (MCQ base/objective base) Dy ee Ra frequency 11.0592 MHz, find the TH value needed to have the following baud rates: b) 2400 ©) 1200 THa = 256 - Kx ose Freq. pO Seal: 384% Baud rete AsADTARMNE | noe ae Bay x | 200 23¥ = (es4] Theory: 8051 microcontroller has a built-in serial port called UART. We can easily read and write values to the serial port. For using serial port we simply need to configure the serial port: ° Operation mode (how many data bits we want) © Baud rate There are 21 Special function registers (SFR) in 8051 microcontroller and 21 uni these 21 SFR. Each of these re; que locations are for Bister is of 1 byte size. The “Serial Control” is used to configure serial port. (SCON) is the SFR which SMO | SMI | Serial Mode | Explanation Baud Rate o fo 0 0 B-bit Shift Register Oscillator / 12 o 1 T 8-bit UART Set by Timer | (*) | tan) 2 9-bit UART Oscillator / 32 (*) | ED 3 9-bit UART Set by Timer 1 (*) | | BAUD RATE TH) (decimal) TH) (hes) | 9600 3 FD 4800 6 FA 2400 “2 Fa 1200 24 ES Program: . | MOV TMOD, #20H d/timer 1, mode 2 (auto reload) | MOV THI, 4FDH 1.9600 baud rate at 11.0592 MHz. } MOV SCON, #50H, // 8-bit, 1 stop, REN enabled SETB TRI J start timer 1 REPEAT: MOV SBUF, #"N" d letter "N" to be transferred NEXT: JNB TI, NEXT J) wait for the last bit CLR TI Ji clear TI for next char SJMP REPEAT Ji keep sending N Result: [o_Ie [se | N letter” Sedeiiy | Post Test (MCQ base/objective base): 1. What is SCON? —> SCoN is an F-bit Degqister clealicateal fox controls dada — Commun eerior, T5ya0 5m Smal aes git ito PUPILS Lee eee ree errr rely eyy, 2. What is SBUF? : — SBF jo an shit register clecliactes! for Seriol commu nicehon 171 Bosi, wes adelsess 15 Gah. 4 1Bito “Conclusion: AFHe~ perfosmivig this eapesi ment We ose. able 40 umolerstand & SBUF and S con vegister ermel modes of operctioy, Faculty Sign: Experiment No. 6 ' a Date: \S\oz\2u dim Write an assembly language program for 89C51 to displaying the decimal numbers in 7 Segment splay. Objectives: To learn Interfacing fundamentals and handshake process. Pre Test: (MCQ base/objective base) 1 Dipway ex af fhe pin diagram of 7 segment LED? conto —r Seren sesanent displays ae of ewe dypes moramnen GA and Common anede- vy mm Common — Certhocle> i ( , Aegether a single termi Jobeles! as ‘com! > Anode of ail Leos Boe left clone as Ar bieds es Fige —> The Pin out s LED display 36 shown above. Theory: 7 segment LED display is very popular and it can display digits from 0 to 9 and quite a few characters like A,b,C,, HE, ¢,F,n, 0,1, u,y, etc. Knowledge about how to interface a seven segment display to a micro controller is very essential in designing embedded systems. A seven segment display consists of seven LEDs arranged in the form of a squares ‘8” slightly inclined to the right and a single LED as the dot character, Different characters can be displayed by selectively glowing the required LED segments, Seven segment displays are of two types, common cathode and common anode. In common cathode type , the cathode of all LEDs are tied together to a single terminal which is usually labeled as ‘com* and the anode of all LEDs are left alone as individual pins labeled as a, b,c, d, ¢, f, g & h (or dot). In common anode type, the anode of all LEDs are tied together as a single terminal and cathodes are left alone as individual pins. The pin out scheme and picture of a typical 7 segment LED display is shown in the image below. cathode of all LEOs ave treed eme and pichat of a tgpical 1 sespaext 4 ti y JIL. i) I It JIS III 4 de. h. apppppnnprrrrtsJsS III Post Test (MCQ baselobjective base): 1. How does a seven-segment display work?? ‘ i. The, cee Te geven segment display Da is connectel fe the Post 4 of Sine AT eA552 Shown in the Aseuit clicdocm- : —~ RS fo R10 ave Crosert |imiting gesistoss S3 15 the eset amd Re, C3 Fooms a debounci Qemitey. bh Cy, C2Fand X4 ave velated te clock Crocuit- —h Software past + Form a 0 404 Counter cs2rth Predetesmnine! celery. = Convert the custent Count into cligit coive Potten. + Put the Giosert digit clive pecteny into a Port Pow displaying. Faculty Sign: Wf, ORG Cool} Mov Pz, Hood REPERT 5 Mev Ro, H10 Mov perk, H o2coH YP cA Move A, @At PIR Mov p2, A ACALL DELAY ING pre OINL ad symp REPEAT DELAY: movey, Hos t3 > Movrs Alo L2 ; Mov RG, 450 LE: DINE REL DINL Rs, 12 DINE Ru, L3 RET i oa OFS otatt, SMH OBOH, TH Bete, ofsH, GOH, Joy Experiment No. 7 ' Date: 22)0e) 22 Aim: Write a C Program for 89C51 to toggle all the bits of P1 continuously. Objectives: To leam basic program viriting skills of C language for 89C51 microcontroller. Pre Test: (MCQ base/objective base) 1) Cis which level language? A) Low Level void main (void) { = for (;;) . { P1=0x55; P1=0xAA; } - 3 bee Post Test (MCQ base/objective bas f 1) Choose a correct C Statement regarding for loop. = For (35); AA) for loop works exacly first time «BY for loop works infinite number of times (C) Compiler error D) None of the above 2) Which data types are used in 8051 C? —¥, Oodetapes used in C% Bits Signesl_ ches, Umsigeel chat» enum, unsi Tint, Signeel int, Flowt, shits sfr, Str (6. ~ fFypcs_ |. Bit [Range Bit af. oto 4 Siq mec chaz | ZB 25 cho 127 | Yensignes| cheat z o to 28s _| Conclusion: Faculty Sign: UES After perk rn irs this Poacticle we lesion how fo tegqle atl bits of Pa Cont nuously in Sees], In befeweey SSH do AAH. Experiment No. 8 ' c Date: 15|3 | 2% Aim: Write a C program to generate 10 kF¥z & 50% duty cycle PWM pulses in 89C51. iti 39C51 Objectives: To lea the calculation of timer and counter modes and writing skill of C language for 8 ‘microcontroller. ae isionS This experiment aims to generate 10 kHz & 50% duty cycle PWM pulses using the software kel u-visi there are two ways to create a time delay in 8051 C: |. Using a simple for loop. 2. Using the 89C51 timers. Calculations: — Fos Aokts —aeclmgulin. coave, 7 = O.1™ms Te : Vokne + =O, 1™M5459 fer so4- cluty Bele * Tons = ontmax TorF= oJ nsx 50 “Wme for UT- state = 7g, 12 AA, ose A108 = (ossrnaad Count for Ton = ©.0S25_ [ue LOSS qs : Count for Topp = O.05m5 “Tue ] Loss fis = count tobe lereecl fos Ton = 65536-U6 ~ = 65446 CD THO: FFH, TLO= 02 ' be loactesl fox Tope = 5536-46 pe Sonn xe = 6suqo = Feroz THO ] Ge TLo=D2 cat Program: # inchide FF D. 2050 H—+ FF; 2051 H— 01; H 00; L 00 Faculty Sign: - . , Experiment No. 10 eet loe ane ‘Aim: To write an Assembly Language Program (ALP) to find the largest number in an array of data using 8085 microprocessor. Objectives: To learn the basic coding for 8085 microprocessor. Pre Test: (MCQ base/objective base) 1. Explain about CMP instruction TRE CMP instoyedion parses ferro opereinels, Tes Jenerty usest Fr conclitional execution 2. Give the difference between INX and INR. —b INR incsement the contentof wedister 2 by 4 and gesult 15 Stosccol im Skene pleice. —> INX fnevement -the Sai ste. pais by 4, ALGORITHM STEP 1: Load the address of the first element of the array in HL pair STEP 2: Move the count to B ~reg. STEP 3: Increment the pointer STEP 4: Get the first data in A —reg. STEP 5: Decrement the count, STEP 6: Increment the pointer STEP 7: Compare the content of memory addressed by HL pair with that of A - reg. STEP 8; If Carry =0, go to step 10 or if Carry = 1 go to step 9 STEP 9: Move the content of memory addressed by HL to A ~ reg. STEP 10: Decrement the count STEP 11: Check for Zero of the count, If ZF = 0, go to step 6, or if ZF = 1 go to next, step. STEP 12: Store the largest data in memory, STEP 13: Terminate the program. an my om . oN omy LX1H,4200 WSet pointer for array ~ MOV BM ‘oad the Count eS INXH on MOV AM Set Ist element as largest data . DCRB {Decrement the count aa oor: Nx Fy MP M IIE Ax reg. > M then go to AHEAD ee. JNC AHEAD ew. MOV A.M {iSet the new value as largest e~ > _ AHEAD: — per B | ° JNZ. LOOP //Repeat comparisons till count = 0 an STA 4300 Store the largest value at 4300 » ML! Input: 420011 OSH

You might also like