Beruflich Dokumente
Kultur Dokumente
... . . .
System
Scenario and Progress of Industry
Automation
Introduction
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 1
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 2
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 3
. Cut to Length Controller
and sophisticated process control units and sensors were developed ,while in
batch industries, particularly in mechanical engineering , new process equipment
such as numerically and computer controlled machine tools, computer-aided
design and flexible manufacturing systems emerged.
Perhaps the best way to start with is the analysis of the system objectives. In
as much as automated equipment requires automatic control, data on the use of
industrial control and instrumentation, should provide an idea of the real time
implementation.
Here first we are going to see the purpose of the system and then we come
to know how we have derived the system objectives along with the application
background.
The purpose of designing such system is to provide a cost effective and precise
control over a servo drive for a dedicated application and enhanced functionality
of servo drive MP-controller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 4
. Cut to Length Controller
The system have the following objectives such that it is reliable enough to apply
for an industrial application.
The objectives are :
1) The system must have the basic functionality of servo drive controlling MP,
such that system can completely replace the MP unit.
2) The system must be able to provide pulse train in frequency range of 1 to 70
KHz for the pulse potion mode of the servo drive.
3) The system must be able to sense the mechanical assembly failure such that it
will resume the functionality with the previous parameters fed.
4) The mechanical assembly should be controlled such a way that desired length
of the sheet can be achieved without any damage and the length must be in
mm.
5) The system must be able to communicate human interfaces like LCD or HMI.
6) The system should be very cost effective and highly efficient.
7) The parameters listed below can be easily inserted through any media to the
system:
1. Length of the desired sheet in mm.
2. Diameter of the roller
3. Gear ratio
4. cutter on/off duration
5. Calibration
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 5
. Cut to Length Controller
Here as shown in the diagram the system has to control the right side belt
assembly by controlling the rollers such that rotation of the rollers provide the
forward motion of belt and hence the sheet. Here the rotation of the roller is such
that it provides the exact desired length of the sheet. Such controlling action of the
rollers and hence the entire right sided belt assembly is achieved by a servo motor
and servo drive with C2L unit. Here the C2L unit provides the derived pulse train
as per the user requirement to the servo drive. Here the servo drive is set to the
pulse position mode, such it gives the signal to servo motor in accordance with the
number of pulses in pulse train. Here the belt assembly on the right side, moves
with the constant speed along with the take up drum.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 6
. Cut to Length Controller
Now from the application background we come to know the handling of system
components. But there are many difficulties associated with the system, which
must be considered and also the provision of such difficulty must be provided as a
controlling action of system itself.
Here the operation starts with sensing of start proximity switch as the dancing
roller reaches the start level. The C2L unit generates the no. of pulses derived
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 7
. Cut to Length Controller
according the calculation of the parameters and hence the servo motor rotates.
Here the dancing roller is having vertical motion under the gravitational force and
it also provides little tension to the sheet for avoiding the wrinkles in the sheet
which helps to maintain the exact length(**1).
Here as shown in the figure the length of the sheet is to be measured from the
cutting edge. Here the cutter distance is varying for the different type of the cutter
assembly, which should be feasible for mechanical alignment. Each time the
system is turned on ,one has to take care about this cutter distance because it
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 8
. Cut to Length Controller
simply turns out in the waste piece. So, if the cutter distance is negligible then
there is nothing to consider about the waste piece. This condition arises once at
the time of the system start up only. More details is given in the later chapter.
How ever there are such possibilities for the wreaking up the sheet during the
running operation due to mechanical failure.. Such possibilities and their
provisions are listed below.
Case 1: Meanwhile the running condition, if the dancing roller reaches at the stop
level or say having displacement more than the clearance distance (**2). Such
condition occurs if the failure of the take up drum assembly ( or left side belt
assembly) takes place.
Provision : Such failure can be easily flag marked by providing the stop
proximity switch-1 at the stop level or at clearance distance as shown in the figure
1.2 . As soon as the stop proximity switch-1 has sensed ,the operation is halted till
the dancing roller reaches again to start level. Now as the dancing roller reaches to
the start level or say start proximity switch has sensed , the cutting operation
resumes with the remaining length to be cut.
Case 2: Meanwhile the running condition, if the dancing roller crosses the dead
end level. Such condition occurs if the sheet coming from the take up drum is
broken or the take up drum is empty. In this condition, if the roller is at the mid of
clearance level and the broken sheet comes, the roller falls down the ground,
giving signal to the start proximity switch. In such condition if there is no any
provision then the unit again starts giving the pulses and hence starts the cutting
sequence.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 9
. Cut to Length Controller
Case 3: Consider a condition in which the cutter assembly which is also being
controlled by the C2L unit, fails during the operation.
Hence the unit is able to sense the every possible mechanical failure. The
proximity switches are the backbone of the controlling of the entire system.
Hence the essential system is achieved logically. But only knowing the possible
failure and the possible solution it is worth saying that achieved the objective to
sense the mechanical failure. The corresponding hardware and the software must
have to assign for real time application. The hardware and the software portion for
the system are discussed in the following chapters.
(**1) Here the dancing roller is having only on vertical motion axis as in the actual application there
is a guiding vane which provides the dancing roller only one vertical direction, although it is under
the gravitational force only.
(**2) Here the clearance distance and the distance between dead end level and the start level are
absolutely depending upon the arrangement of the take up drum and conveyor belt assembly. Also
the height of the conveyor belt assembly from the ground level must be considered. It is
recommended to keep the clearance distance twice of the distance between the start and dead end
level.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 10
. Cut to Length Controller
. . .. . .
Description
System
System Model
& Hardware
Hardware Description
Of Existing
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 11
. Cut to Length Controller
As shown in the figure 2.1 the proximity switches are connected to the Opto-
isolation board. Here the proximity switches as well as the pulses and the cutter
relay are not connected directly to the controller for providing electrical isolation.
Here the LCD and the keyboard are directly connected to the controller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 12
. Cut to Length Controller
Opto-couplers:
Opto-couplers are utilized for providing electrical isolation to microcontroller
from external peripherals, as microcontroller is very sensible to external noise.
Hence the Opto-couplers are the isolating medium through which the external
peripherals are connected to the microcontroller.
Microcontroller:
The microcontroller is the Heart of the proposed automation system. It
constantly monitors the digitized outputs of the proximity switches and takes the
predefined corresponding actions at that instant of time. In case such a situation
arises it activates the other peripherals to perform the controlled operation.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 13
. Cut to Length Controller
Display Unit:
A simple 2x16 Liquid Crystal Display is used to indicate the present status of the
parameters and respective values. The information is to be display in menu format
with corresponding action of the keyboard.
Key Board :
A simple 3x2 matrix keyboard is interfaced with the controller. The key board is
designed such that it generates the keyboard interrupt for respective key pressed.
Relay or Solenoid :
A simple low voltage relay or solenoid can be used to turn on the cutter assembly
as a part of controlling action.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 14
. Cut to Length Controller
Mechanical parameters
Sr no. Parameter to be considered Importance of the parameter
4 Gear ratio From servo shaft to roller gear for length calculation
( max 10 )
5 Feed roller Diameter Outer diameter of roller surface for length calculation
( max 9999 mm )
6 Length Length of the sheet to be cut (max 9999 mm )
7 O/P time On/Off time duration of cutter ( max 9999 ms)
Calculative Parameters
Sr no. Parameter to be considered Importance of the parameter
8 Pulse count value No of pulses in a pulse train, which has to be fed to
the servo drive, derived form the above parameters
9 Offset length in um Required for the calibration, added or subtracted
from the actual length ( max 9999 um )
• On sensing the start proximity switch the system must have to feed the
derived no of pulses to the drive, that rotates the servomotor resulting the
desired length.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 15
. Cut to Length Controller
• On sensing the stop proximity switch the system must have to hold the
entire operation with some indication, and again sensing on the start
proximity switch the remaining operation must have to complete.
Hardware must always follow the selection of software, with the hardware
required being supported by the software selected. In addition to functional
capabilities , the selection of the hardware should include factors such as
reliability, support, previous experiences with equipment ( successes and failures),
and cost.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 16
. Cut to Length Controller
The following section gives the features of the hardware components with
functional descriptions.
2.2.1.1 Features
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 17
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 18
. Cut to Length Controller
2.2.2.1 Features
• All the external peripherals are isolated through the opto coupler to the
microcontroller..
• Such isolation provides the immune to the noise as well as short circuit
protection and high voltage fluctuations from the peripheral devices.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 19
. Cut to Length Controller
• The output from the controller is connected to the anode of the diode and the
peripherals like cutter relay and the pulse train to servo drive are connected
to the collector of the transistor.
• The output from the proximity switch is connected to the anode and the
collector is biased through a resistor with 3.3V. The collector also connected
to interrupt pin of microcontroller. On triggering the proximity switch
output the transistor starts conducting pulling the biasing voltage to ground
and generating low level interrupt signal to the micro controller. As shown
in the following figure.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 20
. Cut to Length Controller
1) The first and foremost criterion is that it must meet the task at hand efficiently
and cost effectively. IN analyzing the needs of a microcontroller-based
project, it is seen whether an 8-bit, 16-bit or 32 bit can best handle the
computing needs of the task most effectively. Among the other considerations
in this category are:
• Speed : The highest speed that the microcontroller supports.
• Packaging : It may be a 40 pin DIP (dual inline package ) or a QFP
(quad flat package), or some other packaging format like TSSOP (thin
shrink small outline package ). This is important in terms of space,
assembling, and prototyping the end project.
• Power consumption : This is specially critical for application purpose
or rather say available power sources.
• Cost per unit: This is important in terms of the final cost of the product
in which a microcontroller is used.
• The number of I/O pins and the features of the controller.
• How easy it is to upgrade to higher performance or lower consumption
versions.
2) The second criterion in choosing a microcontroller is how easy it is to develop
products around it. Key considerations include the availability of an
assembler, debugger, compiler, technical support.
3) The third criterion in choosing a microcontroller is its ready availability in
needed quantities both now and in the future. Currently of the leading 8-bit
microcontrollers, the 8051 family has the largest number if diversified
suppliers. By supplier is meant a producer besides the originator of the
microcontroller. IN the case of the 8051, this has originated by Intel, several
companies also currently producing 8051 based microcontrollers.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 21
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 22
. Cut to Length Controller
• Two 16 bit counter/ timers ( each may be configured to toggle a port output
upon a timer overflow or to become a PWM output ) and a 23 bit system
timer as a Real Time Clock ( RTC ).
• Enhanced UART with fractional baud rate generator, break detect, framing
error detection and automatic address detection; 400 KHz byte wide I2C
communication port and SPI ( Serial Peripheral Interface ) communication
port.
• Capture/Compare unit ( CCU ) provides PWM (Pulse Width Modulation ) ,
input capture and output compare functions.
• High accuracy internal RC oscillator option allows operation without
external oscillator components.
• 2.3 V to 3.6 V VDD operating range. I/O pins are 5 v tolerant.
• Serial flash In-Circuit Programming ( ICP ) allows simple production coding
with commercial EPROM programmers.
• Serial flash In-System Programming ( ISP ) allows coding while the device
is mounted in the end application.
• In-Application programming ( IAP ) of the flash code memory. This allows
changing the code in running application.
• Watchdog timer with separate on chip oscillator , requiring no external
components.
• Programmable port output configuration options: quasi bidirectional , open
drain, push-pull, input only.
• Eight keypad interrupt inputs. Plus two additional external interrupt inputs.
• Two data pointers
• Only +VDD ( power ) and –VSS ( ground ) connections are required to
operate the P89LPC932A1 when internal reset option is selected.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 23
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 24
. Cut to Length Controller
A liquid crystal display ( LCD) is a thin, flat display device made up of any
number of color or monochrome pixels arrayed in front of a light source or
reflector. Each pixels consists of a column of liquid crystal molecules suspended
between two transparent electrodes, and two polarizing filters, the axes of
polarity of which are perpendicular to each other. Without the liquid crystals
between them, light passing through one would be blocked by the other. The
liquid crystal twists the polarization of light entering one filter to allow it to pass
through the other.
For an 8-bit data bus, the display requires a +5V supply plus 11 I/0 lines . for a
4-bit data bus it only requires the supply lines plus seven extra lines. When the
LCD display is not enabled, data lines are in tri-state and they do not interfere
with the operation of the microcontroller.
Data can be placed at any location on the LCD. For 16x2 LCD, the address
locations are:
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 25
. Cut to Length Controller
2.2.4.1 Features :
The features include:
• 5x8 dots for each character with cursor.
• Built-in controller (KS0066U )
• Easy interface with 4-bit or 8-bit MPU
• +5V power supply ( also available for + 3 V )
• 1/16 duty cycle with inbuilt oscillator ( fosc 270 KHz )
• BKL to be driven by pin1,pin2, or pin 15, pin16 or A,K
• KS0066U function set instructions ( set display methods, set data length,
etc.)
• Inbuilt line segment driver for LCD
• Address set instructions to internal RAM
• Data transfer Instructions with internal RAM
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 26
. Cut to Length Controller
External
Pin no. Symbol Function
connection
1 Vss Signal ground for LCM
2 Vdd Power supply Power supply for logic (+5V) for LCM
3 Vo Contrast adjust
4 RS MPU Register select signal
5 R/W MPU Read/ write select signal
6 E MPU Operation (data read/ write) enable signal
Four low order bi-directional three state data
bus line. Used for data transfer between the
7~10 DB0~DB3 MPU
MPU and LCM. These four are not used
during 4 bit operation.
Four high order bi-directional three-state data
11~14 DB4~DB7 MPU bus lines. Used for data transfer between the
MPU
15 LED+ LED BKL power Power supply for BKL “A” (+ 4.2 V )
16 LED- supply Power supply for BKL “K” ( GND )
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 27
. Cut to Length Controller
• When the busy flag is 1, the controller LSI is in the internal operation mode
and the next instruction will not be accepted. When RS=0 and R/W=1, the
busy flag is output to DB7. The next instruction must be written after ensuring
that the busy flag is 0.
• Address counter (AC) assigns addresses to both CGRAM and DDRAM.
• DDRAM is used to store the display data represented in 8-bit or 4+4 bit
character code. Its extended capacity is 80x8 bits or 80 characters.
• The CGRAM generate 5x8 dot or 5x10 dot character patterns from 8-bit
character codes, and the user can rewrite character by program. For 5x8 dots,
eight character patterns can be written, and for 5x10 dots, four character
patterns can be written.
• Here for the proposed system the LCD is used in the four bit-mode as per the
application requirement. Here only higher data bits DB4~DB7 lines are
connected to the controller , and all the instructions as well as 8-bit data are
being sent through higher and lower nibble.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 28
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 29
. Cut to Length Controller
2.2.5 Keyboard
It is very important to give instant feedback to the user that a the key hit has been
acknowledged by the program. The user must know that the key has been
recognized through any indicator.
The keyboard application program must guard against the following possibilities:
• More than one key pressed ( simultaneously or released in any sequence )
• Key pressed and held
• Rapid key press and release
All of these situations can be addressed by hardware or software means; soft ware
, which is the most cost effective, is emphasized here.
The universal key characteristic is the ability to bounce: the key contacts vibrate
open and closed for a number of milliseconds when the key is hit and often when
it is released. These rapid pulses are not discernible to the human, but they last a
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 30
. Cut to Length Controller
Functional description :
• The keyboard shown in the above schematic is a 3x2 matrix keyboard.
• Initial value to the port pin is high for all the port pins (P0.1 to P0.5)
• If any key is pressed the corresponding row and column is pulled down to the
GND and here the keyboard interrupt is generated
• Here the keyboard SFRs are utilized such a way that only row can generate the
keyboard interrupt
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 31
. Cut to Length Controller
• The pattern on the keyboard is to be compared and then the corresponding key is
identified from the status of that input pattern
• The SFRs used for handling the key-board are KBMASK (Key Board Masking),
KBCON (Key Board Control) ,and KBPATN ( Keyboard Pattern)
KBMASK is set to 0E h for generating interrupt, allowing only P0.1, P0.2
and P0.3 to generate Keyboard interrupt
KBPATN is set to 0E h for allowing all inputted pattern from keyboard
except 0E h
KBCON is set to 00 h for clearing the KBI flag and pattern selecting bit
(NOT equal to the value which has been set in KBPATN register ).
(For more details on Keyboard interrupt handling refer the data sheet of
P89LPC932A1 attached.)
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 32
. Cut to Length Controller
2.2.6 Relay
A relay is an electrical switch that opens and closes under the control of another
electrical circuit. In the original form, the switch is operated by an electromagnet
to open or close one or many sets of contacts. Because a relay is able to control an
output circuit of higher power than the input circuit, it can be considered to be, in
a broad sense ,a form of an electrical amplifier.
1. Normally open (NO) contacts connect the circuit when the relays is activated;
the circuit is disconnected when the relay is inactive. It is also called FORM-
A contact or “make” contact.
2. Normally closed (NC) contacts disconnect the circuit when the relay is
activated ; the circuit is connected when relay is inactive. It is also called
FORM-B contact or “Break” contact.
3. Change over or double throw contacts control two circuits; one normally
open contact and one normally closed contact with a common terminal. It is
also called a FORM-C or “transfer “ contact.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 33
. Cut to Length Controller
1. Physical size and pin arrangement : If you are choosing a relay for an existing
PCB you will need to ensure that its dimensions and pin arrangement are suitable.
You should find this information in the supplier's catalogue.
2. Coil voltage : The relay's coil voltage rating and resistance must suit the circuit
powering the relay coil. Many relays have a coil rated for a 12V supply but 5V
and 24V relays are also readily available. Some relays operate perfectly well with
a supply voltage which is a little lower than their rated value.
3. Coil Resistance : The circuit must be able to supply the current required by the
relay coil. You can use Ohm's law to calculate the current:
Coil resistance
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 34
. Cut to Length Controller
For example: A 12V supply relay with a coil resistance of 400 passes a current
of 30mA. This is OK for a 555 timer IC (maximum output current200mA), but it
is too much for most ICs and they will require a transistor to amplify the current.
4. Switch ratings (voltage and current) :The relay's switch contacts must be
suitable for the circuit they are to control. You will need to check the voltage and
current ratings. Note that the voltage rating is usually higher for AC, for example:
"5A at 24V DC or 125V AC".
5. Switch contact arrangement (SPDT, DPDT etc): Most relays are SPDT or
DPDT which are often described as "single pole changeover" (SPCO) or "double
pole changeover" (DPCO).
Transistors and ICs (chips) must be protected from the brief high voltage 'spike'
produced when the relay coil is switched off. The diagram shows how a signal
diode (e.g. 1N4148) is connected across the relay coil to provide this protection.
Note that the diode is connected 'backwards' so that it will normally not conduct.
Conduction only occurs when the relay coil is switched off, at this moment
current tries to continue flowing through the coil and it is harmlessly diverted
through the diode. Without the diode no current could flow and the coil would
produce a damaging high voltage 'spike' in its attempt to keep the current flowing.
• The output from micro controller is connected to the base of the transistor BC548
through a resistor.
• The relay coil is connected between the +5V supply and the collector of the
transistor as shown in the figure.
• Before the output from controller triggers the transistor; it is in a cutoff level and
there is no charge across the relay coil as the circuit does not complete. Hence
relay is said in off state.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 35
. Cut to Length Controller
• Now as the controller pin goes high the transistor triggered and completes the
circuit and hence the charge across coil exists , switching the relay in on state.
• The relay remains in on state as long as the microcontroller pin is held high.
• On the other end the cutter assembly is connected between NO and COM pins,
controlling the on/off control of the cutter.
• As the relay turns on consequently it switches the cutter and the cutting of the
sheet takes place.
• Here the relay switch only controls the on/off state of cutter assembly, and the
on/off time duration depends on the type of cutter assembly, as well as cutting
duration. This can be variable for different cutter assembly , can be changed as
per the requirement.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 36
. Cut to Length Controller
The servo motor has the position encoder. This encoder has the precision bits in
terms of 2^ (X+1). This encoder is connected to the servo drive, gives the
position status of the motor shaft. One has to give the pulses to the motor such
that rotation of motor occurs in a multiple of this precision bits. This work is
actually carried out by the MP controller (refer system objectives 1.2.2). Hence
we are multiplying the precision pulses (bits) for having the virtual management
of that MP controller for our proposed unit. Also the servo parameter multiplier is
a feature of that MP controller which informs the servo drive; a single pulse to
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 37
. Cut to Length Controller
the servo motor should equal to no of pulses from the MP unit. Hence we also
use this feature for deriving final pulses per revolution.
So, the calculation for the servo parameters is carried out by following equation:
Now, number of pulses required per revolution of servo motor is given by the
following equation :
Apart from this , additional offset is required as the above equation only meets
the truncated figure. So the offset value in the length is added in terms of
micrometer for more precise value.
So the actual pulse count is now carried out from the following equation :
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 38
. Cut to Length Controller
The microcontroller uses an enhanced 80C51 CPU which runs at 6 times the
speed of standard 80C51 devices. A machine cycle consists of two CPU clock
cycles, and most instructions execute in one or two machine cycles. The device
has several internal clocks as shown in the above figure.
• OSCCLK – Oscillator Clock - input to the DIVM ( Division by Magnitude )
clock divider. OSCCLK is selected from one of four clock resources and can also
be optionally divided to a slower frequency ( see section “ CPU clock (CCLK)
modification: DIVM register in the attached datasheet of uC .)
Note: OSCCLK is denoted by fosc.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 39
. Cut to Length Controller
• CCLK- CPU Clock- output of the DIVM clock divider. There are two CCLK
cycles per machine cycle, and most instructions are executed in one to two
machine cycles ( two or four CCLK cycles).
• RCCLK – the internal 7.373 MHz RC oscillator output.
• PCLK- Peripheral Clock – clock for the various peripheral devices and is
CCLK/2.
Here we are using only internal RC oscillator using default factory settings, hence
RCCLK = 7.3728 MHz +/- 2 %. Now as we are not utilizing any other clock
source except RCCLK, the OSCCLK is equal to the RCCLK.
The OSCCLK frequency can be divided down ,by an integer , up to 510 times by
configuring a dividing register , DIVM, to provide CCLK. This produces the
CCLK frequency using following formula :
Since N ranges from 1 to 255 , the CCLK frequency can be in the range of fosc to
fosc / 510. For N = 0, CCLK = fosc.
Now fro the DIVM, the value of N is set to default zero i.e. N=0, and hence the
CCLK is also equal to RCLK.
So CCLK= fosc = 7.3728 MHz
Now PCLK = CCLK / 2
= 7.3728 / 2 MHz
= 3.6864 MHz
= 0.271 us per cycle.
( For more details on clock management please refer the user manual of
P89LPC932 attached.)
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 40
. Cut to Length Controller
2.3.3 The CCU and the calculation of Pulse train output frequency :
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 41
. Cut to Length Controller
The CCU runs on the CCUCLK , which can be either PCLK in basic timer mode
or the output of a PLL as shown in figure 2.14. The PLL is designed to use a
clock source between 0.5 MHz to 1 MHz that is multiplied by 32 to produce a
CCUCLK between 16 to 32 MHz in PWM mode . The PLL contains a 4-bit
divider to help divide PCLK into a frequency between 0.5 to 1 MHz.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 42
. Cut to Length Controller
Here the CCU timer needs only one CCUCLK cycle for increment or decrement.
But as we are utilizing symmetrical PWM, the output pin OCA will toggle on the
each compare fro both incrementing and decrementing direction as shown in the
figure 2.15. So here we are using two CCUCLK cycle or doubling the required
freq. virtually and finding the timer count value for resetting on overflow or
underflow. But the toggling occurs at the half the timer overflow value i.e. having
the desired frequency pulse on each compare.
So two CCUCLK cycle tc = 2 x 42.38 ns = 84.77 ns
1 11796 2E14
2 5898 170A
3 3932 0F5C
4 2949 0B85
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 43
. Cut to Length Controller
5 2359 0937
6 1966 07AE
7 1685 0695
8 1475 05C3
9 1310 051E
10 1180 049C
11 1072 0430
12 0983 03D7
13 0908 038C
14 0842 034A
15 0786 0312
16 0737 02E1
17 0693 02B5
18 0655 028F
19 0620 026C
20 0590 024E
21 0562 0232
22 0532 0218
23 0512 0200
24 0492 01EC
25 0472 01D8
30 0393 0189
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 44
. Cut to Length Controller
40 0294 0126
50 0236 00EC
60 0196 00C4
70 0168 00A8
This frequency is actually frequency of pulse train, whose no of pulses are derived
through the parameters considered. This frequency is actually converted to the
speed per revolution for servo motor. This conversion is done by servo drive in
pulse position mode.
( For more details on clock management please refer the user manual of
P89LPC932 attached.)
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 45
. Cut to Length Controller
2.3.4 The RTC and the calculation of cutter on/off time duration :
As the timer underflows each time the RTC interrupt is generated and
corresponding interrupt routine is being called.
Here the value of RTC timer is selected such that it decrements and reloaded with
the same value after 1 msec.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 46
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 47
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 48
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 49
. Cut to Length Controller
If you are not getting desired output DC voltages u need to diagnose the actual
problem. You should go with the following steps :
Step I : Very first step is to check the circuit as per the circuit diagram shown
in the figure 2.17.
Step II : Starting with the Transformer first, check with DMM at secondary
terminals whether you are getting the known 12-0-12 AC voltages.
Step III : Check DC voltages at the output of each bridge rectifier. For the
bridge rectifier 1 it should be more than 24 V DC and for bridge rectifier 2 it
should be more than 12 V DC. If it is not then check the connections again.
Still if you are not getting then check each diode using the DMM ( applying
forward and reverse bias).
Step IV : Check the voltages across the input capacitors, they must be same as
at the rectifier ends, otherwise it indicates that the capacitor is weak, need to
replace.
Step V: Now check the pins of the voltage regulator ICs. If any two pins of
any IC is short circuited then need to replace that IC.
Step VI : Now check the voltages across the output capacitors, should be
same as the desired ones, otherwise need to replace that capacitor.
Step VII : Check whether the voltage regulator is overheated or not, if so then
immediately switch off the supply and replace the output capacitor with higher
value capacitor (voltage capacity of that capacitor should be higher than that
desired voltage level ).
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 50
. Cut to Length Controller
** here in actual case the LCD is connected through the 16 pin cable to the
controller, which is not shown in the figure, to understand the exact
connections of LCD.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 51
. Cut to Length Controller
The figure shows the connection to the port pins of microcontroller. Actually the
microcontroller is having TSSOP package, hence the size of the controller shown
is different than the actual one but the connections remain same.
• Port configurations :
All but three I/O port pins on the P89LPC932A1 may be configured by software
to the one of four types on a pin-by-pin basis, as shown in table 2.7. These are :
quasi-bidirectional , push-pull, open drain, and input only. Two configuration
registers for each port select the output type for each port pin.
P1.5 (RST- low active) can only be an input and cannot be configured.
P1.2 (SCL/T0) and P1.3 (SDA/ INT0 low active) may only be configured to be
either input-only or open drain.
Quasi-bidirectional : This can be used both as an input and output without the
need to reconfigure the port. This is possible because when the port outputs a
logic high, it is weakly driven, allowing an external device to pull the pin low.
When the pin is driven low it is driven strongly and able to sink a large current.
There are three pull-up transistors in the quasi-bidirectional output that serve these
different purposes.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 52
. Cut to Length Controller
Open drain : The open drain output configuration turns off all pull-ups and only
drives the pull-down transistor of the port pin when the port latch contains a logic
0. To be used as logic output, a port configured in this manner must have external
pull-up, typically a resistor tied to VDD. The pull-down for this mode is the same
as for the quasi-bidirectional mode.
Input only: The input only configuration has only a Schmitt-trigger with a glitch
suppr ession circuit.
Push-pull: The push-pull output configuration has the same pull-down structure
as both the open drain and the quasi-bidirectional output modes, but provides a
continuous strong pull-up when a port latch contains a logic 1. The push-pull
mode nay be used when more source current is needed from a port output.
Now according to the requirement we can configure the each port pin. The
following table shows the port pin configuration along with peripherals
connected.
Port Physical
PxM1.y PxM2.y Mode Peripheral
pin pin
Port 0 configuration
X (0) X (0) X (QB) P0.0 03 ----------
1 0 IN P0.1 26 Keyboard (row-0)
1 0 IN P0.2 25 Keyboard (row-1)
1 0 IN P0.3 24 Keyboard (row-2)
1 0 IN P0.4 23 Keyboard (column-0)
1 0 IN P0.5 22 Keyboard (column-1)
1 0 IN P0.6 20 Control bit / stop proximity
X (0) X (0) X (QB) P0.7 19 -----------
P0M1 P0M2
= 7E H = 00 H
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 53
. Cut to Length Controller
Port Physical
PxM1.y PxM2.y Mode Peripheral
pin pin
Port 1 configuration
0 0 QB P1.0 18 TxD
1 0 IN P1.1 17 RxD
X (1) X (0) X ( IN ) P1.2 12 -----------
1 0 IN P1.3 11 EXTI0- stop proximity
1 0 IN P1.4 10 EXTI1-start proximity
1 0 IN P1.5 06 Reset switch
0 0 QB P1.6 05 LCD- RW
0 0 QB P1.7 04 LCD- RS
P1M1 P1M2
= 3E H = 00 H
Port 3 configuration
X (1) X(0) X (IN) P3.0 09 EXT CRYSTAL **
X (1) X(0) X (IN) P3.1 08 EXT CRYSTAL**
P3M1 P3M2
|= 03 H &= FC H
Port 2 configuration
0 0 QB P2.0 01 LCD (Data-0)
0 0 QB P2.1 02 LCD (Data-1)
0 0 QB P2.2 13 LCD (Data-2)
0 0 QB P2.3 14 LCD (Data-3)
0 0 QB P2.4 15 LCD ( Enable)
0 0 QB P2.5 16 Pulse on status LED
0 1 PP P2.6 27 PWM / OCA – pulse o/p
0 0 QB P2.7 28 Cutter on/off to x’nal board
P2M1 P2M2
=00 H = 40 H
• Here as shown in the figure 2.16, the peripherals are connected through
connectors only.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 54
. Cut to Length Controller
• The potentiometer of the 5 kΩ at the LCD pins is provided for the intensity of the
pixels. You can vary the intensity as one can read the content properly.
• The transistor 2N2369 is a very high speed switching transistor ,gives the pulled
up out put from the pulses outputted by pin P2.6 to the servo motor.
• The programming ports are provided for ICP programming, where programming
port 1 is used for programming data to the controller and programming port 2 is
used for triggering the microcontroller in the programming mode using precise
sequence of reset pulses along with supply and ground. ( For more information on
ICP programming please read the manual attached fro P89LPC932A1.)
• The external board connector is actually used to connect the external board which
is an isolating board, through which the proximity switches and cutter relay is
connected. It will be more clear when we see the circuit diagram of external
board.
Step II : After that check the connectivity of all the connections with the help of
DMM as shown in the figure 2.18. particularly check the connectivity of controller
pins to the connector pins.
Step III : If you are not getting the pulse output at the connector, check the pin P2.6
using CRO, if pulse is there then you have to check transistor 2N2369. Still if you are
not getting the pulse you have to replace that transistor.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 55
. Cut to Length Controller
** here the key board also consists the three power indicating LEDs not
shown in the figure.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 56
. Cut to Length Controller
• Here the circuit actually consists of a logical 3x2 matrix. Here the diodes are used
for providing the initial all the pins high as they are not conducting when the
switch is not pressed.
• The key is a 4 pin push to on type switch for which two pins are short circuited
as shown in the figure. A two pin push to on switch can also be used, with a small
change; have to remove the short circuiting path.
• Initially diode is not conducting or say in a free wheeling mode hence all rows
and columns are initially at high level. Now whenever the key is pressed the
diodes start conducting as the cathode is now connected to the ground and pulls
down the corresponding row and column to zero ( neglecting drop voltage of 0.57
V ). This triggers the port pin and according to that pulled down row and column ,
the pressed key is detected and corresponding action is to be taken by micro
controller.
• Here only the corresponding row and column is pulled down to zero because the
connections of diodes as shown in the figure 2.19 prevents a path to the ground,
hence not affecting other rows and columns keeping them to the high level (+3.3
V).
• Here the drop out voltage of 0.6 V of diode is neglected as the low level threshold
voltage for the controller pin is VTH(LH) = 0.3 VDD = 0.3 x 3.3 = 0.99 V which is
grater than the 0.6 V so the drop voltage is negligible to interpret the logic low
level ( ~ 0 V ).
• Here the supply for the key board is carried out from the main board.
• The corresponding action is to be taken as the key is pressed as shown on the
above figure with row and column downs to zero; in accordance with the Key
board interrupt SFRs.
• The resistors provided for each row and columns are actually for current limiting
as the input current sink capacity of the controller pin is low as well as the same
source is used for the microcontroller. The key board hardly draws the current of
5 mA.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 57
. Cut to Length Controller
If you are not getting desired output or the defined action is not being executed
after pressing the key from the keyboard and the main board is working properly
then need to diagnose the actual problem with the keyboard. You should go with
the following steps :
Step I : First disconnect the key board from the main board.
Step II : Check all connections and apply +3.3 V and GND to the corresponding pins
as shown in the figure 2.19.
Step III : Now check the status of all pins for rows and columns. Initially they must
be at high level. You can do this by checking the voltage level between that particular
pin and GND using DMM.
Step IV : Now press all the keys one by one. The corresponding row or column pin
must pulled down at logic ‘0’ or the voltage between that pin and GND should be zero
( neglecting the dropout voltage of 0.6 V ). If you are not finding such status change,
then check the diodes of that row or column pins using DMM .
Step V : If diodes are working properly and still you are not getting the exact output ,
then check the connectivity between GND pin and pin 2 of the key. If they are found
short circuited without pressing the key then the switch is damaged you have to
replace that switch. Again check the conductivity between pin 1 and 2 (or 3 and 4) of
the key. It should not conducting if the key is not pressed otherwise replace the
switch.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 58
. Cut to Length Controller
The external board is divided in two part the first part consists the opto-isolation of
proximity switches, and the second unit consist the isolation of cutter relay. The
provision behind this is the switching of cutter relay at higher voltage and current value
can damage the proximity switches if the connections to the connector are not made
properly.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 59
. Cut to Length Controller
10 kΩ resistor. The 3.3 kΩ resistor is provided for proper biasing of the collector
of the opto-coupler transistor .
• Initially collector output of the proximity switch is high. Whenever the proximity
senses it triggers the diode of the opto-coupler and , will conduct the transistor
leading the supply to the ground switching to the low level, which will trigger the
interrupt pin of the microcontroller.
• The supply for opto-coupler transistor is carried out from the main board through
the connector as shown in the figure 2.20 .
• The 24 V supply is directly provided so that no other external supply is required
for proximity switches.
• This 5 pin connector is connected to the first five pins of 10-pin buck strip male
connector of the main board.
• This board provides an opto-electrical isolation for microcontroller and also
suppress the noise coming from external environment through high voltage
proximity switches.
Step I : As this board is connected to the external peripherals and if you are
finding some problem, first of all you have to check whether the proximity
switches are working properly or not. For that provide the supply to the proximity
switches, take a metal sheet and bring it near the proximity switch, the output
terminal should go high.
Step III : At the connector pins the now check the status . Initially they must be
at high level. You can do this by checking the voltage level between that
particular pin and GND using DMM.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 60
. Cut to Length Controller
Step IV : The CNTRL, stop proxi and start-proxi pin are high (+3.3 V) till the
proximity switch has not sensed. Once the switch has sensed, the level should be
pulled down to the GND (0 V between that pin and GND pin).
Step V : Now for the opto-coupler, apply the +24 V and GND to anode and
cathode respectively ( pin 1 and 2 ) . Now using DMM check the voltage level
across collector and emitter it should be 0.6 V or less ( forward drop out voltage ).
Now remove the supply from anode or cathode, the LED will turn off and the
voltage level across collector and emitter should be 3.3 V. If it is not so then you
have to change the Opto-coupler IC.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 61
. Cut to Length Controller
• The last pin of 10-pin buck strip male connector , a cutter output triggers the two
transistors BC548. The transistor Q1 is used to trigger the cutter relay an
transistor Q2 is used to trigger the opto coupler. Here u can directly connect the
LED which is for the cutter relay on/off indication without using the opto-coupler.
• Here transistors Q1 and Q2 are provided because the load current capacity or say
driving capacity of the microcontroller pin output is low. Hence we require to
pull up the driving capacity through the transistors.
• Here the relay coil is connected between +5 V and the collector of transistor
Q1.The freewheeling or protection diode is connected across the relay coil to
provide the discharge path.
• The capacitors at the supply connector are provided to reduce the flickering or
ripples while relay switching.
• Now initially the supply path for charging the relay coil as well as the path for
opt0-coupler LED is not completed , as the transistors Q1 and Q2 are not
conducting
• When the cutter output pin goes high at the end of pulse train, both the transistors
Q1 and Q1 triggers simultaneously, completing the path- triggers the relay coil to
charge and switching in the on state. At the same time the LED also on when the
transistor Q2 is conducting.
• The relay and the LED remains on till the cutter output is high according to the
time delay is set.
Step II: Now check the transistors BC548 , the voltage across collector and
emitter should be 5 V.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 62
. Cut to Length Controller
Step III : Now for the opto-coupler, apply the +5 V and GND to anode and
cathode respectively ( pin 1 and 2 ) . Initially the LED of opto-coupler is off, if the
cutter pin goes high , it triggers both the transistors Q1,Q2. Now using DMM
check the voltage level across collector and emitter it should be 0.6 V or less (
forward drop out voltage ). Now remove the supply from anode or cathode, the
LED will turn off and the voltage level across collector and emitter should be 5 V.
If it is not so then you have to change the Opto-coupler IC.
Step IV : If the relay is not triggering, first apply the 5 V across the coil of the
relay, you will immediately hear a knocking voice of the relay and the output
terminals are now short circuited; if it is not then change the relay.
Step V: Now still the relay is not switching then, check the protection diode
across the coil terminals. Now check the voltage level across collector and emitter
of the transistor Q1 it should be 5 V when no triggering occurs if it is not then
replace the transistor.
Step VI : Now if the cutter Led is not glowing while switching then check the
polarity of the LED again, still it is not glowing then check the LED using DMM.
Then follow the step 3 again for opto-coupler.
Step VII : The voltage across the capacitors must be equal to + 5V. If it is not
then it means the capacitor is sinking a current hence it is weak need to replace
it.
So here in this chapter we have seen different units of entire system hardware
with discrete functionality. The functionality of the hardware should be same as
described, if it is not then refer the trouble shooting for each circuit. The
initializations of these unit through the software routines and the flow charts are
given in the next chapter.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 63
. Cut to Length Controller
.. . . .
System flowcharts
System
Software
3. Study Of Existing
Testing result
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 64
. Cut to Length Controller
START
NO
IF KEY IS
PRESSED
?
YES
END
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 65
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 66
. Cut to Length Controller
START
END OF INITIALIZATION
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 67
. Cut to Length Controller
START
END OF INITIALIZATION
START
END OF INITIALIZATION
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 68
. Cut to Length Controller
NO
START PROXIMITY SWITCH
HAS SENSED
?
YES
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 69
. Cut to Length Controller
IS ‘ctrl’ NO
TEMPORARY BIT A
SET
?
YES
IS ‘tstop’ NO
TEMPORARY BIT
SET
?
YES
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 70
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 71
. Cut to Length Controller
IS INTERRUPT CAUSED NO
BY RTC
?
YES IS INTERRUPT NO
CAUSED BY
WATCHDOG TIMER
CLEAR ‘pulsled’ AS AN INDICATION OF ?
PULSE TRAIN IS OVER
YES
D
INCREMENT ‘rtccnt’ BY ONE AS
APPROACHING TOTAL ON TIME DURATION
FOR CUTTER ASSEMBLY
NO IS
rtccnt < time
?
YES
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 72
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 73
. Cut to Length Controller
IS P0.4=0
AND NO
P0.5=1
?
COLUMN=1
YES
COLUMN=0
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 74
. Cut to Length Controller
ON EVERY COMPARE EVENT OF CCU TIMER THE CCU TIMER INTERRUPT FLAG
IS SET AND THE CCU INTERRUPT ROUTINE IS EXECUTED
YES
IS
‘A’ < ACTUAL PULSE COUNT
?
NO
SET THE ‘cnt_flag’ FOR RESUMING THE RTC TIMER AT THE END
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 75
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 76
. Cut to Length Controller
To create a new project, simply start Micro vision and select “ Project” “ New
Project” from the pull-down menus. In the file dialog that appears, choose a name
and base directory for the project. It is recommended that a new directory be
created for each project, as several files will be generated. Once the project has
been named, the dialog shown in the figure below will appear, prompting the user
to select a target device. In this lab, the chip being used is the “ P89LPC932A1”,
which is listed under the heading “NXP ( founded by Philips)”. This procedure for
selecting a device is shown in the following figure.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 77
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 78
. Cut to Length Controller
Next a file must be added to the project that will contain the project code. To do
this, expand “Target 1” heading, right click on the “Source Group1” folder, and
select “Add files…” Create a new blank file ( the file name should end in “.asm”
or “.C ” ), select it, and click “Add”. The new file should now appear in the
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 79
. Cut to Length Controller
“Project Workspace” pane under the “Source Group1” folder. Double click on the
newly created file to open it in the editor. All code fro this lab will go in this file.
To compile the program, first save all source files by clicking “Save All” button,
and then click on the “Rebuild All Target Files” to compile the programs as
shown on the figure below. If any errors or warnings occur during compilation,
they will be displayed in the output window at the bottom screen. All errors and
warning will reference the line and column number in which they occur along
with a description of the problem so that they can be easily located. Note that
only errors indicate that the compilation failed, warnings do not ( though it is
generally a good idea to look into them anyway).
Figure 3.3 “ Save all” And “ Build All Target Files” Options
When the program has been successfully compiled, it can be simulated using the
integrated debugger in Keil µVision3. To start the debugger, select “ Debug”
“Start/ Stop Debug Session” from the pull down menus.
At the left side of the debugger window, a table is displayed containing several
key parameters about the simulated microcontroller, most notably the elapsed
time ( circled in the figure below). Just above that , these are several buttons that
control code execution. The “Run” button will cause the program to run
continuously until a breakpoint is reached, whereas the “Step Into” button will
execute the next line of code and then pause (the current position in the program
is indicated by a yellow arrow to the left of the code).
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 80
. Cut to Length Controller
Breakpoints can be set by double–clicking on the grey bar on the left edge of the
window containing the program code. A breakpoint is indicated by a red box next
to the line of code.
The current state of the pins on each I/O port on the simulated microcontroller can
also be displayed. To view the state of a port, select “Peripherals” “I/O Ports”
“Port n” from the pull–down menus, where n is the port number. A checked
box in the port window indicates a high (1) pin, and an empty box indicates a low
(0) pin. Both the I/O port data and the data at the left side of the screen are
updated whenever the program is paused.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 81
. Cut to Length Controller
Figure 3.5 ‘Reset’, ‘Run’ and ‘Step into’ options for Debugging Window
The debugger will help eliminate many programming errors, however the
simulation is not perfect and code that executes properly in simulation may not
always work on the actual microcontroller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 82
. Cut to Length Controller
A unique feature of the Keil µVision3 IDE is the Device Database, which
contains information about more than 400 supported microcontrollers. When you
create a new µVision3 project and select the target chip from the database,
µVision3 sets all assembler, compiler, linker, and debugger options for you. The
only option you must configure is the memory map.
The µVision3 Debugger provides complete simulation for the CPU and on-chip
peripherals of most embedded devices. To discover which peripherals of a device
are supported, in µVision3 select the Simulated Peripherals item from the Help
menu. You may also use the web-based Device Database. We are constantly
adding new devices and simulation support for on-chip peripherals so be sure to
check Device Database often.
The programmer used is a powerful programmer for the Philips NXP 89C51
series of microcontrollers that includes P89LPC 9XX, P89V51RXX,
P89CV51RXX ,P89LV51RXX, P89V52X2,LPC2000 and all the NXP controllers
which have the facility of ICP or ISP programming.
It is simple to use & low cost, yet powerful flash microcontroller programmer for
the NXP 89C51 series. It will Program, Read and Verify Code Data, Write Lock
Bits, Erase and Blank Check. All fuse and lock bits are programmable. This
programmer has intelligent onboard firmware and connects to the USB port. It can
be used with any type of computer and requires a special hardware. All that is
needed is a USB communication port which all computers have.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 83
. Cut to Length Controller
All devices also have a number of lock bits to provide various levels of software
and programming protection. These lock bits are fully programmable using this
programmer. Lock bits are useful to protect the program to be read back from
microcontroller only allowing erase to reprogram the microcontroller.
Major parts of this programmer are USB port, Power Supply, and a special
hardware Board provided with the Firmware.
All the programming ‘intelligence’ is built into the programmer and all the data is
sent or received through the USB. Programmer comes with window based
software for easy programming of the devices.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 84
. Cut to Length Controller
‘Smart ICP 1.2’ is a software working as a user friendly interface for programmer
board from ‘Potent embedded solutions’. ‘Smart ICP 1.2’ gets its name from
“Program Loader” term, because that is what it is supposed to do. It takes in
compiled HEX file and loads it to the hardware.
Any compiler can be used with it, Assembly or C, as all of them generate
compiled HEX files. ‘Smart ICP 1.2’ accepts the Intel HEX format file generated
from compiler to be sent to target microcontroller. It auto detects the hardware
connected to the USB port. It also auto detects the chip inserted and bytes used.
The software requires no overhead of any external DLL.
The programmer connects to the computer’s USB port with a standard USB to
mini USB cable. No PC Card Required.
After making the necessary selections, the ‘Program’ button is clicked as shown
in the figure below which burns the selected hex file onto the microcontroller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 85
. Cut to Length Controller
• Open the ‘Smart ICP 1.2’ software window and click on the search device
button two or more times. It will automatically identify the controller
Device
• Now click on the ‘select hex file’ button, browse the hex file to upload ,
and click download button .
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 86
. Cut to Length Controller
• Now click on the ‘ update configuration’ button and then click on the ‘start
programming’ button.
• The programmer will automatically erase and blank Checks the flash
memory and verify code data, write Lock Bits. After getting “Verify Ok”
, disconnect the board from the USB also discard the connectors, re-
assemble the main board.
• Now the micro controller is programmed perfectly and ready to run the
system hardware.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 87
. Cut to Length Controller
So, the above steps are very helpful for programming the microcontroller device.
For that you do not need to detach the microcontroller from the system board, just
simply connecting the two connectors and using the above software tool we can
easily program the microcontroller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 88
. Cut to Length Controller
Let,
Servo parameter multiplier : 0 1
Precision pulses (bits) in terms of 2^ X : 1 1 ( as per standard value )
Feed roller diameter : 0 0 8 0 mm
Required Length of the sheet : 0 2 5 1 mm
Offset length : 3 2 7 2 um
Gear ratio : 0 1
RESULT:
On sensing the start proximity switch the pulse train is generated and fed to the
servo drive. The drive is connected to motor and motor shaft is directly connected
to the feed roller, which completes exact one rotation for desired length
independent of the pulse frequency.
Here the pulse frequency only decides rotation speed; higher the frequency ,
higher the speed towards completing the task.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 89
. Cut to Length Controller
So, in this chapter we come to know about the flowcharts of different units as a
consequence of developing the software routines. Also we come to know about a
very powerful software developing tool Keil µvision3. Also we have the testing
result which tells , how the precise system has been built.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 90
. Cut to Length Controller
... . . .
Hardware installation manual
System
Final prototype
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 91
. Cut to Length Controller
First of all we are going to see the hardware installation for the unit. The following figure
shows the actual hardware connection.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 92
. Cut to Length Controller
As connection done as shown in the above figure now go through following steps.
The following steps are mandatory:
Step I: The pin connections are to be made very carefully for CN1 as given in
the following section.
Step-II : Check all the connections very carefully.
Step-III : Do not connect the servo motor directly to the belt assembly without
testing.
Step-IV : Switch on the power supply of C2L first, and wait till the welcome
messages are over.
Step-VI: Set the parameters for pulse position mode for the servo drive as given
in the following section.
Step-VII: On completing step-V switch off the drive supply and again switch on
the drive supply.
Step-VIII : Feed the parameters through the keyboard as given in section 3.5
Testing Result. If you are getting the same result by feeding those parameters then
the motor can be now connected to the belt assembly.
Note: In case of switching off the entire unit, first of all switch off the servo
assembly first and then & then switch off the C2L unit.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 93
. Cut to Length Controller
Setting Parameters:
Set the following parameters for position control using pulse train.
Set the input form for the SERVOPACK using parameter Pn2000.0 according to
the host controller specifications.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 94
. Cut to Length Controller
The internal processing of the SERVOPACK for the clear signal can be set to
either of four types by parameter Pn200.1. Select according to the specifications
of the machines or host controller.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 95
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 96
. Cut to Length Controller
This sets the servo ON signal (/S ON) that determines whether the servomotor
power is ON or OFF.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 97
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 98
. Cut to Length Controller
Display Layout 1:
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 99
. Cut to Length Controller
Display Layout 2:
Display Layout 3:
Display Layout 4:
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 100
. Cut to Length Controller
Display Layout 5:
Display Layout 6 :
Display Layout 7:
Now again pressing the enter key , it comes to the display layout1 by recalculating
the desired count and rewriting all parameters to the EEPROM again.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 101
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 102
. Cut to Length Controller
CONCLUSION
A step by step approach in designing the microcontroller based system for cutting
the desired length of the sheet and control for essential parameters for SERVO
PACK and belt assembly. The result obtained from the calculation have shown
that the system performance is quite reliable and accurate.
The system has successfully overcome quite a few shortcomings of the existing
systems by reducing the power consumption, maintenance and complexity, at the
same time providing a flexible and precise form of maintaining the requirement.
Although the enhancements for the system, the required technology and
components are available, many much systems have been independently
developed, or are at least tested at a prototype level. Also, integration of all these
technologies is not a daunting task and can be successfully carried out.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 103
. Cut to Length Controller
FUTURE SCOPE
The performance of the system can be further improved in terms of the operating
speed, memory capacity, instruction cycle period of the microcontroller by using
other advanced microcontrollers.
The device can be made to perform better by providing the power supply with the
help of battery source which can be rechargeable or solar powered, to reduce the
requirement of main AC power.
A multi controller system can be developed that will enable a master controller
along with its slave controllers to automate multiple conveyor belt assembly
simultaneously.
With further modifications for the software and hardware we can automate the
multi dimensional cutting with higher precision without the need of MP machine
controller. The same system can be used in metal industry for metal sheet cutting
with the further modifications.
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 104
. Cut to Length Controller
REFERENCES
White Papers
[2] Turnell, D.J de Fatime, Q.V., G.S. Freire, An integrated, modular industrial
automation system, Proceedings of IEEE International Conference On Systems,
Man, and Cybernetics, Vol.2 , Oct 1998.
Books
[1] Muhammad Ali Mazidi, Janice Gillispie Mazidi, ROlin D. MC Knlay, The 8051
Microcontroller & Embedded Systems, Pearson Education Inc. 2nd Edition, 2008.
Web sources
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 105
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 106
. Cut to Length Controller
ANNEXURE-I
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 107
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 108
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 109
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 110
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 111
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 112
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 113
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 114
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 115
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 116
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 117
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 118
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 119
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 120
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 121
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 122
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 123
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 124
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 125
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 126
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 127
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 128
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 129
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 130
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 131
. Cut to Length Controller
ANNEXURE-II
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 132
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 133
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 134
. Cut to Length Controller
___________________________________________________________________________________________
V.T Patel Department Of Electronics & Communication Engineering 135