intel's mcs-51 family of microcontrollers and its derivatives … · · 2016-08-244.2...
TRANSCRIPT
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
1
CONTENTS
PAGE NO
1.0 Introduction 3
2.0 Description of the Circuit 3
3.0 Installation 4
4.0 Demonstration Examples for DAC 5
4.1 Demonstration Program for MPS 85-3 Trainer 5
4.2 Demonstration Program for ESA 85-2 Trainer 7
4.3 Demonstration Program for ESA-80 Trainer 8
4.4 Demonstration Program for ESA-65 Trainer 10
4.5 Demonstration Program for ESA-31 Trainer 12
4.6 Demonstration Program for ESA-68K Trainer 13
4.7 Demonstration program for ESA 86/88-2 Trainer 15
4.8 Demonstration program for ESA 196 16
4.9 Demonstration Program for ESA-51 Trainer 18
4.10 Demonstration Program for ESA 86/88-3 Trainer 20
4.11 Demonstration Program for ESA 51E Trainer 22
4.12 Demonstration Program for ESA 86/88E Trainer 24
5.0 Demonstration examples Tempr. Sensor 25
5.1 Demonstration program for MPS 85-3 Trainer 26
5.2 Demonstration program for ESA 85-2 Trainer 27
5.3 Demonstration program for ESA 31 Trainer 28
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
2
5.4 Demonstration program for ESA 86/88-2 Trainer 29
5.5 Demonstration Program for ESA-51 Trainer 31
5.6 Demonstration Program for ESA 86/88-3 Trainer 32
5.7 Demonstration Program for ESA 51E Trainer 35
5.8 Demonstration Program for ESA 86/88E Trainer 36
Appendix A : Component Layout Diagram
Appendix B : Schematic Diagram
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
3
DAC FOR ADC AND TEMPERATURE SENSOR
INTERFACE
1.0 INTRODUCTION
Electro Systems Associates Private Limited (ESA) manufacturers trainers for most of the popular
microcomputers viz 8085, Z-80, 6502, 8031, 8086/8088 and 68000. ESA offers a variety of modules
which can be interfaced to these trainers. These modules can be effectively used for teaching/training
in the laboratories.
In many microprocessor based systems, analog input signals have to be converted into digital
signals. Though Analog-to-Digital converters (ADC's) are available for this purpose, they
are generally expensive. A lower-cost alternative scheme utilizes a Digital-to-Analog converter
(DAC) and either successive approximation or counter algorithm implemented in software, to
realize analog-to-digital conversion. The only limitation of this procedure is the considerable
amount of time required to complete the analog to digital conversion. because of its low cost, this
scheme is widely used in microprocessor based systems.
The present interface module allows the user to become familiar with the techniques of using a
DAC for implementing analog-to-digital conversion.
2.0 DESCRIPTION OF THE CIRCUIT
Please refer to the schematic of this interface presented in the Appendix B.
This interface consists of an 8-bit D-to-A converter (DAC 08). User can control the input to the DAC
through port A (of the 8255A on the trainer kit). The port output is latched and presented as
input to the DAC. Further, the same 8 bits are displayed by a column of 8 LED's. The DAC output
and the Analog input are fed to a comparator whose output can be monitored through the port line
PC0. This bit will be high when the DAC output is less than the Analog input. This indicates that a
larger value of digital input to DAC is required. Thus this line can be monitored to determine the
digital equivalent of the analog input voltage.
The interface provides a key also whose status can be read through a port line PC1. The closure of
this key (PC1 becomes high) is used to indicate that the conversion should be initiated.
The required software can utilize either the successive approximation method or the counter method.
In the first method, the value for each bit (zero or one ) is determined, starting with the most
significant bit, in successive in exactly 8 steps. In the counter method, starting with a value of
00, successively larger digital values (up to 0FFH) are tried. The digital input to the DAC which
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
4
results in the matching of DAC output with the Analog input (as indicated by the comparator output
being low) is taken as the digital equivalent.
Also provided on the interface is a simple temperature sensor simulator consisting of a TTL
monoshot. The monoshot is triggered through the port line PB0. The output of the TTL monoshot
is connected to the port line PC3. This line can be monitored to determine the digital equivalent
of the analog input. This input can be varied using a 50K potentiometer VR2, available in the
interface. The software can be written either for successive approximation method or counter
method. The sample program provided uses counter method.
The counter is initialised to zero and when the port line PC3 goes low, the content of the counter,
which is the digital equivalent of the analog input is displayed on the data field of the trainer kit.
There is also a provision to connect a thermistor to the interface by changing jumper setting JP1
to BC. The thermistor is connected across JP2.
The sample program presented in the next section utilizes the counter approach. User can develop
the software for successive approximation method and check the results.
3.0 INSTALLATION
The interface is housed in a plastic enclosure which has a locking mechanism. Push it with the index
finger and lift the top cover to open.
Connect the yellow wire of the interface module to +12V and green wire to -12V. (common of these
voltages should be connected to the common of the power supply of the trainer kit, if they are
different.) +5V supply for the interface module is drawn from the trainer kit through connecting
the flat cable.
Table 3-1 shows the connector on various trainers to which this interface can be connected. Some
trainers have two connectors and either may be used for connecting this interface. The
demonstration programs presented in this manual assumes that the interface is connected to
connectors as shown in column A. If the connector shown in column B is used, then user has to
change the port addresses appropriately. User may refer to the component layout diagrams of
respective ESA trainers to locate the connectors mentioned here.
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
5
TABLE-3.1
MICROPROCESSOR
TRAINER
A B
MPS 85-3 J2 J1
ESA 85-2 J2 J1
ESA-80 J2 J1
ESA-65 P4
ESA-68K P3 P4
ESA 68K-2 J2 J1
ESA 68-2 J1 J6
ESA 196 J1 J2
ESA-31 J2 J1
ESA-51 J10 J7
ESA-51E J5 J3
ESA-86/88-2 J4 J5
ESA-86/88-3 J8 J9
ESA-86/88E J4 J6
4.0 DEMONSTRATION EXAMPLES FOR DAC
A sample program to illustrate the operation of this interface module is presented below. This
program utilizes the counter method.
Load the following program and execute it. Set the potentiometer approximately at the middle.
Press the start conversion key (STC key on the interface board). A/D conversion through counter
method is initiated and the LEDs shows the counter states. After the conversion is complete the
equivalent digital value is displayed in the data field of trainer also. Change the potentiometer
setting and press the key again and note that the displayed value is proportional to the applied
Analog input voltage.
NOTE: Take care not to set the potentiometer to the extreme clockwise end as the analog voltage
input may go beyond the valid range and hence conversion may not be successful.
4.1 DEMONSTRATION PROGRAM FOR MPS 85-3 TRAINER
; Assume the interface is connected over J2 of the trainer.
; The trainer can be in KEYBOARD MODE or SERIAL MODE.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8C00 3E 81 MVI A,81H ;Initialise 8255
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
6
;for Mode 0.
;PA, PB=Output
;PC=Input.
8C02 D3 43 OUT 43H
8C04 06 00 START: MVI B,00H ;Load the starting
;count.
8C06 DB 42 LOOP1: IN 42H ;Wait for convert
8C08 E6 02 ANI 02H ;command Key to be
;pressed (i.e,PC1
8C0A CA 06 8C JZ LOOP1 ;to become high).
8C0D CD 4E 8C CALL DELAY ;Wait for key
;debounce delay
8C10 DB 42 LOOP2: IN 42H ;Wait for convert
;command key
8C12 E6 02 ANI 02H ;to be released
;i.e PC1 to become low
8C14 C2 10 8C JNZ LOOP2
8C17 78 LOOP3: MOV A,B ;Output count to port A
8C18 D3 40 OUT 40H
8C1A CD 4E 8C CALL DELAY ;Delay
8C1D DB 42 IN 42H ;Check for comparator
;output i.e PC0.
8C1F E6 01 ANI 01H
8C21 CA 28 8C JZ FINISH ;If PC0 is low,
;conversion is over
8C24 04 INR B ;Other wise increment
8C25 C3 17 8C JMP LOOP3 ;count and try again
8C28 78 FINISH: MOV A,B ;Check for KBD or
8C29 F5 PUSH PSW ;Serial mode
8C2A DB 50 IN 50H
8C2C E6 08 ANI 08H
8C2E C2 44 8C JNZ DISPKBD
8C31 21 5A 8C LXI H,DIGMSG
8C34 CD 5B 0B CALL DISPM
8C37 F1 POP PSW
8C38 CD 41 0C CALL NMOUT ;Output digital
8C3B CD 5C 0C CALL CROUT ;value
8C3E CD 5C 0C CALL CROUT ;Routine to <CR>
8C41 C3 04 8C JMP START ;Repeat
8C44 F1 DISPKBD: POP PSW
8C45 32 F1 8F STA CURDT
8C48 CD 4C 04 CALL UPDDT
8C4B C3 04 8C JMP START
8C4E 21 00 20 DELAY: LXI H,2000H ;Delay Routine
8C51 1B DCX D
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
7
8C52 7A MOV A,D
8C53 B3 ORA E
8C54 C2 51 8C JNZ DELAY+3
8C57 C9 RET
ORG 8C5AH
8C5A 44 49 47 49 54 DIGMSG: DB 'DIGITAL VALUE : ',00
8C5F 41 4C 20 56 41
8C64 4C 55 45 20 20
8C69 3A 20 20 00
4.2 DEMONSTRATION PROGRAM FOR ESA 85-2 TRAINER
; Assume the interface is connected over J2 of the trainer.
; The trainer can be in KEYBOARD MODE or SERIAL MODE.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8000 3E 81 MVI A,81H ;Initialise 8255
8002 D3 43 OUT 43H ;for Mode 0. PA,
;PB=O/P. PC=I/P.
8004 CD 0D 80 START: CALL CONVERT ;Routine to convert
8007 CD 32 80 CALL DISPLAY
800A C3 04 80 JMP START
800D 06 00 CONVERT: MVI B,00H ;Load the
;starting count
800F DB 42 LOOP1: IN 42H ;Wait for convert
;command key to be
8011 E6 02 ANI 02H ;pressed (i.e PC1 to
;become high).
8013 CA 0F 80 JZ LOOP1
8016 CD 51 80 CALL DELAY ;Wait for key
;debounce delay.
8019 DB 42 LOOP2: IN 42H ;Wait for convert
801B E6 02 ANI 02H ;command key to
801D C2 19 80 JNZ LOOP2 ;be released. i.e PC1
;to become low
8020 78 LOOP3: MOV A,B
8021 D3 40 OUT 40H
8023 CD 51 80 CALL DELAY
8026 DB 42 IN 42H ;Check for comparator
;output. i.e PC1.
8028 E6 01 ANI 01H ;If PC1 is low,
802A CA 31 80 JZ FINISH ;conversion is over.
802D 04 INR B ;Otherwise increment
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
8
802E C3 20 80 FINISH: JMP LOOP3 ;count and try again.
8031 C9 RET
8032 C5 DISPLAY: PUSH B
8033 DB 70 IN 70H ;Check for KBD
8035 E6 08 ANI 08H ;serial mode.
8037 C2 46 80 JNZ DISPKBD
803A 21 5B 80 LXI H,DIGMSG ;Display the message
803D CD 04 0B CALL DISPM ;"DIGITAL-VALUE".
8040 C1 POP B
8041 78 MOV A,B
8042 CD 11 0C CALL NMOUT
8045 C9 RET
8046 C1 DISPKBD: POP B
8047 78 MOV A,B
8048 32 75 FE STA CURDT
804B 06 00 MVI B,00
804D CD 78 05 CALL UPDDT
8050 C9 RET
8051 21 00 20 DELAY: LXI D,2000H ;Delay routine
8054 1B DCX D
8055 7A MOV A,D
8056 B3 ORA E
8057 C2 54 80 JNZ DELAY+3
805A C9 RET
ORG 8C5AH
805B 20 20 20 0D 0A DIGMSG: DB, 'DIGITAL VALUE : ',00
44 49 47 49 54
41 4C 20 56 41
4C 55 45 20 20
3A 20 20 00
4.3 DEMONSTRATION PROGRAM FOR ESA-80 TRAINER
; Assume the interface is connected over J2 of the trainer.
; The trainer can be in KEYBOARD MODE or SERIAL MODE.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8000 3E 81 LD A,81H ;Initialise 8255
;for mode 0
8002 D3 43 OUT (43H),A ;PA,PB=Output
;PC=Input.
8004 06 00 START: LD B,00H ;Load the
;starting count.
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
9
8006 DB 42 LOOP1: IN A,(42H) ;Wait for convert
;command key to
8008 E6 02 AND 02H ;be pressed i.e PC1
;to become high
800A CA 06 80 JP Z,LOOP1
800D CD 5A 80 LOOP2: CALL DELAY
8010 DB 42 IN A,(42H) ;Wait for convert
8012 E6 02 AND 02H ;command key to be
8014 C2 0D 80 JP NZ,LOOP2 ;released i.e PC1 to
;become low
8017 78 LOOP3: LD A,B ;Get the count and
;Output to Port A
8018 D3 40 OUT (40H),A
801A CD 5A 80 CALL DELAY ;Wait for some time
801D DB 42 IN A,(42H) ;and then Check
;comparator output
801F E6 01 AND 01H ;i.e PC0
8021 CA 28 80 JP Z,FINISH ;If PC0=0, conversion
;over Else try next
8024 04 INC B ;larger value
8025 C3 17 80 JP LOOP3
8028 78 FINISH: LD A,B ;Get the digital
;value and Get
8029 F5 PUSH AF ;the necessary
;display Codes
802A DB 50 IN A,(50H) ;For L.S nibble
802C E6 08 AND 08H ;Get the display
;code and Store
;in and Store in
802E 20 0D JR NZ,DISPKBD ;display buffer
8030 21 6A 80 LD HL,DIGMSG ;For M.S nibble
8033 CD 5B 0B CALL 0B5BH ;Get the display code
8036 F1 POP AF ;and Store in the
;display buffer
8037 CD 41 0C CALL OC41H ;Point to the
;display buffer
803A C3 04 80 JP START ;For about 2.5sec
803D F1 DISPKBD: POP AF ;display digital
;value in data field
803E 32 00 19 LD (1900H),A ;Address field
;is blank.
8041 11 00 19 LD DE,BYTE0 ;Repeat the
;whole process.
8044 21 03 19 LD HL,OUTBF ;Delay subroutine.
8047 06 03 LD B,03
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
10
8049 1A LOOP: S LD A,(DE)
804A CD 78 06 CALL HEX7SG
804D 13 INC DE
804E 10 F9 DJNZ LOOP ;Display Buffer Codes
;field are stored
8050 DD 21 03 LD IX,OUTBF ;stored here.
19
8054 CD FE 05 CALL SCAN ;Blank codes for
;address field
8057 76 HALT
ORG 805AH
805A 11 00 20 DELAY: LD DE,2000H ;Delay routine.
805D 1B DEC DE
805E 7A LD A,D
805F B3 OR E
8060 C2 5D 80 JP NZ,DELAY+3
8063 C9 RET
806A 0D 0A 20 20 20 DIGMSG: 'DIGITAL VALUE = ',00
806F 44 49 47 49 54
8074 41 4C 20 56 41
8079 4C 55 45 20 20
807E 3D 20 20 00
4.4 DEMONSTRATION PROGRAM FOR ESA-65 TRAINER
; Assume the interface is connected over P4 of the trainer.
; The trainer can be in KEYBOARD MODE or SERIAL MODE.
PORT_A EQU A040H
PORT_B EQU A041H
PORT_C EQU A042H
CMD_PORT EQU A043H
BUFFER EQU 0300H
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
0200 A9 81 LDA #81H ;Initialise 8255
;for Mode 0
0202 8D 43 A0 STA CMDPRT ;PA,PB=output
;PC=Input
0205 A9 00 START: LDA #00H ;Initial count.
0207 8D 00 03 STA BUFFER
020A AD 42 A0 LOOP1: LDA PORTC ;Wait for start
;convert key
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
11
020D 29 02 AND #02H ;to be pressed
;i.e PC1 to
020F F0 F9 BEQ LOOP1 ;become high
0211 20 5C 02 JSR DELAY ;Wait for start
;convert key
0214 AD 42 A0 LOOP2: LDA PORTC
0217 29 02 AND #02H ;to be released
;i.e PC1 to
0219 D0 F9 BNE LOOP2
021B AD 00 03 LOOP3: LDA BUFFER ;Get the count
021E 8D 40 A0 STA PORTA ;and Output to PORT A
0221 20 5C 02 JSR DELAY ;Wait for sometime
0224 AD 42 A0 LDA PORTC ;and then check
;comparator output
;i.e PC0
0227 29 01 AND #01 ;If PC0=0, conversion
0229 F0 06 BEQ FINISH ;over
022B EE 00 03 INC BUFFER ;Else try next
;larger value
022E 4C 1B 02 JMP LOOP3
0231 AD 80 A4 FINISH: LDA 0A480H
0234 10 0B BPL DISPSER
0236 AD 00 03 LDA BUFFER
0239 A2 00 LDX #00
023B 20 59 FE JSR 0FE59H ;Display digital value
023E 4C 05 02 JMP START ;in data field
0241 A0 00 DISPSER: LDY #00
0243 B9 71 02 DSER: LDA MESSAGE ;Display "DIGITAL
0246 48 PHA ;VALUE"
0247 20 39 E0 JSR 0E039
024A C8 INY
024B 68 PLA
024C C9 00 CMP #$00
024E D0 F3 BNE DSER
0250 AD 00 03 LDA 0300
0253 20 15 E0 JSR 0E015H
0256 4C 05 02 JMP START ;Repeat the
025C A9 10 DELAY: LDA #COUNT1 ;whole process
025E 8D 80 02 STA COUNTER1 ;Delay subroutine
0261 A9 00 DEL10: LDA #COUNT2
0263 8D 81 02 STA COUNTER2
0266 CE 81 02 DEL20: DEC COUNTER2
0269 D0 FB BNE DEL20
026B CE 80 02 DEC COUNTER1
026E D0 F1 BNE DEL10
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
12
0270 60 RTS
0271 0D 0A 44 49 47 MESSAGE:DB 0DH,0AH,'DIGITAL VALUE',00H
0276 49 54 41 4C 20
027B 56 41 4C 55 45
0280 00 COUNTER1
0281 COUNTER2
4.5 DEMONSTRATION PROGRAM FOR ESA-31 TRAINER
; Assume the interface is connected over J2 of the trainer
; The trainer can be in KEYBOARD MODE or SERIAL MODE.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8000 75 A0 E8 MOV P2,#SEG
8003 78 03 MOV R0,#03H ;Initialise 8255
;for Mode 0.
;PA, PB=Output
8005 74 81 MOV A,#81H ;PC=Input
8007 F2 MOVX @R0,A
8008 79 00 START: MOV R1,#00H
800A 78 02 LOOP1: MOV R0,#02H ;Load the
;starting count
800C E2 MOVX A,@R0 ;Wait for convert
;convert command
800D 30 E1 FA JNB ACC.1,LOOP1;Key to be pressed
8010 12 80 50 LCALL DELAY ;i.e PC1(to become
;high).
8013 E2 LOOP2: MOVX A,@R0
8014 20 E1 FC JB ACC.1.LOOP2;Wait for Key
;debounce delay.
8017 E9 LOOP3: MOV A,R1 ;Wait for convert
8018 78 00 MOV R0,#00H ;command key to be
;released i.e PC1 to
801A F2 MOVX @R0,A ;become low.
801B 12 80 50 LCALL DELAY
801E 78 02 MOV R0,#02
8020 E2 MOVX A,@R0 ;Delay
8021 30 E0 03 JNB ACC.0,FINISH ;Check for
;comparator
;output. i.e PC0
8024 09 INC R1
8025 80 F0 SJMP LOOP3 ;If PC0 is low,
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
13
8027 75 A0 E1 FINISH: MOV P2,#SEG ;conversion is over
802A 78 02 MOV R0,#02H ;Otherwise increment
802C E2 MOVX A,@R0 ;count and try again
802D 20 E3 0F JB ACC.3,KBD
8030 90 80 60 SRL: MOV DPTR,#DIGSEG ;Display digital
;value.
8033 C2 D5 CLR F0
8035 12 16 4B CALL DISPM ;Repeat the process.
8038 89 71 MOV 71H,R1
803A 12 18 5E CALL PUTBYTE
803D 75 A0 E8 MOV P2,#SEG
8040 80 C6 SJMP START
8042 89 60 KBD: MOV PARLOW,R1
8044 75 F0 00 MOV B,#00H
8047 12 01 9B CALL DISPD8
804A 75 A0 E9 MOV P2,#SEG
804D 80 B9 SJMP START
8050 90 80 00 DELAY: MOV DPTR,#8000#
8053 A3 DL1: INC DPTR
8054 E5 83 MOV A,DPH
8056 40 82 ORL A,DPL
8058 70 F9 JNZ DL1
505A 22 RET
8060 0D 0A 44 49 47 DIGMSG: 'DIGITAL VALUE = ',00
8065 49 54 41 4C 20
806A 56 41 4C 55 45
806F 20 3D 20 20 00
4.6 DEMONSTRATION PROGRAM FOR ESA-68K TRAINER
; Assume the interface is connected over P3 of the trainer.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
40600 41 F9 00 INIT: LEA $80300,A0
08 03 00
40606 11 7C 00 MOVE.B #$8B,6(A0) ;Initialise
8B 00 06 ;8255 for mode 0
4060C 41 F9 00 START: LEA $MSG,A0 ;for mode 0
04 06 2C ;PA=Output,
40612 70 0C MOVEQ #$0C,D0 ;PB,PC=Input
40614 4E B8 00 JSR $8C ;Output the
8C ;message
;'value='
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
14
40618 61 22 BSR $CON ;convert
4061A 22 45 MOVE.L D5,A1
4061C 4E B8 03 JSR $324 ;Display last two
24 ;ascii characters
;of result
40620 5C 89 ADDQ.L #6,A1
40622 20 49 MOVE.L A1,A0
40624 70 02 MOVEQ #2,D0
40626 4E B8 00 JSR $8C
8C
4062A 60 E0 BRA $START
4063C 41 F9 00 CON: LEA $80300,A0;Convert
08 03 00 ;routine
40642 08 28 00 WLOOP: BTST #1,4(A0) ;Wait for
01 00 04 ;convert command i.e
40648 67 F8 BEQ.S $WLOOP ;wait for PC1 to
;become high.
4064A 61 1E BSR $DELAY ;count=ff, so that
;first time thru'
;loop it become
4064C 08 28 00 WLOOP1: BTST #1,4(A0)
01 00 04
40652 66 F8 BNE.S $WLOOP1 ;Introduce, delay
40654 1A 3C 00 MOVE.B #$FF,D5
FF
40658 52 05 CLOOP: ADDQ.B #01,D5
4065A 10 85 MOVE.B D5,(A0)
4065C 61 0C BSR $DELAY
4065E 08 28 00 BTST #0,4(A0)
00 00 04
40664 67 02 BEQ.S $EXIT
40666 60 F0 BRA $CLOOP
40668 4E 75 EXIT: RTS
4066A 22 3C 00 DELAY: MOVE.L #$3FFF,D1
00 3F FF
40670 51 C9 FF DLOOP: DBRA D1,$DLOOP
FE
40674 4E 75 RTS
4062C 0D 0A 20 MSG DB CR,LF,'VALUE = ',00
20 56 61
40632 6C 75 65
20 3D 20
00
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
15
4.7 DEMONSTRATION PROGRAM FOR ESA 86/88-2 TRAINER
; Assume the interface is connected over J4 of the trainer.
; The trainer can be in KEYBOARD mode or SERIAL mode.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
2000 BC 00 30 MOVW SP,#3000
2003 B0 81 MOVB AL,#81 ;Initialise
2005 BA E6 FF MOVW DX,#0FFE6 ;8255 for mode 0
;PA,PB as O/P.
;PC as I/P.
2008 EE OUTB DX
2009 33 C0 START: XORW AX,AX
200B BA E4 FF MOVW DX,#0FFE4H
200E EC LOOP1: INB DX ;Wait for STC key
;to be pressed
200F F6 C0 02 TESTB AL,#02
2012 74 FA JE LOOP1
2014 E8 4E 00 CALL DELAY
2017 EC LOOP2: INB DX
2018 F6 C0 02 TESTB AL,#02
201B 75 FA JNE LOOP2
201D B0 FF MOVB AL,#0FF ;Setup count
;as FF,So that
;first time it
;becomes 1.
201F BA E0 FF W2: MOVW DX,#0FFE0 ;Digital value
;is O/P on portA
2022 40 INCW AX
2023 EE OUTB DX ;O/P a value
;on to Port A
;i.e DAC.
2024 50 PUSH AX
2025 E8 3D 00 CALL DELAY ;Introduce
2028 BA E4 FF MOVW DX,#0FFE4 ;some delay for
202B EC INB DX ;DAC Settling.
202C F6 C0 C1 TESTB AL,#01
202F 74 03 JE DONE
2031 58 POP AX
2032 EB EB JMP W2
2034 BA ED FF DONE: MOVW DX,#0FFEDH
2037 EC INB DX
2038 24 80 ANDB AL,#80
203A 74 1F JE KBD
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
16
203C 8C C8 MOVW AX,CS
203E 8E C0 MOVW ES,AX
2040 B8 6B 20 MOVW AX,DIGMSG
2043 9A 55 1B CALLS 1B55,0FE00 ;Display message
00 FE
2048 58 POP AX
2049 9A 64 1B CALLS 1B64,0FE00 ;Output Byte
00 FE
204E 9A 5B 1B CALLS 1B5B,0FE00 ;Linefeed & <CR>
00 FE
2053 EB AF JMP START
2055 90 XCHGW AX,AX
2056 58 KBD: POP AX
2057 B4 00 MOVB AH,#00
2059 9A 0A 0B CALLS 0B0A,0FF00
00 FF
205E EB A4 JMP START
2060 B9 FF 3F DELAY: MOVW CX,#3FFFH
2063 E2 FE LOOP 2063
2065 C3 RET
2066 0D 0A 44 49 47 DIGMSG: 'DIGITAL VALUE = ',00
206B 49 54 41 4C 20
2070 56 41 4C 55 45
2075 20 3D 20 00
4.8 DEMONSTRATION PROGRAM FOR ESA 196 TRAINER
; Assume the interface is connected over J1 of the trainer.
; The trainer can be in KEYBOARD mode or SERIAL mode.
NOTE: The mnemonic described in the manual is coded using cross
assembler. To code it in the ESA 196 built in on-line assembler,
it may require some changes. Otherwise user can enter the opcode
mentioned along with the program listing in the program memory
locations and string data in the data memory D1. Then execute
the program by using GO command.
REG1 EQU 52H
REG2 EQU 54H
REG3 EQU 58H
REG4 EQU 62H
PORT_A EQU 200H
PORT_B EQU 202H
PORT_C EQU 204H
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
17
CMD_PORT EQU 206H
OUT_STRING EQU 22F5H
HEX_ASCII EQU 230FH
NEW_LINE EQU 24EAH
CLR_LCD EQU 354BH
OUT_CHAR EQU 21FBH
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
ORG 8000H
8000 B1 81 52 LDB REG1,#81H ;Initialise 8255
8003 C7 01 06 02 STB REG1,CMD_PORT ;for mode 0.
8007 52 ;Port A,B as O/P.
;Port C as I/P.
8008 EF 40 B5 LCALL CLR_LCD
800B A1 6D 80 2A LD 2AH,#MSG
800F EF E3 A2 LCALL OUT_STRING
8012 EF 00 00 LCALL START
8015 B1 00 54 START: LDB REG2,#00H ;Starting from 0
8018 B3 01 04 02 LOOP1: LDB REG1,PORT_C ;Wait for
801C 52 ;conversion key
;to be pressed.
801D 71 02 52 ANDB REG1,#02H ;PC1 to become
;high.
8020 DF F6 JE LOOP1
8022 EF 40 00 LCALL DELAY ;Call delay
;routine.
8025 B3 01 04 02 LOOP2: LDB REG1,PORT_C ;Wait for
8029 52 ;conversion key to
;be released.
802A 71 02 52 ANDB REG1,#02H ;(ie. PC1 to
802D D7 F6 JNE LOOP2 ;become low.)
802F B0 54 52 LOOP3: LDB REG1,REG2 ;Output the count
8032 C7 01 00 02 STB REG1,PORT_A ;to Port A.
8036 52
8037 EF 2B 00 LCALL DELAY ;Call delay
;routine.
803A B3 01 04 02 LDB REG1,PORT_C ;Check for
;comparator.
803E 52 ;O/P. i.e PC0.
803F 71 01 52 ANDB REG1,#01H
8042 DF 04 JE FINISH ;Conversion is
8044 17 54 INCB REG2 ;over? Otherwise
8046 27 E7 SJMP LOOP3 ;increment count
;and try again.
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
18
8048 B0 54 52 FINISH: LDB REG1,REG2
804B F2 PUSHF
804C B1 0D 20 LDB 20H,#0DH
804F EF A9 A1 LCALL OUT_CHAR
8052 EF F6 B4 LCALL CLR_LCD
8055 A1 6D 80 2A LD 2AH,#MSG
8059 EF 99 A2 LCALL OUT_STRING
805C F3 POPF
805D B0 52 22 LDB 22H,REG1
8060 EF AC A2 LCALL HEX_ASCII ;Output digital
8063 27 B0 SJMP START ;value. repeat.
8065 A1 FF 7F 62 DELAY: LD REG4,#7FFFH ;Delay routine.
8069 E1 62 FD DLY: DJNZW REG4,DLY
806C F0 RET
;ENTER THE FOLLOWING DATA IN DATA MEMORY -D1.
;DATA MEMORY LOC. FROM 806DH TO 807DH
806D 44 49 47 49 MSG: DCB 'DIGITAL VALUE = ',00H
8071 54 41 4C 20
8075 56 41 4C 55
8079 45 20 3D 20
807D 00
4.9 DEMONSTRATION PROGRAM FOR ESA-51 TRAINER
;Assume the interface is connected over J10 of the trainer.
;The trainer can be in KEYBOARD MODE or SERIAL MODE.
PUTBYTE EQU 13D2H
SEG EQU E8H
SEGDIP EQU E9H
PARLOW EQU 71H
LCDOUT EQU 348H
OUTSTG EQU 1200H
CLRLCD EQU 03BBH
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
ORG 8000H
8000 75 A0 E8 MOV P2,#SEG ;Initialise 8255
8003 78 03 MOV R0,#03h ;in mode0
8005 74 81 MOV A,#81H ;PortA & PortB as O/P
8007 F2 MOVX @R0,A ;PortC as I/P
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
19
8008 79 00 START: MOV R1,#00H ;Load the starting
;count
800A 78 02 LOOP1: MOV R0,#02H ;wait for convert
;command
800C E2 MOVX A,@R0 ;Key to be pressed
800D 30 E1 FA JNB ACC.1,LOOP1 ;PC1 becomes high
8010 12 80 5C LCALL DELAY ;wait for key
;debounce delay
8013 E2 LOOP2: MOVX A,@R0 ;Key to be released
8014 20 E1 FC JB ACC.1,LOOP2 ;PC1 becomes low
8017 E9 LOOP3: MOV A,R1
8018 78 00 MOV R0,#0H
801A F2 MOVX @R0,A
801B 12 80 5C LCALL DELAY ;Check for comparator
801E 78 02 MOV R0,#02 ;that means PC0 bit
8020 E2 MOVX A,@R0 ;If PC0 is low,
8021 30 E0 03 JNB ACC.0,FINISH ;Conversion is over?
8024 09 INC R1 ;otherwise increment
8025 80 F0 SJMP LOOP3 ;count & try again
8027 75 A0 E9 FINISH:MOV P2,#SEGDIP ;Initialise 8255
802A 78 04 MOV R0,#04H ;Read DIP switch
802C E2 MOVX A,@R0 ;if bit ACC.3 is set
802D 20 E3 12 JB ACC.3,KBD ;jump to KBD routine
;ROUTINE FOR SERIAL MODE
8030 90 80 65 SRL: MOV DPTR,#DIGMSG ;Display "digital
;value="
8033 C2 D5 CLR PSW.5
8035 12 12 00 LCALL OUTSTG ;put the digital
;value
8038 89 71 MOV 71H,R1
803A 12 13 D2 LCALL PUTBYTE
803D 75 A0 E8 MOV P2,#SEG
8040 80 C6 SJMP START ;jump to START
;ROUTINE FOR KEYBOARD MODE
8042 00 KBD: NOP
8043 C0 01 PUSH 1
8045 12 03 BB LCALL CLRLCD ;clear LCD on
;trainer
8048 90 80 7A MOV DPTR,#DIGMSG1 ;Display
;"digital value="
804B C2 D5 CLR PSW.5
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
20
804D 12 03 48 LCALL LCDOUT ;put the digital
;value
8050 D0 01 POP 1
8052 89 71 MOV PARLOW,R1
8054 12 13 D2 LCALL PUTBYTE
8057 75 A0 E8 MOV P2,#SEG
805A 80 AC SJMP START ;jump to START
;DELAY ROUTINE
805C 7F 25 DELAY: MOV R7,#25h
805E 7E FF LOOP: MOV R6,#FFH
8060 DE FE DJNZ R6,$
8062 DF FA DJNZ R7,LOOP
8064 22 RET
8065 0D 0A 44 49 47 DIGMSG:DB 0DH,0AH,'DIGITAL VALUE =',00
806A 49 54 41 4C 20
806F 20 56 41 4C 55
8074 45 20 3D 20 20
8079 00
807A 44 49 47 49 54 DIGMSG1:DB 'DIGITAL VALUE = ',00
807F 41 4C 20 20 56
8084 41 4C 55 45 20
8089 3D 20 00
4.10 DEMONSTRATION PROGRAM FOR ESA 86/88-3 TRAINER
; Assume the interface is connected over J8 of the trainer.
; This program illustrates the use of counter method for A/D
; conversion
; The program can be executed in STAND-ALONE MODE or SERIAL
; MODE of operation.
; The program starts at memory location 0:2000H
ADDRESS OPCODE LABEL MNEMONIC COMMENTS
2000 B8 00 00 MOVW AX,0000H ;Initialise
2003 8E C8 MOVW CS,AX ;Segment Registers
2005 8E C0 MOVW ES,AX
2007 BC 00 30 MOVW SP,3000H ;Initialise Stack Ptr
200A 9A 31 00 00 FB CALLS 0FB00:0031H;Newline routine
200F BA E6 FF MOVW DX,0FFE6H ;Initialise 8255
;Port A & PortB
2012 B0 81 MOVB AL,81H ;as output and
2014 EE OUTB DX,AL ;Port C as input
2015 EB 2A JMP START ;Display message
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
21
;strings
2017 0D 20 43 4F 4E 56 MSG: DB 0DH,20H,'CONVERTING...', 00H
201D 45 52 54 49 4E 47
2023 2E 2E 2E 20 20 20
2029 20 20 20 00
202D 0A 0D 20 44 49 47 MES: DB 0AH,0DH,20H,'DIGITAL VALUE=',00H
2033 49 54 41 4C 20 56
2039 41 4C 55 45 20 3D
203F 20 00
2041 BA E4 FF START: MOVW DX,0FFE4H ;Wait for Start of
2044 EC INB AL,DX ;Conversion signal
2045 E8 4F 00 CALL DELAY
2048 E8 4C 00 CALL DELAY
204B 24 02 ANDB AL,02H
204D 74 F2 JZ START
204F B8 FF 00 MOVW AX,0FFH
2052 50 PUSH AX
2053 BA E4 FF CONT: MOVW DX,0FFE4H ;Check for start
2056 EC INB AL,DX ;of Conversion signal
2057 90 NOP
2058 24 02 ANDB AL,02H
205A 75 E5 JNZ START ;If true, start again
205C 58 POP AX ;Else, continue
205D BA E0 FF MOVW DX,0FFE0H
2060 FE C0 INCB AL ;Increment Count and
2062 EE OUTB DX,AL ;output to Port
2063 50 PUSH AX
2064 52 PUSH DX
2065 2E CS
2066 8D 16 17 20 LEA DX,@MSG ;Display 'CONVERTING...'
206A 8B C2 MOVW AX,DX ;while counter is active
206C 5A POP DX
206D 9A 13 00 00 FB CALLS 0FB00:0013H
2072 E8 22 00 CALL DELAY
2075 BA E4 FF MOVW DX,0FFE4H ;Read Comparator' O/P
2078 EC INB AL,DX
2079 24 01 ANDB AL,00000001B
207B 75 D6 JNZ CON ;If PC0 = 1, continue
207D 2E CS
207E 8D 16 2D 20 LEA DX,@MES ;Else, conversion
2082 8B C2 MOVW AX,DX ;is over
2084 9A 13 00 00 FB CALLS 0FB00:0013H ;Display message
2089 58 POP AX
208A 9A 52 00 00 FB CALLS 0FB00:0052H ;Display dig. value
208F 9A 31 00 00 FB CALLS 0FB00:0031H ;Newline routine
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
22
2094 E9 AA FF JMP START
2097 B9 00 80 DELAY: MOVW CX,8000H ; Delay routine
209A E2 FE LOOP $
209C C3 RET
4.11 DEMONSTRATION PROGRAM FOR ESA-51E TRAINER
;Assume the interface is connected over J5 of the trainer.
;The trainer can be in KEYBOARD MODE or SERIAL MODE.
PUTBYTE EQU 139EH
SEG EQU E8H
SEGDIP EQU E1H
PARLOW EQU 71H
LCDOUT EQU 32AH
OUTSTG EQU 11E0H
CLRLCD EQU 03B1H
P2 EQU 0A0H
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
ORG 8000H
8000 75 A0 E8 MOV P2,#SEG ;Initialise 8255
8003 78 03 MOV R0,#03h ;in mode0
8005 74 81 MOV A,#81H ;Port A & B as O/P
8007 F2 MOVX @R0,A ;PortC as I/P
8008 79 00 START: MOV R1,#00H ;Load the starting
;count
800A 78 02 LOOP1: MOV R0,#02H ;wait for convert
;command
800C E2 MOVX A,@R0 ;Key to be pressed
800D 30 E1 FA JNB ACC.1,LOOP1 ;PC1 becomes high
8010 12 80 5C LCALL DELAY ;wait for key
;debounce delay
8013 E2 LOOP2: MOVX A,@R0 ;Key to be
;released
8014 20 E1 FC JB ACC.1,LOOP2 ;PC1 becomes low
8017 E9 LOOP3: MOV A,R1
8018 78 00 MOV R0,#0H
801A F2 MOVX @R0,A
801B 12 80 5C LCALL DELAY ;Check for
;comparator
801E 78 02 MOV R0,#02 ;i.e PC0 bit
8020 E2 MOVX A,@R0 ;If PC0 is low,
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
23
8021 30 E0 03 JNB ACC.0,FINISH ;Conversion is
8024 09 INC R1 ;over?. Otherwise
;increment
8025 80 F0 SJMP LOOP3 ;count & try again
8027 75 A0 E1 FINISH:MOV P2,#SEGDIP ;Initialise 8255
802A 78 02 MOV R0,#02H ;Read DIP switch
802C E2 MOVX A,@R0 ;if bit ACC.3 is
;set
802D 20 E3 12 JB ACC.3,KBD ;jump to KBD
;routine
;ROUTINE FOR SERIAL MODE
8030 90 80 65 SRL: MOV DPTR,#DIGMSG ;Display "digital
;value="
8033 C2 D5 CLR PSW.5
8035 12 11 E0 LCALL OUTSTG ;put the digital
;value
8038 89 71 MOV 71H,R1
803A 12 13 9E LCALL PUTBYTE
803D 75 A0 E8 MOV P2,#SEG
8040 80 C6 SJMP START ;jump to START
;ROUTINE FOR KEYBOARD MODE
8042 00 KBD: NOP
8043 C0 01 PUSH 1
8045 12 03 B1 LCALL CLRLCD ;clear LCD
8048 90 80 7A MOV DPTR,#DIGMSG1 ;Display
;"digital value="
804B C2 D5 CLR PSW.5
804D 12 03 2A LCALL LCDOUT ;put the digital
;value
8050 D0 01 POP 1
8052 89 71 MOV PARLOW,R1
8054 12 13 9E LCALL PUTBYTE
8057 75 A0 E8 MOV P2,#SEG
805A 80 AC SJMP START ;jump to START
;DELAY ROUTINE
805C 7F 25 DELAY: MOV R7,#25h
805E 7E FF LOOP: MOV R6,#FFH
8060 DE FE DJNZ R6,$
8062 DF FA DJNZ R7,LOOP
8064 22 RET
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
24
8065 0D 0A 44 49 47 DIGMSG:DB 0DH,0AH,'DIGITAL VALUE = ',00
806A 49 54 41 4C 20
806F 20 56 41 4C 55
8074 45 20 3D 20 20
8079 00
807A 44 49 47 49 54 DIGMSG1:DB 'DIGITAL VALUE = ',00
807F 41 4C 20 20 56
8084 41 4C 55 45 20
8089 3D 20 00
4.12 DEMONSTRATION PROGRAM FOR ESA 86/88E TRAINER
; Assume the interface is connected over J4 of the trainer.
; This program illustrates the use of counter method for A/D
; conversion
; The program can be executed in STAND-ALONE MODE or SERIAL
; MODE of operation.
; The program starts at memory location 0:2000H
ADDRESS OPCODE LABEL MNEMONIC COMMENTS
2000 B8 00 00 MOVW AX,0000H ;Initialise
2003 8E C8 MOVW CS,AX ;Segment Registers
2005 8E C0 MOVW ES,AX
2007 BC 00 30 MOVW SP,3000H ;Initialise Stack Ptr
200A 9A 31 00 00 FB CALLS 0FB00:0031H ;Newline routine
200F BA E6 FF MOVW DX,0FFE6H ;Initialise 8255
;Port A & PortB
2012 B0 81 MOVB AL,81H ;as output and
2014 EE OUTB DX,AL ;Port C as input
2015 EB 2A JMP START ;Display message
;strings
2017 0D 20 43 4F 4E 56 MSG: DB 0DH,20H,'CONVERTING...', 00H
201D 45 52 54 49 4E 47
2023 2E 2E 2E 20 20 20
2029 20 20 20 00
202D 0A 0D 20 44 49 47 MES: DB 0AH,0DH,20H,'DIGITAL
VALUE=',00H
2033 49 54 41 4C 20 56
2039 41 4C 55 45 20 3D
203F 20 00
2041 BA E4 FF START: MOVW DX,0FFE4H ;Wait for Start of
2044 EC INB AL,DX ;Conversion signal
2045 E8 4F 00 CALL DELAY
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
25
2048 E8 4C 00 CALL DELAY
204B 24 02 ANDB AL,02H
204D 74 F2 JZ START
204F B8 FF 00 MOVW AX,0FFH
2052 50 PUSH AX
2053 BA E4 FF CONT: MOVW DX,0FFE4H ;Check for start
2056 EC INB AL,DX ;of Conversion signal
2057 90 NOP
2058 24 02 ANDB AL,02H
205A 75 E5 JNZ START ;If true, start again
205C 58 POP AX ;Else, continue
205D BA E0 FF MOVW DX,0FFE0H
2060 FE C0 INCB AL ;Increment Count and
2062 EE OUTB DX,AL ;output to Port
2063 50 PUSH AX
2064 52 PUSH DX
2065 2E 8D 16 18 20 LEA DX,@MSG ;Display 'CONVERTING...'
206A 8B C2 MOVW AX,DX ;while counter is active
206C 5A POP DX
206D 9A 13 00 00 FB CALLS 0FB00:0013H
2072 E8 22 00 CALL DELAY
2075 BA E4 FF MOVW DX,0FFE4H ;Read Comparator'
;output
2078 EC INB AL,DX
2079 24 01 ANDB AL,00000001B
207B 75 D6 JNZ CON ;If PC0 = 1, continue
207D 2E 8D 16 2E 20 LEA DX,@MES ;Else, conversion
;is over
2082 8B C2 MOVW AX,DX
2084 9A 13 00 00 FB CALLS 0FB00:0013H ;Display message
2089 58 POP AX
208A 9A 52 00 00 FB CALLS 0FB00:0052H ;Display dig. value
208F 9A 31 00 00 FB CALLS 0FB00:0031H ;Newline routine
2094 E9 AA FF JMP START
2097 B9 00 80 DELAY: MOVW CX,8000H ; Delay routine
209A E2 FE LOOP $
209C C3 RET
5.0 DEMONSTRATION EXAMPLES FOR TEMPERATURE SENSOR
Sample programs to illustrate the operation of temperature sensor
is also provided. While using the temperature sensor simulator
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
26
the jumper JP1 is in position AB and +/-12V should not be
connected.
5.1 DEMONSTRATION PROGRAM FOR MPS 85-3 TRAINER
; Assume the interface is connected over J2 of the trainer.
; The trainer should be in KEYBOARD MODE only.
; Don't connect +12V & -12V power to the interface when
running this program.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8C00 3E 81 MVI A,81H ;Initialise 8255
;for Mode 0. PA,
8C02 D3 43 OUT CMD55 ;PB=O/P. PC=I/P.
8C04 AF LOOP1: XRA A
8C05 4F MOV C,A ;Initialise counter
;to zero.
8C06 D3 41 OUT PORTB ;Trigger the
;Monoshot.
8C08 3C INR A
8C09 D3 41 OUT PORTB
8C0B DB 42 LOOP2: IN PORTC ;Check if Monoshot
;O/P is low.
8C0D E6 04 ANI 04H
8C0F CA 19 8C JZ FINISH ;Yes display the
;result.
8C12 0C INR C ;Increment the
;counter.
8C13 CA 30 8C JZ MSG ;If the count>FF
;display Message
;`br'on the trainer.
8C16 C3 0B 8C JMP LOOP2 ;Repeat the process.
8C19 79 FINISH: MOV A,C ;Move the counter
;to Accr.
8C1A 32 F1 8F STA CURDT ;Store the count
;in reserved loc.
8C1D CD 4C 04 CALL UPDDT ;Display the count.
8C20 CD 26 8C LOOP3: CALL DELAY ;Wait for some time
8C23 C3 04 8C JMP LOOP1
8C26 21 FF FF DELAY: LXI H,0FFFFH ;Delay routine.
8C29 2B BACK: DCX H
8C2A 7D MOV A,L
8C2B B4 ORA H
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
27
8C2C C2 29 8C JNZ BACK
8C2F C9 RET
8C30 3E 01 MSG: MVI A,01H ;Use data field.
8C32 06 00 MVI B,00H ;No dot.
8C34 21 3D 8C LXI H,STRG ;Initialise HL pair
;to location where
;offset for chrs
;to be displayed
;is stored.
8C37 CD 89 03 CALL OUTPUT ;Display the chrs.
8C3A C3 20 8C JMP LOOP3 ;Repeat the process
8C3D 0B 14 STRG: DB 0BH,14H
5.2 DEMONSTRATION PROGRAM FOR ESA 85-2 TRAINER
; Assume the interface is connected over J2 of the trainer.
; The trainer should be in KEYBOARD MODE only.
; Don't connect +12V & -12V power to the interface when
running this program.
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8000 3E 81 MVI A,81H ;Initialise 8255
;for Mode 0. PA,
8002 D3 43 OUT CMD55 ;PB=O/P. PC=I/P.
8004 AF LOOP1: XRA A
8005 4F MOV C,A ;Initialise counter
;to zero.
8006 D3 41 OUT PORTB ;Trigger the
;Monoshot.
8008 3C INR A
8009 D3 41 OUT PORTB
800B DB 42 LOOP2: IN PORTC ;Check if Monoshot
;O/P is low.
800D E6 04 ANI 04H
800F CA 19 80 JZ FINISH ;Yes display the
;result.
8012 0C INR C ;Increment the counter
8013 CA 30 80 JZ MSG ;If the count>FF
;display Message
;`br'on the trainer.
8016 C3 0B 80 JMP LOOP2 ;Repeat the process.
8019 79 FINISH: MOV A,C ;Move the counter
;to Accr.
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
28
801A 32 75 FE STA CURDT ;Store the count
;in reserved loc.
801D CD 78 05 CALL UPDDT ;Display the count.
8020 CD 26 80 LOOP3: CALL DELAY ;Wait for some time
8023 C3 04 80 JMP LOOP1
8026 21 FF FF DELAY: LXI H,0FFFFH ;Delay routine.
8029 2B BACK: DCX H
802A 7D MOV A,L
802B B4 ORA H
802C C2 29 80 JNZ BACK
802F C9 RET
8030 3E 01 MSG: MVI A,01H ;Use data field.
8032 06 00 MVI B,00H ;No dot.
8034 21 3D 80 LXI H,STRG ;Initialise HL pair
;to location where
;offset for chrs
;to be displayed
;is stored.
8037 CD E3 04 CALL OUTPUT ;Display the chrs.
803A C3 20 80 JMP LOOP3 ;Repeat the process
803D 0B 14 STRG: DB 0BH,14H
5.3 DEMONSTRATION PROGRAM FOR ESA-31 TRAINER
; Assume the interface is connected over J2 of the trainer
; The trainer should be in KEYBOARD MODE
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
8000 90 E8 03 MOV DPTR,#E803 ;Initialise 8255
;for Mode 0.
;PA, PB=Output
8003 74 81 MOV A,#81H ;PC=Input
8005 F0 MOVX @DPTR,A
8006 E4 LOOP1: CLR A
8007 FD MOV R5,A ;Initialise counter
;to 0
8008 90 E8 01 MOV DPTR,#E801
800B F0 MOVX @DPTR,A ;Trigger the monoshot
800C 04 INC A
800D F0 MOVX @DPTR,A
800E 90 E8 02 MOV DPTR,#E802
8011 E0 LOOP2: MOVX A,@DPTR ;Check if monoshot
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
29
;O/P is low.
8012 54 04 ANL A,#04
8014 60 06 JZ FINISH ;Yes display the
;result.
8016 0D INC R5 ;Increment the
;counter.
8017 BD 00 F7 CJNE R5,#00,LOOP2;If the count is
;>FF display the
;message `br' on
801A 80 12 SJMP MSG ;trainer else
;repeat the process
801C 75 0B 00 FINISH: MOV B,#00 ;Clears the entire
801F 78 60 MOV R0,#60 ;Display & display
8021 ED MOV A,R5 ;the digital value
8022 F6 MOV @R0,A ;on the data field
8023 12 01 70 LCALL 0170H ;of the kit.
8026 12 01 9B LCALL 019BH
8029 11 39 LOOP3: ACALL DELAY ;Wait for some time
802B 80 D9 SJMP LOOP1 ;Repeat the process
802D 00 NOP
802E C2 F0 MSG: CLR 0F0H ;Displays the
8030 90 90 00 MOV DPTR,#Data ;message `br' on
8033 12 02 55 LCALL 0255H ;the data field.
8036 80 F1 SJMP LOOP3 ;Repeat the process
8038 00 NOP
8039 7B FF DELAY: MOV R3,#0FF ;Delay routine.
803B 7A FF L2: MOV R2,#0FF
803D 1A L1: DEC R2
803E BA 00 FC CJNE R2,#00,L1
8041 1B DEC R3
8042 BB 00 F6 CJNE R3,#00,L2
8045 22 RET
9000: Data: DB 00,00,00,00,C7,05,00.
5.4 DEMONSTRATION PROGRAM FOR ESA 86/88-2 TRAINER
; Assume the interface is connected over J4 of the trainer.
; The trainer should be in KEYBOARD MODE
ADDRESS OPCODE LABLE MNEMONIC COMMENTS
2000 BC 00 30 MOVW SP,#3000 ;Initialise SP
2003 B0 81 MOVB AL,#81 ;Initialise
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
30
2005 BA E6 FF MOVW DX,#0FFE6 ;8255 for
;mode 0.PA,PB
;as O/P. PC as
;I/P.
2008 EE OUTB DX
2009 31 C0 LOOP1: XORW AX,AX
200B 88 C1 MOVB CL,AL ;Initialise the
;counter to 0.
200D 88 0E 70 20 MOVB 2070,CL ;Move the count
;to the memory
;location.
2011 BA E2 FF MOVW DX,#0FFE2
2014 EE OUTB DX ;Trigger the
;monoshot.
2015 40 INCW AX
2016 BA E2 FF MOVW DX,#0FFE2
2019 EE OUTB DX
201A BA E4 FF LOOP2: MOVW DX,#0FFE4
201D EC INB DX ;Check if monoshot
;O/P is low.
201E 24 04 ANDB AL,#04
2020 74 0A JE FINISH ;Yes display the
;result.
2022 FE C1 INCB CL ;Increment the
;counter.
2024 74 1C JE MSG ;If the count is
;>FF display the
;message `br' on
;trainer else
2026 88 0E 70 20 MOVB 2070,CL ;Move the count
;to the memory
202A EB EE JMP LOOP2 ;Repeat the
;process
202C B0 00 FINISH: MOVB AL,#00 ;Blanks the
;address
202E 9A 05 0B 00 FF CALLS 0B05,0FF00 ;field with no
;prompts.
2033 A0 70 20 MOVB AL,2070 ;Move the count
;to Accr.
2036 B4 00 MOVB AH,#00 ;Display the
;count.
2038 9A 0A 0B 00 FF CALLS 0B0A,0FF00 ;In data field
;with no prompts
203D E8 1C 00 LOOP3: CALL DELAY ;Wait for some
;time
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
31
2040 EB C7 JMP LOOP1
2042 B0 00 MSG: MOVB AL,#00 ;Blanks the
;address
2044 9A 05 0B 00 FF CALLS 0B05,0FF00 ;field with no
;prompts.
2049 B8 00 00 MOVW AX,#0000 ;Disply the
;message
204C 8E C0 MOVW ES,AX ;br' in the
204E BB 67 20 MOVW BX,STRG ;data field.
2051 B0 00 MOVB AL,#00 ;The characters
2053 B4 00 MOVB AH,#00 ;to be displayed
;are in the
;location "STRG".
2055 9A 31 0B 00 FF CALLS 0B31,0FF00
205A EB E1 JMP LOOP3 ;Repeat the process
205C BB FF FF DELAY: MOVW BX,#0FFFF ;Delay routine.
205F E0 FE BACK1: LOOPNZ BACK1
2061 BB FF FF DELAY: MOVW BX,#0FFFF
2064 E0 FE BACK2: LOOPNZ BACK2
2066 C3 RET
2067 7C 50 STRG: DB 7C 50
2069 00 00 DB 00 00
4.8 DEMONSTRATION PROGRAM FOR ESA-51 TRAINER
;Assume the interface is connected over J10 of the trainer.
;The trainer can be in KEYBOARD MODE or SERIAL MODE.
OUTPUT EQU 0404H
CLRLCD EQU 03BBH
PUTBYTE EQU 13D2H
OUTCHR EQU 11A8H
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
8000 ORG 8000H
8000 90 E8 03 MOV DPTR,#E803H ;Initialise 8255 in
8003 74 81 MOV A,#81H ;mode 0, PA&PB as O/P
8005 F0 MOVX @DPTR,A ;PC as I/P
8006 E4 LOOP1: CLR A ;Initialise counter
8007 FD MOV R5,A ;to 0
8008 90 E8 01 MOV DPTR,#E801H
800B F0 MOVX @DPTR,A ;Trigger the Monoshot
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
32
800C 04 INC A
800D F0 MOVX @DPTR,A
800E 90 E8 02 MOV DPTR,#E802H ;Check if Monoshot
8011 E0 LOOP2: MOVX A,@DPTR ;O/P is low
8012 54 04 ANL A,#04
8014 60 06 JZ FINISH ;Yes, display the
;result
8016 0D INC R5 ;Increment the counter
8017 BD 00 F7 CJNE R5,#00,LOOP2 ;If the count>FF,
801A 80 1C SJMP MSG ;display message 'BR'
801C ED FINISH:MOV A,R5 ;Clears entire display
801D F5 71 MOV 71H,A ;display digital value
801F 90 E9 04 MOV DPTR,#E904H
8022 E0 MOVX A,@DPTR
8023 30 E3 05 JNB ACC.3,OUT1
8026 12 03 BB LCALL CLRLCD
8029 80 05 SJMP OUT2
802B 74 0D OUT1: MOV A,#0DH
802D 12 11 A8 LCALL OUTCHR
8030 12 13 D2 OUT2: LCALL PUTBYTE
8033 11 4D LOOP3: ACALL DELAY
8035 80 CF SJMP LOOP1
8037 00 NOP
8038 90 E9 04 MSG: MOV DPTR,#E904H ;Display the
803B E0 MOVX A,@DPTR ;message 'BR'
803C 30 E3 03 JNB ACC.3,OUT
803F 12 03 BB LCALL CLRLCD
8042 C2 F0 OUT: CLR PSW.5
8044 90 80 56 MOV DPTR,#STG
8047 12 04 04 LCALL OUTPUT
804A 80 E7 BACK: SJMP LOOP3
804C 00 NOP
804D 7B FF DELAY: MOV R3,#0FFH ;delay routine
804F 7A FF L2: MOV R2,#0FFH
8051 DA FE DJNZ R2,$
8053 DB FA DJNZ R3,L2
8055 22 RET
8056 0D 42 52 STG: DB 0DH,'BR',0DH,00H
8059 0D 00 DB 0DH,00H'
5.6 DEMONSTRATION PROGRAM FOR ESA 86/88-3 TRAINER
; Assume the interface is connected over J8 of the trainer.
; The output of the program can be observed on the PC
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
33
; console in serial mode or on the LCD in stand-alone mode of
; operation.
; The program can be executed in STAND-ALONE MODE or SERIAL
; MODE of operation.
; The program starts at memory location 0:2000H
; Please refer ESA 86/88-3 user's manual for mnemonic syntax
; suitable to trainer
Code Segment :0000H
ADDRESS OPCODE LABEL MNEMONIC COMMENTS
2000 B8 00 00 MOVW AX,0000H ;Initialise
2003 8E C0 MOVW ES,AX ;segment
2005 8B C8 MOVW CX,AX ;registers
2007 BA E6 FF MOVW DX,0FFE6H ;Initialise
;8255 Port A
200A B0 81 MOVB AL,81H ;and B as
200C EE OUTB DX,AL ;O/P & Port
;C as I/P
200D 9A 31 00 00 FB CALLS 0FB00:0031H ;Newline routine
2012 EB 15 JMP START
2014 0D 44 49 47 49 54 MES: DB 0DH,'DIGITAL OUTPUT - ',0H
;Display string
201A 41 4C 20 4F 55 54
2020 50 55 54 20 2D 20
2026 20 00
2028 00
2029 2E CS
202A 8D 16 14 20 START:LEA DX,@MES ;Display message
202E 8B C2 MOVW AX,DX ;on LCD or
;console
2030 9A 13 00 00 FB CALLS 0FB00:0013H ;adjustment
2035 BA E2 FF TRIG: MOVW DX,0FFE2H ;Trigger the
;monoshot
2038 B8 00 00 MOVW AX,00H ;multivibrator
203B 8B D8 MOVW BX,AX ;Initialise
203D EE OUTB DX,AL ;counter
203E 90 NOP
203F FE C0 INCB AL
2041 EE OUTB DX,AL
2042 BA E4 FF NEXT: MOVW DX,0FFE4H
2045 EC INB AL,DX ;Check if
2046 24 04 ANDB AL,04H ;monoshot o/p
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
34
2048 74 06 JZ DISP ;is low. If
;yes, display
;the result
204A FE C3 INCB BL ;Else increment
;increment count
204C 74 11 JZ BREAK ;If count >
;FFh, then
204E EB F2 JMP NEXT ;display 'BR'
;Else, continue
2050 E8 23 00 DISP: CALL CLR ;Clear previous
;value
2053 8B C3 MOVW AX,BX ;Load count value
2055 9A 52 00 00 FB CALLS 0FB00:0052H ;&output the same
205A E8 40 00 CALL DELAY
205D EB D6 JMP TRIG ;Repeat the
;process
205F E8 14 00 BREAK: CALL CLR ;Routine to
2062 B8 42 52 MOVW AX,5242H ;display 'BR'
2065 9A 00 00 00 FB CALLS 0FB00:0H
206A 8A C4 MOVB AL,AH
206C 9A 00 00 00 FB CALLS 0FB00:0H
2071 E8 29 00 CALL DELAY
2074 EB BF JMP TRIG ;Repeat the
;process
2076 BA ED FF CLR: MOVW DX,0FFEDH ;Check mode
;of trainer
2079 EC INB AL,DX ;operation
207A 24 10 ANDB AL,10H ;If trainer
207C 74 12 JZ SRL ;is in stand
;-alone mode
207E 9A 35 01 00 FB CALLS 0FB00:0135H ;clear the
2083 2E CS ;LCD &output
2084 8D 16 14 20 LEA DX,@MES ;message again
2088 8B C2 MOVW AX,DX
208A 9A 13 00 00 FB CALLS 0FB00:0013H
208F C3 RET
2090 B0 08 SRL:MOVB AL,08H ;If trainer
2092 9A 00 00 00 FB CALLS 0FB00:0000H ;is in serial
2097 9A 00 00 00 FB CALLS 0FB00:0000H ;mode, clear
209C C3 RET ;previous O/P
209D B9 FF FF DELAY:MOVW CX,0FFFFH ;Delay b/w
20A0 E2 FE LOOP $ ;successive
20A2 C3 RET ;outputs
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
35
5.7 DEMONSTRATION PROGRAM FOR ESA-51E TRAINER
;Assume the interface is connected over J5 of the trainer.
;The trainer can be in KEYBOARD MODE or SERIAL MODE.
OUTPUT EQU 03FAH
CLRLCD EQU 03B1H
PUTBYTE EQU 139EH
OUTCHR EQU 11AEH
ADDRESS OPCODE LABEL MNEMONICS COMMENTS
8000 ORG 8000H
8000 90 E8 03 MOV DPTR,#E803H ;Initialize 8255
8003 74 81 MOV A,#81H ;in mode 0, PA&PB
8005 F0 MOVX @DPTR,A ;as O/P PC as I/P
8006 E4 LOOP1: CLR A ;Initialize
8007 FD MOV R5,A ;counter to 0
8008 90 E8 01 MOV DPTR,#E801H
800B F0 MOVX @DPTR,A ;Trigger the
;Monoshot
800C 04 INC A
800D F0 MOVX @DPTR,A
800E 90 E8 02 MOV DPTR,#E802H ;Check if Monoshot
8011 E0 LOOP2: MOVX A,@DPTR ;O/P is low
8012 54 04 ANL A,#04
8014 60 06 JZ FINISH ;Yes, display the
;result
8016 0D INC R5 ;Increment the
;counter
8017 BD 00 F7 CJNE R5,#00,LOOP2 ;If the count>FF,
801A 80 1C SJMP MSG ;display message
;'BR'
801C ED FINISH:MOV A,R5 ;Clears entire
;display
801D F5 71 MOV 71H,A ;display digital
;value
801F 90 E1 02 MOV DPTR,#E102H
8022 E0 MOVX A,@DPTR
8023 30 E3 05 JNB ACC.3,OUT1
8026 12 03 B1 LCALL CLRLCD
8029 80 05 SJMP OUT2
802B 74 0D OUT1: MOV A,#0DH
802D 12 11 AE LCALL OUTCHR
8030 12 13 9E OUT2: LCALL PUTBYTE
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
36
8033 11 4D LOOP3: ACALL DELAY
8035 80 CF SJMP LOOP1
8037 00 NOP
8038 90 E1 02 MSG: MOV DPTR,#E102H ;Display the
803B E0 MOVX A,@DPTR ;message 'BR'
803C 30 E3 03 JNB ACC.3,OUT
803F 12 03 B1 LCALL CLRLCD
8042 C2 D5 OUT: CLR PSW.5
8044 90 80 56 MOV DPTR,#STG
8047 12 03 FA LCALL OUTPUT
804A 80 E7 BACK: SJMP LOOP3
804C 00 NOP
804D 7B FF DELAY: MOV R3,#0FFH ;delay routine
804F 7A FF L2: MOV R2,#0FFH
8051 DA FE DJNZ R2,$
8053 DB FA DJNZ R3,L2
8055 22 RET
8056 0D 42 52 0D 00 STG: DB 0DH,'BR',0DH,00H
5.8 DEMONSTRATION PROGRAM FOR ESA 86/88E TRAINER
; Assume the interface is connected over J4 of the trainer.
; The output of the program can be observed on the PC
; console in serial mode or on the LCD in stand-alone mode of
; operation.
; The program can be executed in STAND-ALONE MODE or SERIAL
; MODE of operation.
; The program starts at memory location 0:2000H
; Please refer ESA 86/88E user's manual for mnemonic syntax
; suitable to trainer
Code Segment :0000H
ADDRESS OPCODE LABEL MNEMONIC COMMENTS
2000 B8 00 00 MOVW AX,0000H ;Initialise
2003 8E C0 MOVW ES,AX ;segment
2005 8B C8 MOVW CX,AX ;registers
2007 BA E6 FF MOVW DX,0FFE6H ;Initialise
;8255 Port A
200A B0 81 MOVB AL,81H ;and B as
200C EE OUTB DX,AL ;O/P & Port
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
37
;C as I/P
200D 9A 31 00 00 FB CALLS 0FB00:0031H ;Newline routine
2012 EB 15 JMP START
2014 0D 44 49 47 49 54 MES: DB 0DH,'DIGITAL OUTPUT - ',0H
;Display string
201A 41 4C 20 4F 55 54
2020 50 55 54 20 2D 20
2026 20 00
2028 00
2029 2E CS
202A 8D 16 14 20 START:LEA DX,@MES ;Display message
202E 8B C2 MOVW AX,DX ;on LCD or
;console
2030 9A 13 00 00 FB CALLS 0FB00:0013H ;adjustment
2035 BA E2 FF TRIG: MOVW DX,0FFE2H ;Trigger the
;monoshot
2038 B8 00 00 MOVW AX,00H ;multivibrator
203B 8B D8 MOVW BX,AX ;Initialise
203D EE OUTB DX,AL ;counter
203E 90 NOP
203F FE C0 INCB AL
2041 EE OUTB DX,AL
2042 BA E4 FF NEXT: MOVW DX,0FFE4H
2045 EC INB AL,DX ;Check if
2046 24 04 ANDB AL,04H ;monoshot o/p
2048 74 06 JZ DISP ;is low. If
;yes, display
;the result
204A FE C3 INCB BL ;Else increment
;increment count
204C 74 11 JZ BREAK ;If count >
;FFh, then
204E EB F2 JMP NEXT ;display 'BR'
;Else, continue
2050 E8 23 00 DISP: CALL CLR ;Clear previous
;value
2053 8B C3 MOVW AX,BX ;Load count value
2055 9A 52 00 00 FB CALLS 0FB00:0052H ;&output the same
205A E8 40 00 CALL DELAY
205D EB D6 JMP TRIG ;Repeat the
;process
205F E8 14 00 BREAK: CALL CLR ;Routine to
2070 B8 42 52 MOVW AX,5242H ;display 'BR'
2073 9A 00 00 00 FB CALLS 0FB00:0H
DAC FOR ADC AND TEMPERATURE SENSOR INTERFACE
38
2078 8A C4 MOVB AL,AH
207A 9A 00 00 00 FB CALLS 0FB00:0H
207F E8 2A 00 CALL DELAY
2082 EB BF JMP TRIG ;Repeat the
;process
2085 BA ED FF CLR: MOVW DX,0FFEDH ;Check mode
;of trainer
2088 EC INB AL,DX ;operation
2089 24 10 ANDB AL,10H ;If trainer
208B 74 12 JZ SRL ;is in stand
;-alone mode
208D 9A 35 01 00 FB CALLS 0FB00:0135H ;clear the
2092 2E CS ;LCD &output
2092 8D 16 14 20 LEA DX,@MES ;message again
2097 8B C2 MOVW AX,DX
2099 9A 13 00 00 FB CALLS 0FB00:0013H
209E C3 RET
209F B0 08 SRL:MOVB AL,08H ;If trainer
20A1 9A 00 00 00 FB CALLS 0FB00:0000H ;is in serial
20A6 9A 00 00 00 FB CALLS 0FB00:0000H ;mode, clear
20AB C3 RET ;previous O/P
20AC B9 FF FF DELAY:MOVW CX,0FFFFH ;Delay b/w
20AF E2 FE LOOP $ ;successive
20B1 C3 RET ;outputs