0% found this document useful (0 votes)
141 views16 pages

Lab-8 8051 I o Port Programming

Uploaded by

Ankit Dhang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
141 views16 pages

Lab-8 8051 I o Port Programming

Uploaded by

Ankit Dhang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 16
I/O PORT PROGRAMMING IN 10} Write an 8051 assembly language program to toggle the status of the LEDs connected at port 1 pins 0 for every “PQRS” ms, where “PQRS" is last 4-digits of your register number. Assume the crystal frequency as 11.0592 MHz. Verify the output using ESA 8051 Microcontroller kit. TABS BECEZ04P- MP & MC LAB <1 TABS 8051 have 4 I/O ports each comprising 8 bits which can be configured as inputs or outputs. Hence, total 32 i/o pins allow the microcontroller to be connected with the peripheral devices. Except port | all other ports are used for dual purpose, all ports are bidirectional and they are constructed with a D type output latch. Pin configuration, ie. whether it is to be configured as an input (1) or an output (0), depends on its logic state, All the ports upon RESET are configured as input, ready to be used as input ports. All ports are byte and bit accessible > Byte accessible : PO,P1,P2,P3 > Bit-accessible : Px.y, where x represents port number ranging from 0 to 3, y represents bit number of the port ranging from 0 10 7 ‘BECE204P- MP & MC LAB @ Write an 8051 assembly language program to toggle the status of the LEDs connected at port 1 pins O for every 1 seconds (1000 ms). Assume the crystal frequency as 11,0592 MHz. Verify the output using ESA 8051 Microcontroller kit. ‘ORG 0000H cur P10 BACK: SETB P.O ACALL DELAY car P10 ACALL DELAY SIMP BACK TABS BECEZ04P- MP & MC LAB Delay calculation: + LOOPS Time delay : [250x|1+1+2)}x1.085=1085) MON REE LOOP2, repeat LOOPS for 200 times, to 20041085 kz = 217000 1 MOV R2, #200; IMC Bur, “MOV R3,i#250" and “DINZ R2, AGAIN” ot the start and ond of MOV RS, #250; IMC LOOP? [200x(1-+2)/x1.085 js = 651 jis. As @ result, toto time delay NOP IMC ‘of LOOP? Is 217000+651=217651 us NOP 7 1MC DINZR3, LOOPS; 2MC Then LOOPS, repeat LOOP? for 5 times, so Sx 217651 us = 1088255 Ws = 1088 ms or 1,088 seconds. But, “MOV R2,#200" and “DINZ RI, AGAIN” ot the start ond end of LOOP! [5x(1+2)}x1.085 us = 16 us DINZR2,L00P2 ; 2MC DINZRI,LOOPT ;2MC Also "MOV R1,#5" and RET instuction execute once, 3x1.085 = 3 jis RET 4; 2MC Therefore total time delay generated by the entire delay loop program Js 1088255 us + 16 is + Sis = 1088274 ps TABS BECEZ04P- MP & MC LAB onche ROM (RO-DFFFF Memory Mode: Sat = ATA = Code Rom Sze: [lage:e&Kpozan i neh RAM (O-G5FF) paring stem: [ine SCS ute OPTR register Of Case meni Of hp Xana meneny Sat: __ = fon ff Pom feof pet fd pe ee |[r Bee: [=] tak hee ca pr ox Covel | __ Deets TABS BECEZ04P- MP & MC LAB BB options for Trget “Target 1 Device | Tam Ot TUBng | User | C51 | AST. | BL51 Locate | BL51 Mac | Debug | Utes | ‘Sect Feertr ects. Hef Exeatabe: [ESTING Cre Breast: \Objcts\ TESTING Debus bhematon F Browse Hemaon Caan Wine ow © Obecta TESTING LI TABS BECEZ04P- MP & MC LAB TABS [EB Options for Target Target Une Sindstor TF ne Speedo FesTine F L2etfeplesen a Sttip FF Rintoman) Lead Meptstenat Sutin Rintoman Ineo Fie Initio Fle esore Dabu Sesson Seng exo Debug Sesson Senge F Besiports 1 Toobox F Beskports IF Teobox IF Wah Wedows &Pefemance Anahaer Wach Wedews Menon Daley I Menor Bley crupu: Diver DLL: Parameter a a Diop DLL _ Parenter: Dios DU: [rsvou — oarestrene resto | 2 0K Hep BECEZO4P- MP & MG IAB TABS =H Feder Deb Seat IF Breskpores IF Wah Wedon IF Nena Daioy cPuou: Pam eon Diseg DU: Pray [prion — [ext PORT NUMBERS NOT SAME FOR EVERONE, (CHECK THE PORT NUMBER IN DEVICE MANAGER. Coe Opn IF Cache DATA(SFR) IF Cache DATA ‘Sep Poyan Excuton wth Set rtemst Morte Kents Monte not comected ox cancel BECEZO4P- MP & MG IAB JT: 26-Pin Male Connector for Ports PO, P1 and P2 Pin No. on J7 PORT Line Pin No. on J7 7 Pat 2 P22 4 P20 é PIs 3 Pia 70 PI2 ig Pro 7a POS 76 Pod 8 POR 2 POO 2 Pa6 2h Ey = a TABS BECEZ04P- MP & MC LAB aa)

You might also like