Interfacing With Seven Segment Display and LED Using ARM
Interfacing With Seven Segment Display and LED Using ARM
using ARM.
(a) Aim: To write and execute a program in Keil Software,interfacing ARM with
SevenSegment Display
Apparatus Required:
Keil Microvision4
Background Theory:
7 segment displays are among the simplest display units to display the numbers and
characters. It is generally used to display numbers and has brighter illumination and
simpler construction than dot matrix display. And because of brighter illumination,
the output can be viewed from larger distance than LCD. As shown in the above
image of a 7-segment display, it consists of 8 LEDs, each LED used to illuminate one
segment of unit and the 8thLED used to illuminate DOT in 7 segment display.
8thLED is used when two or more 7-segment modules are used, for example to
display (0.1). A single module is used to display single digit or character. To display
more than one digit or character, multiple 7-segments are used.
Depending upon connection we classify 7-Segment in two types:
Common Cathode
In this all the Negative terminals (cathode) of all the 8 LEDs are connected
together (see diagram below), named as COM. And all the positive terminals
are left alone or connected to the microcontroller pins. If we use
microcontroller we set logic HIGH to illuminate the particular and set LOW
to turn OFF LED.
Common Anode
In this all the positive terminals (Anodes) of all the 8 LEDs are connected
together, named as COM. And all the negative thermals are left alone or
connected to the microcontroller pins. If we use microcontroller we set logic
LOW to illuminate the particular and set logic High to turn OFF LED.
Below table shows the HEX values and corresponding digit according to
LPC2148 pins for common cathode configuration.
The table below shows the circuit connections between 7-Segment module
& LPC2148
Program:
Result: Thus a program has been written and executed in Keil, interfacing ARM
withseven segment display.
(a) Aim: To write and execute a program in Keil Software,interfacing ARM 7 with
LED and make it blink.
Apparatus Required:
Keil Microvision4
Background Theory:
ARM processor is widely found in electronics products such as LED TV, mobile
phones, tablets, multimedia devices, gaming devices etc. Even popular electronics
company like Apple’s mobiles and iPods, Raspberry pi 3 uses ARM architecture and
Arm processor in it. Arm Architecture Examples: ARM7, ARM9, ARM11,
CORTEX.
Pin Details
Program:
for(i=0;i<3000;i++);
int main()
delay_ms(1000);
delay_ms(1000);
Result: Thus a program has been written and executed in Keil to interface ARM 7
with LED and make it blink.
Ex No: 2
ASSEMBLY LANGUAGE PROGRAMS USING 8051
Date:
AIM
To write an assembly language program to perform arithmetic operations using
8051 microcontroller.
APPARATUS REQUIRED
1. 8051 Microcontroller kit
2. Keyboard 2a. ADDITION
ALGORITHM
1. Start the program
2. Get the first operand in accumulator
3. Add second operand with first operand in accumulator
4. Move data from accumulator to data pointer
5. Store the result in memory
6. Stop the program
FLOWCHART
PROGRAM
ADDRESS LABEL OPERAND OPCODE COMMENTS
8500 MOV A,#34 74,34 Get 1st operand in A
register
8502 ADD A,#62 24,62 Add operand in A
register
8504 MOV DPTR,#8600 90,45,00 Initialize the data
pointer
8507 MOV X@DPTR,A F0 Store the result in
memory
8508 Here SJMP Here 80 ,FE Stop the program
Execution
INPUT OUTPUT
2b. SUBTRACTION
ALGORITHM
1. Start the program
2. Get the first operand in accumulator
3. Subtract the second operand from first operand in accumulator
4. Move data from accumulator to data pointer
5. Store the result in memory
6. Stop the program
PROGRAM
ADDRESS LABEL OPERAND OPCODE COMMENTS
8500 MOV A,#62 74,34 Get 1st operand in A
register
8502 SUBB A,#34 24,62 Subtract operand in A
register
8504 MOV DPTR,#8600 90,45,00 Initialize the data
pointer
8507 MOV X@DPTR,A F0 Store the result in
memory
8508 Here SJMP Here 80 ,FE Stop the program
Execution
INPUT OUTPUT
2c. MULTIPLICATION
ALGORITHM
1. Start the program
2. Get the multiplier in A register
3. Get the multiplicand in B register
4. Multiply accumulator content and B register content
5. Store the result in memory
6. Stop the program
FLOWCHART
PROGRAM
ADDRESS LABEL OPCODE OPERAND COMMENTS
8500 MOVA,#06 74,06 Get multiplier in A register
2d. DIVISION
ALGORITHM
1. Start the program
2. Get the multiplier in A register
3. Get the multiplicand in B register
4. Multiply accumulator content and B register content
5. Store the result in memory
6. Stop the program
PROGRAM
ADDRESS LABEL OPCODE OPERAND COMMENTS
8500 MOV A,#06 74,06 Get Divisor in A register
SET A BIT
RESET A BIT
COMPLIMENT A BIT
MOV DPTR, #STARTING ADDRESS
MOVX A, @DPTR
CPL 0E5
INC DPTR
MOVX @DPTR, A
L4: SJMP L4 (OFFSET ADDRESS)
LCALL 03
RESULT
Thus the demonstration of basic instructions including conditional jumps,
looping, calling subroutines, stack parameter testing was executed using 8051
microcontroller.
Experiment No. 4 Interfacing DAC and ADC with 8051
Aim:
(a) To execute an Assembly Language Program to convert digital input to analog
output by interfacing Digital to Analog Converter with 8051.
Apparatus Required:
Algorithm
1. Initialize the accumulator with 0x80.
2. Set DPTR to 0x4003.
3. Move the value in the accumulator to the memory location pointed by DPTR (0x4003).
Main Loop START:
4. Set the accumulator with 0x00.
5. Set DPTR to 0x4000.
6. Move the value in the accumulator to the memory location pointed by DPTR (0x4000).
7. Call DELAY subroutine.
8. Set the accumulator with 0xFF.
9. Set DPTR to 0x4000.
10. Move the value in the accumulator to the memory location pointed by DPTR
(0x4000).
11. Call DELAY subroutine.
12. Jump to START to repeat the loop.
Delay Subroutine DELAY:
a. Load R1 with 0x10.
Outer Loop LOOP1:
i. Load R0 with 0xFF.
Inner Loop LOOP2:
- Decrement R0.
- If R0 is not zero, jump back to LOOP2.
ii. Decrement R1.
iii. If R1 is not zero, jump back to LOOP1.
b. Return from the subroutine.
Program:
Result:
Thus the assembly language program was written to convert digital input to
analog output by interfacing Digital to Analog Converter with 8051.
Aim:
Apparatus Required:
Algorithm:
DELAY Subroutine:
17. Initialize R0 with 0xFF.
18. LOP: Initialize R1 with 0xFF.
19. LOP1: Decrement R1. If R1 is not zero, jump to LOP1.
20. Decrement R0. If R0 is not zero, jump to LOP.
21. Return from the subroutine.
Program:
Aim:
To run a stepper motor at different speed in forward and reverse directions.
Apparatus Required:
Algorithm
1.Start the program
2.Initialize the counter and DPTR
3.Get the value of micro controller
4.Execute till the rotation of stepper motor
5.Stop the program
Program:
Memory
Mnemonics
Address
8500 MOV A,#80
8517 INC R1
852C RET
AIM
To write the assembly language program to perform arithmetic operation using
8086 microprocessor
APPARATUS REQUIRED
8086 microprocessor Kit
Keyboard
8086 ALGORITHM
Addition
1. Start the program
2. Load the LSB and MSB of 1st number to AX and BX register respectively
3. Load the LSB and MSB of 2nd number to CX and DX register respectively
4. Initialize the carry as zero
5. Add the LSB of both the numbers
6. Add the MSB of both the numbers with previous carry
7. Check the carry flag, if set then increment carry by 1
8. Store the sum in memory location
9. Halt the program.
FLOW CHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
Ex.No:1b SUBTRACTION OF TWO 32-BIT NUMBERS USING
8086
ALGORITHM
Subtraction
1. Start the program
2. Load the LSB and MSB of 1st number to AX and BX register respectively
3. Load the LSB and MSB of 2nd number to CX and DX register respectively
4. Initialize the carry as zero
5. Subtract the LSB of both the numbers
6. Subtract the MSB of both the numbers with previous borrow
7. Store the sum in memory location
8. Halt the program.
FLOWCHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
Ex.No:1c MULTIPLICATION OF TWO 16-BIT NUMBERS
USING 8086
ALGORITHM
Multiplication
FLOWCHART
PROGRAM
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
Ex.No:1d DIVISION OF TWO 16-BIT NUMBERS
USING 8086
Division
ALGORITHM
FLOWCHART
PROGRAM
2000 MOV DX,[1100] Initialize the DX register for storing the remainder.
2004 MOV AX,[1102] Move the dividend from the address to AX register.
2007 MOV BX,[1104] Move the divisor from the address to BX register.
Divide the contents of BX register with the
200B DIV BX
Accumulator i.e., AX register.
Move the quotient from Accumulator register to the
200D MOV [1200],AX
address
2010 MOV [1202],DX Move the remainder from DX register to the address
2014 HLT Stop the program.
EXECUTION
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
RESULT
Thus the arithmetic operations are performed using 8086 microprocessor and
the result is stored in memory.
Ex No.5 Sensor Interfacing using 8051 Micro controller
Objective: To measure the temperature and store the digital value in memory using 8051 microcontroller.
Apparatus:
● 8051 kit
● ADC board
● LM35 (temperature sensor)
Theory:
The LM35 series sensors are precision integrated-circuit temperature sensors, whose output voltage is
linearly proportional to the Centigrade temperature. It gives 10mV of output voltage for every 10C. The LM35
does not require any external calibration or trimming to provide typical accuracies of ±¼°C at room temperature
and ±¾°C over a full -55 to +150°C temperature range. The LM35's low output impedance, linear output, and
precise inherent make interfacing to readout or control circuitry especially easy. It can be used with single
power supplies, or with dual supplies. As it draws only 60 µA from its supply, it has very low self- heating, less
than 0.1°C in still air. The LM35 is rated to operate over a -55° to +150°C temperature range. The LM35 IC
sensor is available at a Low cost .LM35 is a three terminal IC with, Vcc, Ground & Vout
The LM 35 IC gives a 10mV analog output voltage for every degree Celsius change in temperature. The
Output of the temperature sensor is analog in nature so we need an analog to digital converter for converting
the analog input to its equivalent binary output.
Since the output of LM35 is analog voltage, it should be converted into digital before it is applied to a
microcontroller port pin.
Circuit:
Program:
MOV P1, #0xFF ; Configure Port 1 as input (data lines from ADC)
MOV P2, #0x00 ; Configure Port 2 as output (control signals to ADC)
START:
WAIT_INTR:
JB P2.4, WAIT_INTR; Wait until INTR (P2.4) goes low
; Read ADC data
CLR P2.1 ; Set CS (P2.1) low to enable ADC
CLR P2.2 ; Set RD (P2.2) low to read data
MOV A, P1 ; Read data from ADC to accumulator
MOV TEMP_LOW, A; Store low byte of temperature reading
SETB P2.2 ; Set RD (P2.2) high after reading data
MOV A, TEMP_LOW
ADD A, A
MOV TEMP_HIGH, A; Store high byte of temperature (in °C)
SJMP START ; Repeat the process
END
Result:
Thus, the temperature is measured and stored in memory using 8051.