You are on page 1of 171

2


..2553
()

Peristaltic Pump 2

Mr. Goson
Mr. Thanakorn
Mr. Amata

Chaisalee
Keatteppawan
Chamunghatthapong

Project report submitted in partial fulfillment of requirement for the bachelors degree
Department of Mechanical and Aerospace Engineering
Faculty of Engineering
King Mongkuts University of Technology North Bangkok
ACADEMIC YEAR 2010

()

-
..
2553

50-1006-301-3
50-1006-015-9
50-1006-117-3

(.. )
-

(.. )

()

(.. )

()

(.. )

()

(. )

()

()

Project Title
By

Peristaltic Pump 2
Mr. Goson
Chaisalee
50-1006-301-3
Mr. Thanakorn Keatteppawan
50-1006-015-9
Mr. Amata
Chamunghatthapong
50-1006-117-3
Department
Mechanical and Aerospace Engineering
Project Advisor Assoc.Prof.Dr. Thanu Chouychai
Academic year 2010
___________________________________________________________________________
Accepted by Department of Mechanical and Aerospace Engineering,
Faculty of Engineering, King Mongkuts University of Technology North Bangkok in
Partial Fulfillment of the Requirements for the Bachelors Degree in Mechanical
Engineering.
.
(Asst.Prof.Dr.Arisara Chaikittiratna)
Acting Head of Department of Mechanical and Aerospace Engineering
Project Examination Committee
.

(Assoc.Prof.Dr. Thanu Chouychai)

(Chairman)

(Assoc.Prof.Dr. Sirisak Harnchoowong)

(Committee member)

(Assoc.Prof.Dr. Pudit Laksanacharoen)

(Committee member)

(Dr. Petch Jearanaisilawong)

(Committee member)

()


(Peristaltic Pump)







(PWM)
ADuC847


(Duty cycle)

2


5

()

Abstract
The objective of this project is study principle of Peristaltic pump to produce a
machine for transporting chemical fluid in experimental laboratory. Microcontroller is
used to control motor for transporting as desirable flow rate. The flow rate is adjustable
by keypad and show working status via LCD.
The operation of this machine starts from Microcontroller send data to LCD for
showing functions of working. There is function in this machine used for transporting with
adjustable flow rate. The direction of rotating is adjustable. Moreover, for convenient this
Peristaltic pump can be set working time for being used in each experiment. Keypad is
used to elect functions then Microcontroller evaluates and sends control signal to rotate
motor as desirable functions.
To control speed of motor is defined by PWM signal of Microcontroller. The
Microcontroller that is used for this project is ADuC847. This Microcontroller also has
PWM signal so it can be set to send PWM signal via programming. The principle of PWM
signal is Duty-cycle adjustment of signal; speed of motor increases as high Duty-cycle
that is set from programming.
The Peristaltic pump's project has already made. Whenever,in the project uses
some principle of Peristaltic pump from first one. That Peristaltic pumps knowledge be
used for modifying to upgrade Peristaltic pump. This modify Peristaltic pump which be
made it has more efficiency and more quality than old one in every ways
A machine from this project is cheaper than import about 5 times. This machine
will be used in Industrial Chemistry Department, Faculty of Applied Science; King
Mongkuts University of Technology North Bangkok and will be a prototype for
producing a machine like this for our country in the future.

()

()

..
.
..
.
...
.

1. ....1
1.1.
1
1.2.
1
1.3.
2
2 . .3
2.1.
3
2.2.
5
2.3.
9
2.4. (Planetary Gear)
10
2.5. ADuC847
11
2.6. ADuC847
19
2.7. core 8051
19
2.8.
20
2.9. (SFRs)
20
2.10. PWM (PULSE-WIDTH MODULATOR)
21
2.11. TIME INTERVAL COUNTER (TIC)
24
2.12. TIMERS/COUNTERS
27
2.13. (LCD)
30
()

( )
2.14.
32
3. .38
3.1.
38
3.2.
50
3.3.
61
3.4.
85
4.

92
4.1.
92
4.2.
117
5.....................................................................................................120
5.1.
120
5.2.
121
.122
. ....123
. ...............................................................139

()

2.1.
2.2.
2.3.
2.4.
2.5. 4
2.6.
2.7.
2.8.
2.9.
2.10. Planetary Gear
2.11. ADuC847
2.12. AduC847 52-MQFP
2.13.
2.14.
2.15. TIME INTERVAL COUNTER (TIC)
3.1.
3.2. 24
3.3.
3.4. LM2576SX-5.0
3.5. 9
3.6.
3.7. 24 V
3.8.
3.9.
()


3
4
5
5
6
7
7
9
10
11
12
12
20
21
24
42
43
43
44
44
45
45
46
46

( )

3.10.
3.11.
3.12.
3.13.
3.14. ()
3.15.
3.16.
3.17.
3.18.
3.19.
3.20.
3.21.
3.22.
3.23.
3.24.
3.25.
3.26.
3.27.
3.28.
3.29.
3.30.
3.31.
3.32.
3.33.
3.34. ( )
3.35. ADuC847
()


46
47
47
48
48
49
49
49
50
50
50
51
52
52
53
53
54
54
55
56
57
58
59
60
60
61

( )

3.36. ADuC847
3.37. ADuC847
3.38.
ADuC847
3.39. ADuC847
3.40
ADuC847
3.41.
ADuC847
3.42.
ADuC847
3.43. ADuC847
3.44.
3.45. NAND Gate
3.46. PWM=0 IN1=0
3.47. PWM=0 IN1=1
3.48. PWM=1 IN1=0
3.49. PWM=1 IN1=1
3.50. LTV 847
3.51. LTV 847
3.52. LTV 847
3.53. EN, C, D =0
3.54. EN=1
3.55. L298Driver
3.56. L298Driver
3.57. L298Driver
()


62
63
64
65
65
66
66
67
68
68
69
69
70
70
71
71
71
72
72
73
73
73

( )


3.58.
74
3.59.
74
3.60.
74
3.61.
75
3.62.
75
3.63.
75
3.64.
76
3.65.
76
3.66.
76
3.67.
77
3.68.
79
3.69. DK-KEY-4x3-001-V1
80
3.70.
81
3.71.
82
3.72.
82
3.73. 83
3.74.
83
3.75.
84
3.76. RS232
85
3.77. RS232
85
3.78.
85
3.79.
86
3.80.
87
3.81.
87
3.82.
88
3.83.
89
()

( )

3.84.
3.85.
3.86.
3.87.
3.88.
3.89.
4.1.
4.2.
4.3. 4.1
4.4. 4.2
4.5. 4.3
4.6. 4.4
4.7. 4.5
4.8. 4.6
4.9. 4.7
4.10. 4.8
4.11. 4.9
4.12. 4.10
4.13. 4.11
4.14. 4.12
4.15. 4.13
4.16. 4.14
4.17. 4.15
4.18. 4.16
4.19. 4.17
()


89
90
90
90
91
91
92
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

( )

4.20. 4.18
4.21. 4.19
4.22. 4.20
4.23. 4.21
4.24. 4.22
4.25. 4.23
4.26. 4.24
4.27.
4.28. 2
4.29. 3

4.30. 4
4.31. 5

()


110
111
112
113
114
115
116
117
117
118
118
119

2.1.
2.2. PWMCON
2.3. PWM0H (PWM Pulse Width High Byte)
2.4. PWM0L (PWM Pulse Width Low Byte)
2.5. PWM1H (PWM Cycle Width High Byte)
2.6. PWM1L (PWM Cycle Width Low Byte)
2.7. TIMECON
2.8. TMOD
2.9. TCON
2.10.
2.11. 1 2
3.1. Triethanoamine
3.2. Triethanoamine(C6H15NO3)
3.3. PWM=0 IN1=0
3.4. PWM=0 IN1=1
3.5. PWM=1 IN1=0
3.6. PWM=1 IN1=1
3.7.
3.8.
3.9. DK-KEY-4x3-001-V1
3.10.
3.11.
4.1. - ( 0.59 )
4.2. - ( 1.09 )
4.3. - ( 1.75 )
4.4. - ( 2.06 )
()


13
22
23
23
23
24
25
28
29
31
32
40
41
69
69
70
70
78
79
80
81
83
93
94
95
96

4.5. - ( 0.59 )
4.6. - ( 1.09 )
4.7. - ( 1.75 )
4.8. - ( 2.06 )
4.9. - ( 0.59 )
4.10. - ( 1.09 )
4.11. - ( 1.75 )
4.12. - ( 2.06 )
4.13. - ( 0.59 )
4.14. - ( 1.09 )
4.15. - ( 1.75 )
4.16. - ( 2.06 )
4.17. - ( 0.59 )
4.18. - ( 1.09 )
4.19. - ( 1.75 )
4.20. - ( 2.06 )
4.21. - ( 0.59 )
4.22. - ( 1.09 )
4.23. - ( 1.75 )
4.24. - ( 2.06 )

()


97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116


/
Loadmax
max

R
T
F
P
T
S
V
S.F.

()


N
Rpm
Mm
Nm
N
W.

M
m/s
-

1.1




2551



1.2.
1.2.1
1.2.2
1.2.3

1.2.4

1.2.5

1.2.6

1.2.7
1.3

2



2.1.





(1) (steady flow)

(2)
(3) (incompressible)
(4)
2.1.1 (Equation of continuity)

2.1


Q = A1V1 = A2V2

/ (2-1)

Q A v

2.1.2 (Bernoullis equation)


(2-2)

2.2
=

(2-3)

2.1.3 (Laminar)

(2-4)

Re 2300


=

(2-5)

2.2.




2.3
2.2.1.
2.2.1.1 (Tube)


2.4
D
d
D

2.4

2.2.1.2 (Roller)




2.5
R
r
T
f

R
r
T

2.5 4

2.2.1.3
8

2.6
2.2.1.4
L
r

2.7
m(2-6)

1
m3(2-7)

= (m)
= (m)
= (m)

2.2.1.5 (Flow rate)


n
m3 / s(2-8)
= ()
m3 / s(2-9)
2.2.1.6 (Pump)
(head)
= h(m)
Watt (2-10)

= specific weight
h =

2.2.2

1 2

6 8

3
1

2.8
2.3. (DC Motor)





R
T = KI
(2-11)

T ()
( )
I ( )
K



(Back emf.)
E = Kw
(2-12)
E (Back emf.)
W /
(2-11) (2-12)

2.9
2.4. (Planetary Gear)




(Sun gear)
(Planet gear)
(Ring gear)

10

2.10 Planetary Gear


2.5. ADuC847
ADuC847 -
ADC
ADuC847 / (data Flash)/
(EE) ADCs
- ADuC847
(crystal) 32 kHz 12.58 MHz
(Flash)/ (EE) 62 32
8 RAM 2304
in-circuit serial download UART
AduC847 52-MQFP 2.12
2.1

11

2.11 ADuC847

2.12 AduC847 52-MQFP

12

Pin
1

2.1
pin

P1.0/AIN1
I
power-on default , P1.0/AIN1
AIN1. AIN1
AINCOM
AIN2. P1.0

0 .

P1.1/AIN2
I
power-on default , P1.1/AIN2
AIN2 . AIN2
AINCOM
AIN1. P1.1

0 .

P1.2/AIN3/
I
power-on default , P1.2/AIN3
REFIN2+
AIN3 . AIN3
AINCOM
AIN4. P1.2

0 .
.

,
P1.3/AIN4/
I
power-on default, P1.3/AIN4
REFIN2 AIN4 . AIN4
AINCOM

13

5
6
--7
8
9

AVDD
AGND
AGND
REFINREFIN+
P1.4/AIN5

S
S
S
I
I
I

10

P1.5/AIN6

11

P1.6/AIN7/I
EXC1

I/O

AIN3. P1.3

0 .
.

,

CSP
,
,
power-on default, P1.4/AIN5
AIN5 . AIN5
AINCOM
AIN6. P1.4

0 .

power-on default, P1.5/AIN6
AIN6 . AIN6
AINCOM
AIN5. P1.5

0 .

power-on default, P1.6/AIN7
AIN7. AIN7

14

12

P1.7/AIN8/I
EXC2

I/O

13

AINCOM/D
AC

I/O

14

DAC

----

AIN9

----

AIN10

15

RESET

AINCOM
AIN8.


P1.6
0 .

power on, P1.7/AIN8
AIN8. AIN8
AINCOM
AIN7.

.
P1.7
0 .

,

DAC
DAC ,

AIN9
AINCOM
AIN10 ( CSP )

AIN10
AINCOM
AIN9 ( CSP )

.

16
.
15

1619
2225

P3.0P3.7

16
17
18

P3.0/RxD
P3.1/TxD
P3.2/INT0

19

P3.3/INT1

22
23
24

P3.4/T0
P3.5/T1
P3.6/WR

25

P3.7/RD

20, 34,
48
21, 35,
47

DVDD

internal weak pull-down


P3.0 P3.7
internal pull-up resistors 3
1 pull-high internal
pull-up resistors .
3
internal
pull-up resistors 0
1 ,strong pull-up
. 3
2


0 . -
Timer 0
1 . -
Timer 1
Timer/Counter 0
Timer/Counter 1
Strobe.
0

Strobe.
0

DGND

I/O

16

26

SCLK (IC)

I/O

27

SDATA

I/O

2831,
3639

P2.0P2.7

I/O

28

P2.0/SCLO
CK(SPI)

29

P2.1/MOSI

Serial IC .
Input, Schmitt triggers . Weak
pull-up .
.

Serial IC .
, weak internal pull-up

P2.0 P2.7
internal pull-up resistors. 2
1 Pull-high internal
pull-up resistors .
2
Internal
pull-up resistors. 2

24 . 2
2

SPI
.
Schmitt rigger . weak pull-up

Master Serial Output / Slave Input


SPI . Internal strong pullup SPI
. strong pull-down
17

30

P2.2/MISO

31

P2.3/SS/T2

36

P2.4/T2EX

37

P2.5/PWM0

38

P2.6/PWM1

39
32
33

P2.7/PWMC
-LK
XTAL1
XTAL2

40

EA

41

PSEN

I
O

SPI

Master Serial Output / Slave Input


SPI . weak pull-up

Slave SPI .
Weak pull-up .

,
Timer 2 Counter 2

T2
Timer 2
,
T2EX Timer 2
.
PWM , PWM0

PWM , PWM1

PWM , PWM

Crystal Oscillator Inverter.
Crystal Oscillator Inverter.

.

0000H F7FFH
,
18

42

ALE

4346,
4952

P0.0P0.7

I/O

PCON.4 PCON SFR


Port 0 8.
0 1

2.6 ADuC847
- (Flash)/(EE) 62
- ( Flash)/( EE) 4
- (Flash)/(EE) 100 ,100
- ( Flash) /( EE) 3
- (In-circuit) ( )
- (5 )
- 2304
2.7 core 8051
- - (core)
- 32 kHz
- PLL ( 12.58 MHz)
- 316 ( )Timer / (counter)
- /(I/O) 24 8

- 11 2

19

2.8 (Ship)
-
- DAC12
- Dual - DACs 16
- 200 A
- (wake-up/RTC timer)
- UART, SPI, and IC serial I/O
- Watchdog timer (WDT)
- (PSM)
2.9 (SFRs)
128
(internal data memory)

ADuC847 2.12

2.13

20

2.10. PWM (PULSE-WIDTH MODULATOR)


ADuC847
6
2 6 - DAC 16
2.14
PWMCON 4 : PWM0H PWM0L PWM1H PWM1L
PWMCON 2.2
PWM PWM0H / L PWM1H / L
P2.5 P2.6
PWMCON

2.14

21

2.10.1 PWMCON (PWM Control SFR)


8 AEH
2.2

7
6,5,4

3,2

1,0

2.2 PWMCON

PWM2,PWM1,
PWM0
PWM2 PWM1 PWM0
0
0
0
0:
0
0
1
1: 16
0
1
0
2: 8
0
1
1
3: 16
1
0
0
4: Dual 16
1
0
1
5: Dual 8
1
1
0
6: Dual 16 RZ
1
1
1
7:

PWS1, PWS0
PWS1 PWS0
0
0

0
1
4
1
0
16
1
1
64
PWC1, PWC0
PWC1 PWC0
0
0
FXTAL/15 (2.184 kHz)
0
1
FXTAL (32.768 kHz)

22

1
1

0
1

2.7
FVCO (12.58 MHz)

2.10.2 PWM0H (PWM Pulse Width High Byte)


8 B2H

PWM0H
2.3
2.3 PWM0H (PWM Pulse Width High Byte)
PWM0H.7
0
R/W

PWM0H.6
0
R/W

PWM0H.5
0
R/W

PWM0H.4
0
R/W

PWM0H.3
0
R/W

PWM0H.2
0
R/W

PWM0H.1
0
R/W

PWM0H.0
0
R/W

2.10.3 PWM0L (PWM Pulse Width Low Byte)


8 B1H

PWM0L 2.4
2.4 PWM0L (PWM Pulse Width Low Byte)
PWM0L.7
0
R/W

PWM0L.6
0
R/W

PWM0L.5
0
R/W

PWM0L.4
0
R/W

PWM0L.3
0
R/W

PWM0L.2
0
R/W

PWM0L.1
0
R/W

PWM0L.0
0
R/W

2.10.4 PWM1H (PWM Cycle Width High Byte)


8 B4H

PWM1H
2.5
2.5 PWM1H (PWM Cycle Width High Byte)
PWM1H.7 PWM1H.6 PWM1H.5 PWM1H.4 PWM1H.3 PWM1H.2 PWM1H.1 PWM1H.0
0
0
0
0
0
0
0
0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W

23

2.10.5 PWM1L (PWM Cycle Width Low Byte)


8 B3H
PWM12.6
2.6 PWM1L (PWM Cycle Width Low Byte)
PWM1L.7 PWM1L.6
0
0
R/W
R/W

PWM1L.5
0
R/W

PWM1L.4
0
R/W

PWM1L.3
0
R/W

PWM1L.2
0
R/W

PWM1L.1
0
R/W

PWM1L.0
0
R/W

2.11. TIME INTERVAL COUNTER (TIC)



8051

1/128 255
32.768
6
TIMECON ITS0
ITS1 TIMECON (over flow) 8

INTVAL TII TIMECON.2



TIME INTERVAL COUNTER (TIC)
2.15 TIME INTERVAL COUNTER (TIC)

2.15 TIME INTERVAL COUNTER (TIC)

24

2.11.1 TIMECON (TIC Control Register)



2.7 TIMECON

7 ----
6 TFH 24
(hour counter) 0 23
0 255
5,4 ITS1, (Timebase)
ITS0 ITS1 ITS0
0
0
1 / 128 Second
0
1

1
0

1
1

3 ST1 (Single Time Interval)
TIEN


2
TII TIC
1 8 INTVAL SFR

1 TIEN (Time Interval)
8
8

25

TCEN


time
interval SFRs
(HTHSEC, SEC,
MIN, HOUR)
TCEN 0

2.11.2 INTVAL (User Timer Interval Select)



8 INTVAL TII (TIMECON.2)

INTVAL

0 255
2.11.3 HTHSEC (Hundredths of Seconds Time Register)
HTHSEC 1/128
TCEN TIMECON HTHSEC 0 127

SEC HTHSEC
2.11.4 SEC (Seconds Time Register)
SEC 1 TCEN
TIMECON SEC 0 59


MIN SEC
2.11.5 MIN (Minutes Time Register)
MIN 1 TCEN
TIMECON MIN 0 59

HOUR MIN

26

2.11.6 HOUR (Hours Time Register)


HOUR 1 TCEN
TIMECON HOUR 0 23


0 HOUR
2.12. (TIMERS/COUNTERS)
ADuC847 16 3 timer0 timer1
timer 2
2
8 THx TLx (x = 0, 1 2) 3
Timer Counter Timer TLx

TLx
-
Counter TLx
1 0 (PIN) T0 T1 T2
Counter
2 (
) 1 0


3 TMOD TCON
T2CON Timer 0 Timer 1T2CON
Timer 2
2.12.1 TMOD (Timer/Counter 0 and 1 Mode)
8 Timer
TMOD 2.8

27

5,4

1,0

2.8 TMOD

Gate Timer 1 Timer1 /


Counter 1 INT1 TR1

Timer1 TR1

C/T Timer / Counter Timer 1


Counter ( T1 ) Timer
()
M1, Timer1
M0 M0 M1
0
0 Timer / Counter 8
0
1 Timer / Counter 16
1
0 Timer / Counter 8
1
1 Timer 1/ Counter 1
Gate Timer 0 Timer0 /
Counter 0 INT0 TR0

Timer1 TR1

C/T Timer / Counter Timer 0


Counter ( T0 ) Timer
()
M1, Timer 0
M0 M0 M1
0
0 Timer / Counter 8
0
1 Timer / Counter 16
1
0 Timer / Counter 8
1
1 Timer / Counter 0

28

2.12.2 TCON (Timer/Counter 0 and 1 Control)


8
TMOD 2.9

7
6
5
4
3

2.9 TCON

TF1 Timer1 Timer1 / Counter



TR1 Timer1 Timer1 / Counter 1
Timer1 / Counter 1
TF0 Timer0 Timer0 / Counter0

TR0 Timer0 Timer0 / Counter 0
Timer0 / Counter 0
IE1 INT1
INT1

IT1 INT1
1 0

IE0 INT0
INT0

IT0 INT0
1 0

29

2.13 (LCD)
(LCD) Liquid Crystal Display

, ,


(LCD Module)
E (Enable) (Pulse)
450
R/W (Read/Write) 1 0

RS (regieter Select) 2
RS
1
0

DB7-DB0 -


RS 0
2.5

30

2.10
()
01
02
04
05
06
07
08
0A
0C
0E
0F
10
14
18
1C
38















2 5x8
8

31

2.14.
2.14.1 if
if
if (condition) statement;
if (condition)
{ statement1;
statement2;
}
if 1 statement { } statement
condition
statement
condition
2.11 1 2
1
2

main()
main()
{ int a,b; float c;
{ int a;
printf(Enter dividend);
printf(Enter number );
scanf(%d,&a);
scanf(%d,&a);
printf(Enter divisor);
if(a%2==0)printf(Even);
scanf(%d,&b);
}
if(b!=0)
a 4 Even
{ c = a/b;
a 5
printf(%f,c);
}
}
a 10
b 4 2.5
b 0

32

1 2 (condition)
(Condition)
if else
2.14.2 if else
if else
2 Condition condition
if (condition)
statement1;
else
statement2;

if (condition)
{ statement1;
statement2;
}
else
{ statement3;
statement4;
}
if else 1 statement
{ } statement
condition


if(a!=0)
PORTD = 0x55;
else
PORTD = 0xAA;

33

2 a a
0 D 0x55 a 0 D
0xAA
2.14.3 switch-case
Expression
Switch
expression switch if
switch
switch (expression)
{ case constant1 : statementList1; break;
.
case constantN : statementListN; break;
default : statementList;
}
expression
constant expression constant

statement expression
constant

Switch
char ch;
ch=getch();
switch( ch )
{
case c : printf(Do); break;
case d : printf(Re); break;
case e : printf(Me); break;
case f : printf(Fa); break;
case g : printf(Sol); break;
case a : printf(La); break;

34

case b : printf(Ti); break;


default : printf(No Note for this key);
}
g Sol
Statement break; break;
Statement case
Break case
char ch;
ch=getch();
switch( ch )
{
case c : printf(Do); break;
case d : printf(Re); break;
case e : printf(Me);
case f : printf(Fa);
case g : printf(Sol); break;
case a : printf(La); break;
case b : printf(Ti); break;
default : printf(No Note for this key);
}
2.14.4.
1
(loop)
C
C++ for, while do

35

2.14.4.1 for
for
for(v=i; condition test; increment or decrement)
{
statement 1;
statement 2;
:
:
:
statement n;
}
for (i)
(Loop control variable) v
{ }




}
2.14.4.2 while
while
while(condition){
statement 1;
statement 2;
statement 3;
:
:
statement n;
}

36

while
{ } while
while
}
while { }
{ }
2.14.4.3 do..while
do..while
do{
statement 1;
statement 2;
statement 3;
:
:
:
statement n;
while(condition);
}
do..while { }

while
while do..while
1 while
{ }

37



3.1.
3.1.1.
3.1.1.1. 4

3.1.1.1.1

1.
2. (Response)
3.

1.
2.

3.
4.
5.
3.1.1.1.2

1. 2
4,500 ,
20,000

38

2.

3.
4.
5.

1.
(Power electronics)
(inverter)
3.1.1.1.3 (DC.BRUSHLESS)

1. (Response)
2.
3.

4. (Response)
5.
6.

1.

2.

- 3


39

3.1.1.2.


1.
(Pressure Lever Cassettes) 0.8 0.00089

2.

Triethanoamine (C6H15NO3) 27
3.1 ( =kinematic viscosity) 479.68
(centistokes) 0.479 x 10-3 3.2
9.34 1119.17
3.1 ( = kinematic viscosity) Triethanoamine (C6H15NO3)

40

3.2 Triethanoamine(C6H15NO3)

1 x (453592.37 / 0.0037854118) =
3.
15 / 2.6

x R= 15 x 23.75 = 0.0059375
(3-1)
4. (Q)
2.7

(3-2)

41


= 0.0000000231786
=23.178

3.1
5.
6.
h = m.
7.

v1= v2

(3-3)
= (0.0059375)(0.00089)/( 0.479x10-3m2 )
= 0.011032

(
)=
=
= 0.45
H 1


(
)=
+ H =1+0.45= 1.45


(
) = g
=1119.17 x 9.8 x 1.45
= 15.903

42

P x Q = 0.0000000231786x15903
= 0.0003686

24

3.2 24
3.1.2

3.3

43

3.1.3

2
1. ADuC847

ADuC847 ADuC847
5 220
IC LM2576SX-5.0

3.4 LM2576SX-5.0
, ,
5
ADuC847 LM2576SX-5.0

7 9
220 9

3.5 9

44


2 +9 -9
9

3.6
2.
24

3.7 24
24
220 24 4

45

3.8

3.9


3.1.4

3.10

46

3.1.5

3.11
3.1.6

3.12

47

3.1.7



3.13

3.14 ( )

48

3.15

3.16

3.17

49

3.18

3.19

3.2.
3.2.1




3.20

50

3.21

51

3.22

3.23

52

3.24

3.25

53

3.26

3.27

54

3.28

55

3.2.2

3.29

56

3.30

57

3.31

58

3.32

59

3.33

3.34 ( )

60

3.3.






3.3.1. ADuC847
ADuC847

4 8

52

3.35 ADuC847
ADuC847 3
1.
2.
3.

61

3.3.1.1

ADuC847

ADuC847
1. AVDD (5) +5

2. AGND 0
3. DVDD(2 0,3448) +5

4. DGND (4735) 0
5. EA(40)

3.36 ADuC847

62

3.3.1.2
ADuC847




ADuC847


32.7672 ADuC847
1.XTAL1 (3 2)
2.XTAL2 (3 3)

3.37 ADuC847

63

3.3.1.3

1. 0
2. 1
3. 2
4. 3.4
timer 0
5. RS232
ADuC847 0-4


3.38 ADuC847
(schematic-diagram)

64

3.39 ADuC847

3.40
ADuC847

65

3.41
ADuC847

3.42 Broad
ADuC847 (socket)

66

RS232

3.43
ADuC847
3.3.2.



GND 0
VCC
P2.5 (int2)

0
1-
P2.1 (int) Step

0
1-
P2.0 (EN)
-

0

1-

67

4
1.
2. -
3.
4.


(Transmission)

3.44
3.3.2.1
EN INT1 INT2
IC 7400 (NAND GATE ) 4
INT1 INT2

3.45

68

1 1
P2.5 (PWM) = 0, P2.1 (INT1) = 0
3.3 PWM=0 IN1=0
P2.5(PWM)
P2.1(IN1)
C
D
0
0
1
1

3.46 PWM=0 IN1=0


2
P2.5 (PWM) = 0, P2.1 (INT) = 1
3.4 PWM=0 IN1=1
P2.5(PWM)
P2.1(IN1)
C
D
0
1
1
1

3.47 PWM=0 IN1=1

69

3 P2.5
(PWM) = 1, P2.1 (IN1) = 0
3.5 PWM=1 IN1=0
P2.5(PWM)
P2.1(IN1)
C
D
1
0
0
1

3.48 PWM=1 IN1=0


4
P2.5 (PWM) = 1, P2.1 (IN1) = 1
3.6 PWM=1 IN1=1
P2.5(PWM)
P2.1(IN1)
C
D
1
1
1
0

3.49 PWM=1 IN1=1


EN

70

3.3.2.2 (Transmission)


(IC) LTV 847

3.50 LTV 847

3.51 LTV 847


LTV 847
(Photocopier) 4
3
-
VCC

3.52 LTV 847

71

VCC (Pull in)


EN, C, D
5 5

VCC L298Driver

3.53 EN , C , D =0
EN C D =1 5



VCC L298Driver

EN
5

L298Driver

3.54 EN=1

72

3.3.2.3
EN, C, D
IC L298Driver

3.55 L298Driver
L298Driver (DUAL FULLBRIDGE DRIVER)

3.56 L298Driver
L298Driver

3.57 L298Driver
73

3.3.2.4
24

3.58



INT 1

3.59
4

3.60

74

3.61

3.62

3.63

75

3.3.3

2

3.64

3.65

3.66

76

1 4
1 : GND (Vss)
2 : +Vcc (Vdd) +5
3 : Vo
4 : RS (Register Select)
0 1
5 : R/W (Read/Write control)
6 : E (enable)
7 -14: D0-D7 (DATA)
1 5: +5
1 6: 0

3.67

77

3.7

ADuC847
VSS
DGND
VDD
VCC
V0

RS
P2.6
R/W
DGND
E
P2.7
DB0
P0.0
DB1
P0.1
DB2
P0.2
DB3
P0.3
DB4
P0.4
DB5
P0.5
DB6
P0.6
DB7
P0.7
A
VCC
K
DGND
3.3.4 (Keypad)

M x N
M
+ N

78

3.68
12

(4x3) 7




3.8


DK-KEY-4x3001-V1 General purpose touch key
1. (Touch Screen)
2. 4

79

3.9 DK-KEY-4x3-001-V1

3.

BINARY UART

3.69 DK-KEY-4x3-001-V1

80

BINARY

3.70
3.10

GND
GND
BIT0
P1.0
BIT1
P1.1
BIT2
P1.2
BIT3
P1.3
BITS
P3.2/INT0
+5V
VCC
BITS P3.2
1

81

3.3.5

2
1. 24
2. (Optical Interrupter Switch)

3.71

3.72

82

3.73

3.11

1
VCC
2
GND
3
VCC

1.
P3.4/T0
1

3.74

83

2.
P3.4/T0 0

3.75
3. 1 - 24
4. P3.4/T0 Timer0 timer0
- 1 1

ADuC847

(Burn) ADuC847 Broad burn


RS232

ADuC847
RS232
RS2326

1: GND
2: VCC +5
3: PSEN (4 1) ADuC847

4: RESET (1 5)
5: P3.0 RXD UART
6: P3.1 TXD UART

84

3.76 RS232

3.77 RS232
3.4.
3.4.1



3.78

85

3.79

86

3.80

3.81

87

3.82

4 4



3.4.2

88

3.83

3.84

89

3.85

3.86

3.87

90

3.88

3.89

91

4







4.1.


1 ml 8 ml

4
- 0.59 , - 1.09 , - 1.75 ,
- 2.06 2,4,6,8,10 /
1 1 2 2

4.1

4.2

92

4.1.1 2 /

2 / () ()

4.1 - ( 0.59 )
(ml)

1
2
3
4
5
1
631
630
632
631
632
2
1262 1262 1261 1261 1264
3
1894 1893 1890 1892 1893
4
2525 2525 2523 2524 2525
5
3139 3137 3138 3138 3139
6
3772 3772 3772 3774 3775
7
4403 4404 4403 4403 4404
8
5036 5037 5036 5037 5039

- 1 (2 /)
6000

()

5000
4000

3000

2000

1000

5
1

( )

4.3 4.1

93

4.2 - ( 1.09 )
(ml)

1
2
3
4
5
1
420
419
422
420
420
2
842
841
841
843
841
3
1264 1265 1264 1265 1265
4
1683 1683 1682 1683 1682
5
2100 2101 2101 2102 2101
6
2521 2521 2521 2521 2521
7
2941 2942 2942 2942 2942
8
3363 3363 3362 3362 3363

()

- 1 (2 /)
4000
3500
3000
2500
2000
1500
1000
500
0

1
2
3

4
5
1

( )

4.4 4.2

94

4.3 - ( 1.75 )
(ml)

1
2
3
4
5
1
186
187
185
185
185
2
372
370
372
371
370
3
560
563
562
561
561
4
746
743
745
743
744
5
933
934
934
934
932
6
1118 1116 1117 1116 1118
7
1305 1303 1304 1305 1305
8
1490 1489 1488 1492 1492

()

- 1 (2 /)
1600
1400
1200
1000
800
600
400
200
0

2
3

4
5
1

( )

4.5 4.3

95

4.4 - ( 2.06 )
(ml)

1
2
3
4
5
1
129
127
127
129
128
2
260
267
262
263
260
3
391
390
388
387
388
4
522
520
521
522
522
5
650
653
654
653
651
6
785
785
782
784
781
7
918
918
915
917
919
8
1040 1042 1042 1041 1042

- 1 (2 /)
1200

()

1000
800

600

400

200

5
1

( )

4.6 4.4

96

4.1.2 4 /

4 / () ()

4.5 - ( 0.59 )
(ml)

1
2
3
4
5
1
317
317
315
316
317
2
635
634
633
636
635
3
951
954
952
951
952
4
1269 1272 1270 1270 1271
5
1587 1586 1584 1586 1588
6
1906 1905 1902 1903 1907
7
2222 2220 2223 2221 2220
8
2540 2544 2542 2542 2539

- 1 (4 /)
3000

()

2500
2000

1500

1000

500

5
1

( )

4.7 4.5

97

4.6 - ( 1.09 )
(ml)

1
2
3
4
5
1
221
222
221
220
221
2
443
444
443
443
446
3
665
667
662
663
662
4
887
882
888
885
887
5
1118 1120 1118 1116 1121
6
1330 1332 1332 1334 1330
7
1541 1540 1538 1541 1539
8
1758 1756 1761 1762 1760

- 1 (4 /)
2000

()

1500
1
1000

2
3

500

4
0

5
1

( )

4.8 4.6

98

4.7 - ( 1.75 )
(ml)

1
2
3
4
5
1
93
91
90
94
92
2
186
183
185
185
183
3
280
285
282
281
282
4
375
374
371
375
373
5
470
471
473
472
476
6
563
567
565
563
561
7
666
667
664
666
665
8
751
752
754
751
750

()

- 1 (4 /)
800
700
600
500
400
300
200
100
0

1
2
3

4
5
1

( )

4.9 4.7

99

4.8 - ( 2.06 )
(ml)

1
2
3
4
5
1
65
67
66
64
65
2
129
127
130
129
131
3
197
195
199
198
198
4
264
263
262
265
266
5
329
327
328
328
328
6
404
403
406
405
402
7
469
471
471
466
468
8
535
534
537
535
534

- 1 (4 /)
600

()

500
400

300

200

100

5
1

( )

4.10 4.8

100

4.1.3 6 /


6 / ( ) ()

4.9 - ( 0.59 )
(ml)

1
2
3
4
5
1
215
214
216
214
213
2
430
432
435
431
433
3
647
645
647
645
646
4
861
863
862
865
859
5
1078 1076 1078 1077 1080
6
1294 1295 1293 1293 1290
7
1500 1501 1504 1503 1502
8
1724 1724 1725 1722 1723

- 1 (6 /)
2000

()

1500
1
1000

2
3

500

4
5

0
1

( )

4.11 4.9
101

4.10 - ( 1.09 )
(ml)

1
2
3
4
5
1
142
143
145
142
144
2
285
283
288
286
287
3
426
427
422
425
424
4
566
567
563
568
567
5
708
709
706
709
710
6
848
846
844
846
848
7
989
988
992
990
988
8
1131 1134 1132 1133 1130

- 1 (6 /)
1200

()

1000
800

600

400

200

5
1

( )

4.12 4.10

102

4.11 - ( 1.75 )
(ml)

1
2
3
4
5
1
62
61
63
64
62
2
125
124
126
129
128
3
190
193
192
191
191
4
253
253
254
256
250
5
315
314
313
317
315
6
378
376
378
379
376
7
440
443
445
442
444
8
504
510
509
506
505

- 1 (6 /)
600

()

500
400

300

200

100

5
1

( )

4.13 4.11

103

4.12 - ( 2.06 )
(ml)

1
2
3
4
5
1
44
45
43
44
46
2
90
91
93
92
90
3
135
135
137
136
134
4
180
182
180
181
183
5
225
224
223
226
225
6
271
272
273
271
270
7
316
317
318
319
315
8
363
364
364
365
366

()

- 1 (6 /)
400
350
300
250
200
150
100
50
0

1
2
3

4
5
1

( )

4.14 4.12

104

4.1.4 8 /


8 / () ()

4.13 - ( 0.59 )
(ml)

1
2
3
4
5
1
161
162
163
162
163
2
323
324
325
324
321
3
483
484
483
482
485
4
645
643
644
647
645
5
802
800
801
803
802
6
970
972
971
972
974
7
1134 1135 1136 1135 1133
8
1297 1295 1294 1296 1298

- 1 (8 /)
1400
1200
()

1000

800
600

400

200

5
1

( )

4.15 4.13
105

4.14 - ( 1.09 )
(ml)

1
2
3
4
5
1
102
103
104
102
101
2
205
203
204
201
202
3
308
306
309
307
306
4
413
413
415
413
414
5
516
517
518
519
515
6
619
618
617
617
619
7
725
726
727
728
725
8
827
825
825
827
828

()

- 1 (8 /)
900
800
700
600
500
400
300
200
100
0

1
2
3

4
5
1

( )

4.16 4.14

106

4.15 - ( 1.75 )
(ml)

1
2
3
4
5
1
47
47
46
48
46
2
93
92
95
94
93
3
141
142
143
142
143
4
188
186
185
186
189
5
235
236
237
234
235
6
283
287
286
286
284
7
331
334
330
330
332
8
379
376
375
378
377

()

- 1 (8 /)
400
350
300
250
200
150
100
50
0

1
2
3

4
5
1

( )

4.17 4.15

107

4.16 - ( 2.06 )
(ml)

1
2
3
4
5
1
34
35
34
33
34
2
68
67
67
65
66
3
102
103
104
102
101
4
137
136
136
135
136
5
171
171
170
174
172
6
207
203
204
203
205
7
241
242
244
243
244
8
277
276
278
279
276

- 1 (8 /)
300

()

250
200

150

100

50

5
1

( )

4.18 4.16

108

4.1.5 10 /


10/ () ()

4.17 - ( 0.59 )
(ml)

1
2
3
4
5
1
128
127
126
129
127
2
255
256
254
258
255
3
384
385
387
389
385
4
513
514
512
512
511
5
641
642
643
641
640
6
770
771
769
768
770
7
898
897
899
900
897
8
1027 1028 1029 1029 1028

- 1 (10/)
1200

()

1000
800

600

400

200

5
1

( )

4.19 4.17
109

4.18 - ( 1.09 )
(ml)

1
2
3
4
5
1
86
85
86
87
87
2
172
173
174
173
172
3
258
256
257
258
259
4
344
343
345
347
345
5
431
435
432
432
431
6
518
517
516
518
516
7
605
605
605
605
607
8
693
694
692
693
693

()

- 1 (10 /)
800
700
600
500
400
300
200
100
0

1
2
3

4
5
1

( )

4.20 4.18

110

4.19 - ( 1.75 )
(ml)

1
2
3
4
5
1
37
37
38
37
37
2
74
74
75
76
78
3
112
113
112
114
110
4
149
150
148
150
151
5
186
187
186
185
188
6
224
225
223
222
224
7
262
262
263
263
262
8
300
302
299
298
300

- 1 (10/)
350
300
()

250

200
150

100

50

5
1

( )

4.21 4.19

111

4.20 - ( 2.06 )
(ml)

1
2
3
4
5
1
27
27
25
26
27
2
54
53
55
54
53
3
81
81
80
82
81
4
108
106
108
110
109
5
136
135
138
137
137
6
164
165
167
164
168
7
191
192
192
193
190
8
218
218
217
216
220

- 1 (10 /)
250

()

200
1

150

100

50

5
1

( )

4.22 4.20

112

4.1.6 10 / 2

10/ () ()

4.21 - ( 0.59 )
(ml)

1
2
3
4
5
1
65
64
66
65
65
2
128
127
126
126
128
3
192
193
193
191
192
4
257
256
257
255
256
5
320
321
320
321
320
6
385
386
385
385
386
7
450
451
450
450
452
8
515
514
514
514
515

()

- 2 (10/)
600
500
400
300
200
100
0

1
2

3
4
1

( )

4.23 4.21

113

4.22 - ( 1.09 )
(ml)

1
2
3
4
5
1
42
43
42
43
43
2
87
88
88
87
88
3
128
128
127
128
127
4
172
172
171
172
173
5
218
218
219
217
217
6
258
258
257
256
257
7
303
303
301
302
302
8
347
347
348
347
347

()

- 2 (10 /)
400
350
300
250
200
150
100
50
0

1
2
3
4
1

( )

4.24 4.22

114

4.23 - ( 1.75 )
(ml)

1
2
3
4
5
1
19
20
20
19
18
2
37
36
36
37
38
3
57
58
57
57
58
4
75
76
75
76
77
5
94
94
93
94
95
6
112
112
113
111
112
7
131
132
131
132
132
8
151
151
153
152
152

()

- 2 (10/)
180
160
140
120
100
80
60
40
20
0

1
2
3
4
5
1

( )

4.25 4.23

115

4.24 - ( 2.06 )
(ml)

1
2
3
4
5
1
13
13
12
13
14
2
27
27
26
28
26
3
40
40
41
41
41
4
53
53
54
52
55
5
67
66
66
65
67
6
80
81
82
81
82
7
93
94
93
93
94
8
109
108
109
108
108

- 2 (10 /)
120

()

100
80

60

40

20

5
1

( )

4.26 4.24

116

4.2

12



1. #

4.27
2. 2

* #

4.28 2
117

3. 2
* #

4.29 3
4.
*
#

4.30 4

118

5. 0
1 2

*
#

4.31 5

119

5



2

1

5


5.1.
5.1.1




5.1.2
10
( -)

( )


5.1.3
10

12,000

120

5.2.
5.2.1


5.2.2

121


, , , ,
-
, 2551
. MCS-51. 1.:
, 2548.
. MCS-51. 1.:
, 2550.

122

123

//------------------------- PUMP --------------------------#include "ADuC847.h"


sbit EN = P2^7;
sbit RS = P2^6;
sbit PWM = P2^5 ;
sbit DIR = P2^1;
sbit ENM = P2^0;
unsigned char dat[]= " ";
unsigned char phr[]= "000000";
unsigned char pdirect[]= "";
unsigned char pspeed[]= "00";
unsigned char Key = 0 ;
unsigned char direct = 0 ;
unsigned int mem = 0;
unsigned int time = 0;
unsigned int speed =0;
unsigned int speed1 =0;
unsigned int TimeCount =0;
unsigned int Duty;
unsigned int Rev_TL1=0;
unsigned int Encode_speed=0;
void init_LCD(void);
void init_motor(void);
void LCD_comm(unsigned char com);
void Delay(int z);
void LCD_display(unsigned char text);
void LCD_Print(int x,char *str);

124

void Init_time(void);
void Init_speed();

//------------------------- LCD_Display --------------------void LCD_display(unsigned char text)


{
RS = 1;
EN = 1;
P0 = text;
Delay(5);
EN = 0;
Delay(5);
}

//------------------------- LCD_Comman ---------------------void LCD_comm(unsigned char com)


{
RS = 0;
EN = 1;
P0 = com;
Delay(5);
EN = 0;
Delay(5);
}

125

//------------------------- LCD_Print ----------------------void LCD_Print(int x,char *str)


{
switch(x)
{ case 0: LCD_comm(0x80); break;
case 1: LCD_comm(0xc0); break;
case 2: LCD_comm(0x94); break;
case 3: LCD_comm(0xD4); break;
}
while(*str) { LCD_display(*str); str++;}
}

//------------------------- Delay_Time ---------------------void Delay(int z)


{
while(z--);
}

//------------------------- Init_Keypad --------------------void InitKeyPad(void)


{
EA = 1;
EX0 = 1;
IT0 = 1;
P1 = 0x00;

126

}
//------------------------- Init_Time ----------------------void Init_time()
{
IEIP2 = 0x04;
TIMECON = 0xC0;
INTVAL = 128;
HTHSEC=0;
SEC=0;
MIN=0;
HOUR=0;
}

//------------------------- Init_speed ---------------------void Init_speed()


{
PWMCON = 0x13;
PWM1H = 100;
PWM1L = 100;
PWM0H = Duty;
PWM0L = Duty;
}

//------------------------- Init_Motor ---------------------void init_motor()


{

127

ET0=1;
TMOD=0x16;
TH0=0xff;
TL0=0xfe;
TR1=0;
TR0=0;
ET1=1;
TH1=0xff;
TL1=0;
}
//------------------------- INT0 ---------------------------void INT0_Service(void) interrupt 0
{
Key = 0;
Key = P1;
mem = P1;
Key = Key & 0x0f;
Key = Key + 48;
if(Key==15+48)
{
Key = "#";
}
else if(Key==14+48)
{
Key = 42;
}
dat[0] = Key;

128

}
//----------------------- T0_Counter ----------------------void T0_Service(void)interrupt 1
{
if(Rev_TL1<Encode_speed)
{
Duty--;
}
else if(Rev_TL1>Encode_speed)
{
Duty++;
}
if(Duty>100)
{
Duty = 100;
}
TL0 = 0xfe;
TH0 = 0xff;
TL1 = 0;
TH1 = 0xff;
PWM0H = Duty;
PWM0L = Duty;
Rev_TL1 = 0;
TF0 = 0;
TF1 = 0;
}

129

//------------------------ T1_Timer ------------------------void T1_Service(void)interrupt 3


{
Rev_TL1++;
TL1 = 0;
TH1 = 0xff;
TF1 = 0;
if(Rev_TL1==30000&&speed!=0)
{
Duty = 20;
PWM0H = Duty;
PWM0L =Duty;
}
}

//----------------------- Real_time(TIC) --------------------void Time_service(void)interrupt 10


{
if(++TimeCount==time)
{
TimeCount = 0;
ENM = 0;
Key = 48;
Init_time();
}
}

130

//------------------------- main ----------------------------void main(void)


{
while(1)
{
InitKeyPad();
Init_time();
init_motor();
LCD_comm(0x38);
Key = 0;
ENM = 0;
Init_speed();
LCD_Print(0,"********************");
LCD_Print(1,"* PELISTALTIC PUMP *");
LCD_Print(2,"* PRESS KEY # *");
LCD_Print(3,"********************");
LCD_comm(0xA3);
while(1)
{
if(Key=="#"){break;}
}
LCD_comm(0x01);
LCD_Print(0,"* SPEED SETTING *");
LCD_Print(1," Speed : rev/min ");
LCD_comm(0xC9);
LCD_display(pspeed[0]);
LCD_display(pspeed[1]);

131

LCD_Print(2,"Cancel : Press ->> *");


LCD_Print(3,"OK: Plase Press -> #");
/*--------------*speed...LCD-------------------*/
while(1)
{
Key = 0;
LCD_comm(0x0F);
LCD_comm(0xE7);
while(1)
{
if((Key==42)||(Key==35)) {break;}
}
if(Key =="#"){break;}
speed = 0;
LCD_comm(0xC9);
while(1)
{
if ((Key==48)||(Key==49)) {break;}
}
LCD_display(dat[0]);
pspeed[0] = dat[0];
speed1 = mem*10;
mem=0;
Key = 0;
while(1)
{
if(Key>47){break;}
}

132

LCD_display(dat[0]);
LCD_comm(0xE7);
pspeed[1] = dat[0];
speed = speed1+mem;
Key = 0;
Encode_speed=14070/speed;
Duty = speed*9;
if(speed==0){Duty=0;}
while(1)
{
if((Key==42)||(Key==35)) {break;}
}
if(Key=="#"){break;}
}
LCD_comm(0x01);
LCD_Print(0," * TIME SETTING * ");
LCD_Print(1,"Time :> : : ");
LCD_comm(0xc8);
LCD_display(phr[0]); LCD_display(phr[1]);
LCD_comm(0xcb);
LCD_display(phr[2]); LCD_display(phr[3]);
LCD_comm(0xcE);
LCD_display(phr[4]); LCD_display(phr[5]);
LCD_Print(2,"No Setting: 00:00:00");
LCD_Print(3,"* <-:Cancel OK:-> #");
/*--------------*time...LCD-------------------*/
while(1)
{

133

Key = 0;
LCD_comm(0xE7);
while(1)
{
if((Key==42)||(Key==35)) {break;}
}
if(Key=="#"){break;}
time = 0;
LCD_comm(0xC8);
while(1)
{
if(Key==48||Key==49) {break;}
}
LCD_display(dat[0]);
phr[0] = dat[0];
time = mem*10*60*60;
Key = 0;
while(1)
{
if(Key>47) {break;}
}
LCD_display(dat[0]);
LCD_comm(0xCB);
phr[1] = (dat[0]);
time = time + mem*60*60;
Key = 0;
while(1)
{

134

if((Key>47)&&(Key<54)) {break;}
}
LCD_display(dat[0]);
phr[2] = (dat[0]);
time = time + mem*10*60;
Key = 0;
while(1)
{
if (Key >47) {break;}
}
LCD_display(dat[0]);
LCD_comm(0xCE);
phr[3] = dat[0];
time = time + mem*60;
Key = 0;
while(1)
{
if((Key>47)&&(Key<54)) break;
}
LCD_display(dat[0]);
phr[4]= dat[0];
time = time + mem*10;
Key = 0;
while(1)
{
if(Key > 47) {break;}
}
LCD_display(dat[0]);

135

LCD_comm(0xE7);
phr[5] = dat[0];
time = time + mem;
Key = 0;
while(1)
{
if((Key==42)||(Key==35)) { break;}
}
if(Key =='#') { break;}
}
/*--------------*Total...LCD-------------------*/
DIR=1;
LCD_comm(0x01);
LCD_Print(0,"Speed : rev/min" );
LCD_comm(0x88);
LCD_display(pspeed[0]);
LCD_display(pspeed[1]);
if(time!=0)
{
LCD_Print(1,"Time : __:__:__ ");
LCD_comm(0xc8);
LCD_display(phr[0]);
LCD_display(phr[1]);
LCD_comm(0xCB);
LCD_display(phr[2]);
LCD_display(phr[3]);
LCD_comm(0xCE);

136

LCD_display(phr[4]);
LCD_display(phr[5]);
}
else if(time==0)
{
LCD_Print(1,"Time : No Setting" );
}
LCD_Print(2,"Direction : Right >2");
LCD_Print(3,"*<Back Stop(0) Run>#");
LCD_comm(0xE7);
TimeCount = 0;
Init_speed();
while(1)
{
Key = 0;
if((Key==42)||(Key==48)||(Key==35)||(Key==49)||(Key==50)) { break; }
}
while((Key==35)||(Key==48)||(Key==49)||(Key==50))
{
if(Key==48)
{
LCD_comm(0xE7);
ENM = 0;
TIMECON = 0xC0;
TR1 = 0;
TR0 = 0;
}
else if(Key==49)

137

{
DIR = 1;
LCD_Print(2,"Direction : Right >2");
}
else if(Key==50)
{
DIR = 0;
LCD_Print(2,"Direction : Left >1");
}
else if(Key==35)
{
LCD_comm(0xE0);
while(1)
{
if((Key==48)||(Key==42)){break;}
TIMECON = 0xC3;
ENM = 1;
TR1 = 1;
TR0 = 1;
}
}
}
}
}

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

You might also like