Professional Documents
Culture Documents
DESIGN ASSIGNMENT
PREPARED BY:
INDERDEEP SINGH 2016A7PS0041P
KARVE ANIRUDDHA GIRISH 2016A7PS0042P
SHUBHAM JAIN 2016A7PS0043P
LAKSH RAJESHNANWANI 2016A7PS0044P
1. PROBLEM STATEMENT
1. There are three separate trays for 3 chocolates (perk, five star
and dairy milk).
2. Each tray has storage capacity of 10 chocolates.
3. The five rupees coin used with only one type whose
specification as follows:
Cupro-
Five Rupees 6.0 g Circular 23 mm
Nickel
rupees coin(s) in coin slot as per cost of chocolate with some time
interval (if more than one coin is required for purchasing the
chocolate).
7. The user does not put in anything other than Indian currency
rupee coins from passing in (as they have a radius larger than that
of 5 rupee coins).
8. Pressure transducer MPX4115 is used for checking the coin
validity.
9. At the bottom of each chocolate tray LDR used for sensing if the
tray is empty. If all chocolate of a particular tray are sold then
bottom, a relay is connected to push the
chocolate. Green LEDs indicate successful dispensing of chocolate.
3. SYSTEM DESIGN
1 Modules
Quantity References Value Description
1 M1 MPX4115 Integrate Silicon Pressure Transducer
for Absolute Pressure
24 Integrated Circuits
Quantity References Value Description
1 U1 8086 16 bit Microprocessor
3 U2-U4 74LS373 Octal D-Type Transparent Latches with
3-State Outputs
2 U5-U6 74LS245 Otal Bus Transceivers With Tristate
Outputs
2 U7-U8 2732 32K (4Kx8) EPROM
3 U9,U14,U18 NOT Simple Digital Inverter
2 U10-U11 6116 16K (2Kx8) Static RAM
1 U12 74LS138 3-Line to 8-Line Decoder / De-
multiplexers
2 U13,U22 8255A Programmable Peripheral Interface with
24 I/O Lines
6 U15-U17,U19- OR Simple 2 input OR Gate
U21
1 U23 OPAMP Ideal operational amplifier (OPAMP)
1 U24 ADC0808 8-bit Microprocessor Compatible ADC
With 8-Channel Multiplexer
6 Diodes
Quantity References Value Description
3 D1-D3 LED-GREEN Animated LED model (Green)
3 D4-D6 LED-RED Animated LED model (Red)
9 Miscellaneous
Quantity References Value
3 LDR1-LDR3 LDR Light Dependent Register (LDR) generic
model
3 RL1-RL3 12V Animated Relay model
3 SW1-SW3 SW-SPDT Interactive SPDT Switch (Latched
Action)
The 8086 based system uses 2Kx8 Static RAM 2 chips of 2K size
each and 4Kx8 ROM 2 chips of 4K size each. Both RAM and ROM
are organized into even and odd banks to facilitate both byte sized
and word sized data transfers.
Read Only Memory (ROM):-
Starting address 00000H
Ending address 01FFFH
Even bank begins at 00000H and ends at 01FFEH
Odd bank begins at 00001H and ends at 01FFFH
Relay Control
ADC0808
The ADC0808 is a multi-channel 8-bit A/D converter. The Vref+ = 5V
and Vref- = 0V is being supplied to the A/D converter and hence the
resolution of the A/D is 19.6mV for every increment in the digital
output. It is used to digitize the analog output of the relevant sensor
(based on the tank selected).
4. ALGORITHM
1. Press Push button for Chocolate selection
2. If Selected Chocolate tray is not empty than
NoOfCoins = 0
goto step 3
Else
goto step 1.
3. Wait for Inserting five rupees coin in coin slot.
4. Check the weight of inserted five rupees coin.
If valid coin inserted then
goto step 5
Else
goto step 3.
5. NoOfCoins++
6. If (NoOfCoins = Required Coins for selected Chocolate) then
Goto step 7
Else
Goto step 3
7. On the relay of selected tray and Dispense chocolate.
8. If selected try is now empty then
Glow selected try empty tray LED
9. Go to step 1
5. Flow Chart
6. ASSEMBLY CODE
;
; we are using short name for different chocolates
; tray button, tray status and chocolate cost
; -------------------------------------------------------------------
; Full Name/Description Short Name Used
; -------------------------------------------------------------------
; perk chocolate tray button ptb
; five star chocolate tray button ftb
; dairy milk chocolate tray button dtb
;
; perk tray empty status ptes
; five star tray empty status ftes
; dairy milk tray empty status dtes
;
; perk chocolate cost pcc
; five star chocolate cost fcc
; dairy milk chocolate cost dcc
;
.model small
.data
; Chocolate tray button pressing status variable
ptb 1 db (0) ; initially button not pressed
ftb 1 db (0) ; initially button not pressed
dtb 1 db (0) ; initially button not pressed
.code
.startup
MOV AX, 0000H
MOV DS,AX ;initializing data segment to 0000H
mainLoop: CALL DisplayEmptyLED ; check empty status of all tray from LDR &
; display empty status LED
CALL ReadPushButton ; read Push Button status of all chocolates
;;
;; --------------- S U B R O U T I N E S------------------------------------
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure to examine chocolate tray empty status by LDR inputs through ADC
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EmptyStatus PROC NEAR USES AX, DX
PUSHF
;
; get status of LDR1 (perk tray)
;
MOV DX, PORTC2
MOV AL, 00000111B ; Bit(32)-LDR1, Bit(1)-START, Bit(0)-ALE
OUT DX, AL
; Check EOC Status of ADC
MOV DX, PORTB2
JmpEOCp: IN AL, DX
AND AL, 01H
JZ JmpEOCp
; read digitally converted data from PORTA2
MOV DX, PORTA2
MOV AL, DX
CMP AL, 00H
JNZ emptyP
MOV ptes, 00h ; perk tray not empty
JMP nexTryF
emptyP: MOV ptes, 01H ; perk tray empty
nexTryF: ;
; get status of LDR2 (five star tray)
;
MOV DX, PORTC2
MOV AL, 00001011B ; Bit(32)-LDR2, Bit(1)-START, Bit(0)-ALE
OUT DX, AL
; Check EOC Status of ADC
MOV DX, PORTB2
JmpEOCf: IN AL, DX
AND AL, 01H
JZ JmpEOCf
; read digitally converted data from PORTA2
MOV DX, PORTA2
MOV AL, DX
CMP AL, 00H
JNZ emptyF
MOV ftes, 00h ; five star tray not empty
JMP nexTryD
emptyF: MOV ftes, 01H ; five star tray empty
nexTryD: ;
; get status of LDR3 (dairy milk tray)
;
MOV DX, PORTC2
MOV AL, 00001111B ; Bit(32)-LDR3, Bit(1)-START, Bit(0)-ALE
OUT DX, AL
; Check EOC Status of ADC
MOV DX, PORTB2
JmpEOCd: IN AL, DX
AND AL, 01H
JZ JmpEOCd
; read digitally converted data from PORTA2
MOV DX, PORTA2
MOV AL, DX
CMP AL, 00H
JNZ emptyD
MOV dtes, 00h ; dairy milk tray not empty
JMP nextRET
emptyD: MOV dtes, 01H ; dairy milk tray empty
nextRET: POPF
RET
EmptyStatus ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure for display Empty tray indicator RED LED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DisplayEmptyLED PROC NEAR USES AX, DX
PUSHF
CALL EmptyStatus ; read & Store the status of all tray LDRs
POPF
RET
DisplayEmptyLED ENDP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure for Reading Push button pressing status
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ReadPushButton PROC NEAR USES AX, DX
PUSHF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Procedure for Checking Inserted 5 Rupees Coin Validity
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ReadCoinInsertion PROC NEAR USES AX, DX
PUSHF
.exit
end
A B C D
DEN
CE AD[16..19]
A0 20
RD OE/VPP U4 A[16..19]
DT/R
<------- Chocolat Dispensing Slot ------>
U14 OR 2732 (4Kx8 EPROM) AD16 3
D0 Q0
2 A16
AD17 4 5 A17
ALE
NOT D1 Q1
A0 U8 AD18 7 6 A18
D2 Q2
A1 8 9 D8 AD19 8 9 A19 U24(VREF(+))
A0 D0 D3 Q3
A2 7 10 D9 13 12
U17 A1 D1 D4 Q4
A3 6 11 D10 14 15 5 Rupee Coin Inseting Slot
A2 D2 D5 Q5
A4 5 13 D11 17 16
A5 4
A3 D3
14 D12 18
D6 Q6
19 U24 M1
A4 D4 D7 Q7 MPX4115
BHE A6 3 15 D13 9 16
BHE A5 D5 OE VREF(-)
1 A7 2 16 D14 1 12
A6 D6 OE U22 VREF(+)
OR A8 1 17 D15 ALE 11
A7 D7 LE
A9 23 D0 34 4 17 22 100.0
A8 D0 PA0 OUT8 ALE
A10 22 74LS373 D2 D1 33 3 14 23
A9 D1 PA1 OUT7 ADD C
A11 19 D1 D2 32 2 15 24
A10 D2 PA2 OUT6 ADD B
A12 21 D0 D3 31 1 8 25
U19 A11 D3 PA3 OUT5 ADD A
D4 30 40 18
D[0..15] D4 PA4 OUT4
ROM (ODD) 18 D5 29 39 19 5
U18 CE AD[0..15] U5 D6
D5 PA5 OUT3 IN7 U23 1 2 3 4 5 6
20 28 38 20 4
OE/VPP D[0..7] D6 PA6 OUT2 IN6
AD0 2 18 D0 D7 27 37 21 3
M/IO A0 B0 D7 PA7 OUT1 IN5
2732 (4Kx8 EPROM) AD1 3 17 D1 2 M1(V+)
A1 B1 IN4
OR AD2 4 16 D2 5 18 EOC 7 1
NOT U10 A2 B2 RD RD PB0 EOC IN3
AD3 5 15 D3 36 19 28
A3 B3 WR WR PB1 IN2
A1 8 9 D0 AD4 6 14 D4 A1 9 20 6 27
A0 D0 A4 B4 A0 PB2 START IN1 OPAMP
A2 7 10 D1 AD5 7 13 D5 A2 8 21 10 26
U20 A1 D1 A5 B5 A1 PB3 CLOCK IN0
A3 6 11 D2 AD6 8 12 D6 35 22
A2 D2 A6 B6 RESET RESET PB4
A4 5 13 D3 AD7 9 11 D7 23 ADC0808
A3 D3 A7 B7 PB5
A5 4 14 D4 D3 6 24
A4 D4 CS PB6 CLK
A0 A6 D5 D4
SOC
3 15 19 25
A5 D5 CE PB7
A7 2 16 D6 1 D5
A6 D6 AB/BA
OR A8 1 17 D7 D6 14 ALE1
DEN
A7 D7 PC0
A0 A9 23 74LS245 D7 15
A8 PC1
A10 22 16
A9 U6 PC2
A11 19 17 LDR3(1)
A10 PC3
DT/R
AD8 2 18 D8 13
A0 B0 PC4
RAM(EVEN) 18 AD9 3 17 D9 12
CE A1 B1 PC5
20
OE
AD10 4
A2 B2
16 D10
PC6
11 LDR1 LDR2 LDR3
21 AD11 5 15 D11 10
WR WE A3 B3 PC7
AD12 6 14 D12
U21 A4 B4
6116 (2Kx8 Static RAM) AD13 7 13 D13
A5 B5
AD14 8 12 D14 8255A PPI (Chip-2)
U11 A6 B6
AD15 9 11 D15
2 BHE A1 8 9 D8
A7 B7
BHE A0 D0
A2 7 10 D9 19
A1 D1 CE
OR A3 6 11 D10 1
A2 D2 AB/BA
1.0
1.0
1.0
A4 5 13 D11
A3 D3
A5 4 14 D12 74LS245
A4 D4
A6 3 15 D13 LDR LDR LDR
A5 D5
A7 2 16 D14 Perk Try Empty Five Stary try Empty Dairy Milk Tray Empty
A6 D6
A8 1 17 D15
A7 D7
A9 23 <------- Tray Empty StatusChecking LDR ----------->
A8
A10 22
A9
A11 19
A10
RAM(ODD) 18
CE
20 CHOCOLATE VENDING SYSTEM
OE
21
WE
6116 (2Kx8 Static RAM)