8051 Second Programming Excercise

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Page 11 of 14

Programming Exercise 5(Software Simulaiton)


Practice the following listed programs using EdSim51 on PC and observe the outputs by running the programs and single stepping where ever it is required. The purpose of this exercise is to get familiar with hardware simulation of 8051 using Assembly language, and getting acquainted with EdSim51 Hardware Simulation functionalities. 1. Write a program that displays the binary pattern from 0 to 255 (and back to 0) on the LEDs interfaced with port 1. 2. Write a program that simply echoes the switches on P2 to the LEDs on P1. 3. Write an assembly language program displays the number 1234 on the four multiplexed 7segment displays. 4. Write an assembly language program that sends the text ABC to the LCD display on EdSim51. 5. Write a program that generates a ramp on the DAC on EdSim51. Observer the use of Scope on EdSim51. 6. Write an assembly language program that will take Samples from the ADC and will Display them on the Scope on EdSim51 via the DAC. 7. Write a program that simply scans the keypad until a key is pressed. It then places the key number in R0, and stops scanning. 8. Write a program that sends the text abc on the 8051 serial port to the external UART at 4800 Baud. 9. Write a program that receives data on the 8051 serial port via external UART. 10. Write a program rotates the motor in a clockwise direction and the number of revolutions is displayed on Display 0 (the 7-segment display). The display only shows up to nine revolutions and then resets.

EC Deptt,, GEC Gandhiinagar Miicroconttrollller Lab,, Tuttor Kiinnar Vaghella EC Dep GEC Gandh nagar M crocon ro er Lab Tu or K nnar Vaghe a

Page 12 of 14

Programming Exercise 6(Software Simulaiton)


1. Write a program to read the Output AA on Port P1, and observe the output on the port pins using Keil simulator. 2. Write a program to read the status of port P1 and output that status on port P2. 3. Write a program using Keil to program the Timer 0 to output a square wave on one of its pin. 4. Write a program using Keil to out put a character on serial port of 8051. 5. Write a program that will generate an interrupt on a event of a Timer reset and will toggle the port pin P1.0, use Keil for this. 6. Find the value needed in TH1 for the bauds of 9600, 2400 and 1200 on serial port of 8051with the crystal frequency of 11.0592 MHz. 7. Write a program in 8051 using Keil to transfer letter A continuously on serial port at 4800 baud.

EC Deptt,, GEC Gandhiinagar Miicroconttrollller Lab,, Tuttor Kiinnar Vaghella EC Dep GEC Gandh nagar M crocon ro er Lab Tu or K nnar Vaghe a

Page 13 of 14

Programming Exercise 7 (Hardware Practice)


1. Write programs to communicate between two 8051 Kits using Serial Port. 2. Write a program to Test all the Timer Modes supported by 8051, and monitor the waveforms on CRO. 3. Interface a 2 line 16 character LCD display with 8051. 4. Interface matrix keyboard 74LS922 with 8051. 5. Design a 4 digit Decimal Counter using 7-segment LED display. 6. Interface stepper motor with 8051 kit, and then try to design a robot. 7. Interface an analog to digital converter 0808 or 0804 or any other chip, with 8051. 8. Interface a digital to analog converter and use it as a function generator.

EC Deptt,, GEC Gandhiinagar Miicroconttrollller Lab,, Tuttor Kiinnar Vaghella EC Dep GEC Gandh nagar M crocon ro er Lab Tu or K nnar Vaghe a

Page 14 of 14

Programming Exercise 8 (Hardware Design Practice)


Objective
This homework is intended to illustrate the following concepts, 1. Interface 8051 with external code and data memory 2. Interface 8051 with external peripherals (memory mapped) 3. Design and implementation of the memory map and address decoder 4. Usage of IO ports

Problem
Design an 8051 based system with the following features. The 8051 device has 4K of on-chip ROM (code memory) which should also be usable. Assume a 11.0592 MHz crystal osc. The address map is specified and you will have to design an address decoder. Try to make the address decoder as simple as possible and try to minimize the number of ICs used for the purpose. You will also show the address/data demultiplexer. 1. 2. 3. 4. 5. 6. 7. Power on Reset and the oscillator circuit Port-1 (P1) bits P1.0 to P1.6 connected to a seven segment LED display. Bit P1.7 connected to a single LED (dont forget current limiting resistors) Port-3 (P3) bits P3.4 and P3.5 connected to two push buttons (assume any polarity) External code memory (ROM1) of size 4K at 0x2000 External code memory (ROM2) of size 8K at 0x4000 External data memory (RAM1) of size 16K at 0x4000 A device (Dev1) that needs 16 address locations (readable and writeable) at data memory location 0x8000. Dev1 has an active low chip select CS, 4 address lines A0 _ _ A3, 8 data lines D0 _ _D7, an active low read line RD and an active low write line WR. A device (Dev2) that needs 4 address locations (writeable only) at data memory location 0xF000. Dev2 is similar to Dev1 but has only 2 address lines A0 _ _ A1 and is not readable (no RD line).

8.

Deliverables :
Submit a schematic diagram with all components neatly labeled, address map diagram and truth table for the address decoder.

EC Deptt,, GEC Gandhiinagar Miicroconttrollller Lab,, Tuttor Kiinnar Vaghella EC Dep GEC Gandh nagar M crocon ro er Lab Tu or K nnar Vaghe a

You might also like