Micro TMA2 2015-15
Q1
stepper vs servo
www.festo.com/net/hu_hu/SupportPortal/Downloads/10446
http://www.ni.com/white-paper/3656/en/
stepper motor control
https://electrosome.com/stepper-motor-pic-microcontroller/
servo motor control
https://electrosome.com/interfacing-servo-motor-with-8051-using-keil-c/
Q2
(a)
ADC
http://www.ti.com/product/ads8528
http://www.ti.com/product/adc0848
http://www.ti.com/product/ads1602
DAC
http://www.ti.com/product/dac0808
http://www.ti.com/product/dac7725
http://www.ti.com/product/dac8760
(b)
R-2R DAC
link (http://en.wikipedia.org/wiki/Resistor_ladder#R2R_resistor_ladder_network_.28digital_to_analog_conversion.2C_or_DAC.29)
Answer:
(C)
Vref = 16V
10V
Vref
V in
Digital
output
V out
8 lines
P1
P2
8 lines
Digital
input
ADC
DAC
CS
RD
WR
int
P3.7
P3.6
P3.5
P3.4
8051
P2
P3.1
P3.2
P3.3
8 lines
7 seg. Display
(Digit1)
7 seg. Display
(Digit2)
Digital input to get 10V out from the 8bit DAC
Assumptions: ADC0801 and DAC0801 are used
7 seg. Display
(Digit0)
(d)
Start
To get 10V Output voltage from
DAC
Set P2 = 160D
Configure ADC
CS = 0
WR = change form low to high
Check INT
(from ADC)
no
If INT = 0
yes
CS =0;
RD = from high to low
Copy Port1 to
Accumulator
Multiply
Accumulator by 2D
Separate digits into
positional values
If no. of digits to be
displayed = 0?
Select seven
segment display
pattern form lookup
table
Switch on relevant
transistor
Send display pattern
to Port0
Wait for a delay
First divide by 100, then divide the
remainder by 10 and take result and
remainder as positional values
(e)
Q2 e- ADC
PAGE 1
00B7
00B6
00B5
00B4
00B3
00B2
00B1
0000 7590FF
0003 75A07F
0006 900064
0009
000B
000D
000F
0011
0014
0016
0018
C2B7
D2B6
C2B5
D2B5
30B4FD
C2B7
C2B6
E590
001A 75F002
001D A4
001E
0021
0022
0023
0025
0028
unit
0029
002A
75F064
84
FA
E5F0
75F00A
84
posotion
F9
A8F0
002C
002E
002F
0031
0033
C2B3
EA
1162
F580
1152
0035 75807F
0038 1152
003A
003B
003D
003F
0041
0043
E9
D2B3
C2B2
1162
F580
1152
0045
0046
0048
004A
004C
004E
E8
D2B2
C2B1
1162
F580
1152
0050 80B7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
;-------------Assign control pins of ADC0801 to port3-----------CS1
BIT P3.7
RD1
BIT P3.6
WR1
BIT P3.5
INT
BIT P3.4
D3
D2
D1
BIT P3.3
BIT P3.2
BIT P3.1
ORG
MOV
MOV
MOV
0h
P1, #0FFh
P2, #07Fh
DPTR,#Table
CLR
SETB
CLR
SETB
JNB
CLR
CLR
MOV
CS1
RD1
WR1
WR1
INT, Wait
CS1
RD1
A, P1
;CS =0
;RD =1
;MOV
;DIV
MOV
MUL
B, #10D
AB
B, #2D
AB
;load 10 to B
;devide A by 10
;load 2 to B
;multiply A by 2
MOV
DIV
MOV
MOV
MOV
DIV
B,#100D
AB
R2, A
A, B
B, #10D
AB
;load 100 to B
MOV
MOV
R1, A
R0, B
;load 10th position digit to R1
;load unit position digit to R0
CLR
MOV
ACALL
MOV
ACALL
D3
A,R2
Display
P0,A
Delay
;Turn on Digit3 SSD
MOV
ACALL
P0,#01111111B
Delay
;Turn on decimal point
MOV
SETB
CLR
ACALL
MOV
ACALL
A,R1
D3
D2
Display
P0, A
Delay
;load
;turn
;turn
;load
MOV
SETB
CLR
ACALL
MOV
ACALL
A,R0
D2
D1
Display
P0,A
Delay
;load unit position digit
;turn off digit 2 SSD
;turn on Digit 1 SSD
SJMP
Main
; set PORT1 as input
;send 160 to DAC to make 10V output
;send DPTR to lookup table
Main:
Wait:
;set WR low to high
; wait for interrupt set
; set RD high to low
;copy ADC value to A
;load 100th position digit to R2
;move remainder to A
;now A has 10th position digit and B has
;load SSD pattern to A from lookup table
;Send SSD pattern to SSD
10th position digit
off Digit 3 SSD
on Digit 2 SSD
SSD pattern to A from lookup table
65
Delay:
66
MOV
TH0, #0F8h
67
MOV
TL0, #030h
68
SETB
TR0
69
JNB
TF0,$
70
CLR
TR0
71
CLR
TF0
72
RET
73
74
Display:
0062 93
75
MOVC
A,@A+DPTR
0063 22
76
RET
77
78
Table:
0064 C0
79
DB
0C0h
;zero
0065 F9
80
DB
0F9h
;one
0066 A4
81
DB
0A4h
;two
0067 B0
82
DB
0B0h
;three
0068 99
83
DB
099h
;four
0069 92
84
DB
092h
;five
006A 82
85
DB
082h
;six
006B F8
86
DB
0F8h
;seven
006C 80
87
DB
080h
;eight
006D 98
88
DB
098h
;nine
89
90
END
ASSEMBLY COMPLETE, NO ERRORS FOUND, NO WARNINGS
0052
0055
0058
005A
005D
005F
0061
;2ms delay
758CF8
758A30
D28C
308DFD
C28C
C28D
22
;read values from lookup table
Q3
(a)
(
(
(
( )
For 9600bps baud rate
)
)
)
(b)
This ALP is for x =2 (2ms delay), change the delay time(R1, R2, R3 values)according to your x value.
q3b
PAGE 1
0000
0003
0006
0009
000B
758920
758DFD
759850
D28E
90002C
000E
000F
0010
0012
0013
0015
E4
93
1117
A3
111F
80F7
0017
0019
001C
001E
F599
3099FD
C299
22
001F
0021
0023
0025
0027
0029
002B
7B1A
7A0A
7906
D9FE
DAFA
DBF6
22
002C 40524D4F56
202B353030
3030
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
ORG
MOV
MOV
MOV
SETB
MOV
0h
TMOD,#20H
TH1,#0FDH
SCON,#50H
TR1
DPTR,#MYDATA
CLR
MOVC
ACALL
INC
ACALL
SJMP
A
A,@a+dptr
SEND
DPTR
DELAY
Main
;timer 1, mode 2
;9600 baud rate
;8-bit, 1 stop, REN enabled
;start timer 1
Main:
;get the character
;next one
;call 2ms delay
;----serial data transfer. -----SEND:
MOV
SBUF,A
;load the data
L1:
JNB
TI,L1
;stay here until complete
CLR
TI
;get ready for next char
RET
;----2ms delay ------DELAY: MOV
R3,#26
LOOP1: MOV
R2,#10
LOOP2: MOV
R1,#6
LOOP3: DJNZ
R1,LOOP3
DJNZ
R2,LOOP2
DJNZ
R3,LOOP1
RET
;-----The string--------------MYDATA:
DB
'@RMOV +50000'
END
ASSEMBLY COMPLETE, NO ERRORS FOUND, NO WARNINGS
Q4
(a)
WDT
http://www.embedded.com/electronics-blogs/beginner-s-corner/4023849/Introduction-to-Watchdog-Timers
(b)
PWM freq = 40kHz
For 25% Duty Cycle :
6.25
18.75
25us
Similarly for 50% DC and 75% DC