Anda di halaman 1dari 87

CERTIFICATE

IRMA I STITUTE OF TECH OLOGY

AHMEDABAD

I hereby certify that the following students of B.E. IV, Semester VII,
Instrumentation and Control have satisfactorily completed their project on

‘SURVEILLANCE ROBOT WITH REMOTE CONTROL AND END EFFECTOR’


EFFECTOR’
at
ARRAYCOM INDIA LTD.

SR. NO. NAME ROLL NO.

1 ABHIJIT KARNIK 00IC28

2 NISHANT KAUSHIK 00IC29

3 HARSH SATYAPANTHI 00IC44

(Prof. J.B. Patel) (Dr. M.D. Desai)


I TER AL GUIDE HEAD OF THE ELECTRICAL
E GI EERI G DEPARTME T

DATE:
Project
Project Report
7th Sem I.C.

ACKOWLEDGEMET:

As students of the final year of engineering (Instrumentation & Control), we are


required to undertake a project for the 7th and 8th semesters. Our project is titled
“SURVEILLANCE ROBOT WITH REMOTE CONTROL AND END EFFECTORS”.
Herewith is encapsulated a report of the same.
In our attempt, we have come to realize that robotics is a field which is not just an
isolated field on its own. It is the fusion of a number of concepts from all the major
engineering fields. Hence our journey has had a number of guides, each one from a
different field. In submitting this report, we, the undersigned, would like to take the
opportunity to thank all these people, without whose help our modest endeavour would
never have seen the light of the day.
Thereby we take immense pleasure in thanking Mr. Kedar Thanki and Mr. S.J.
Dhru (Arraycom (I) Limited) who were our External guides, Dr. M.D. Desai (HOD,
Electrical Dept.), Prof. J.B. Patel(Asst. Prof., IC Dept., & Internal Guide), Prof. B.B.
Kadam (Prof., Electrical Dept.), Mr. H.K. Patel (Lecturer, IC Dept.), Prof. Y... Trivedi
(Asst. Prof., EC Dept.), Ms. Gauri Mudaliar (Lecturer, Mechanical Dept.), Mr. Sudhir
Raval (DI. Engg. Ltd) and Mr. Purendere (Syntronics Pvt. Ltd.)
We would also like to acknowledge the enthusiastic support that was given to us
by the faculty of I.C. Dept., who not only gave us moral support but were actively
interested in our project through all its ups and downs.
Last but not the least; we would like to acknowledge the unquestioning and
untiring support from our families.

Abhijit Karnik (00IC28)


ishant Kaushik (00IC29)
Harsh Satyapanthi (00IC44)

Nirma Institute of Technology


XABRE
Project
Project Report
7th Sem I.C.

FOREWORD:

The word robot was coined by the Czech writer Kapek in his play ‘Rossum's

Universal Robots’. Since then countless devices have been created and have been

associated with the word ‘Robot’. The works of Isaac Asimov have laid the foundation of

sociology pertaining to the use of robots instead of humans and the word ‘Robotics’ was

also coined by him. In today’s world, work on robots, that resemble and look almost

human, and others which don’t resemble humans in any way, progresses in leaps and

bounds. The world has forerunners in this technology like MIT, CMU, Sony, Honda etc.

In this world of ASIMO, AIBO, Packbot etc., we have made an attempt to create a device

which we dare call ‘Robot’.

Perhaps the most important work of Isaac Asimov could be considered to be the

coining of the 4 Laws of Robotics. One of the fundamental concepts of robots made

famous by the Zeroth Law of Robotics by Asimov: “A robot may not injure humanity, or,

through inaction, allow humanity to come to harm.” We have tried to create a system

which will allow safeguarding of life. We plan to achieve this by way of allowing the

robot to take the place of humans in situations which hold a potential threat to human life.

Our attempt was to provide a tool to the enforcers of law and order that could allow them

to access and assess a situation which could hold avoidable threat to human life.

Nirma Institute of Technology


XABRE
Project Report
7th Sem I.C.

ITRODUCTIO:
This report is the documentation of all the efforts that went into the making

of Xabre. The title of the project was coined as:

‘Surveillance Robot with Remote Control & End Effectors’,

shortened to Sabre, (a type of sword) and going with the spirit of prototypes having

an ‘X’ in their name, we arrived at ‘Xabre’. Xabre is targeted to be a ‘Technology

Demonstrator’ prototype, wherein an attempt has been made such that the presently

available systems are integrated in a particular fashion, to accomplish a specific task.

This report is divided into 6 sections. Each section deals with the project

from a different viewpoint. The first section deals with the purpose of the robot, the

features it has and the system block diagram. The second section deals with the

operational description of the different modules of the robot which thereby allow the

proper functioning of the features that we have planned to implement on the robot.

The third section is the hardware and software section wherein the mind and the

nerve control of the robot is explained. The fourth section deals with the mechanical

design of the system. The fifth section contains the summary of different

technological fundamentals that were considered for use in the system as well as the

selection of the integrated circuit chips used in the project. The last section is the

annexure containing the selected sections of the datasheets of the electronic

components used in our project, bibliography, information about the sources of the

system’s components and the future development or design modifications that we

can implement but couldn’t due to various constraints..

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

SECTIO 1
PROJECT OBJECTIVES:

The features that we have planned to implement on the robot are as follows:

1. Locomotion
2. Camera vision
3. Pan/Tilt motions for camera
4. Self-righting mechanism
5. Gripper mechanism
6. Extension operations
7. Path Illumination

Locomotion is the fundamental feature of the system since the system is a

mobile one. An easily maneuverable system implementing a differential tank-style

drive has been thought of. The differential drive also has a multi-speed operation

facility too.

The surveillance objective requires a camera to be mounted on the system. The

video information that is acquired by the camera has to be transmitted to the base

controller (called Zeus from now on) The HMI part of Zeus displays the video to the

human operator.

The additional requirement is that the camera should be able to cover the

maximum space around it, without the mobile robot (called Xabre from now on)

being required to rotate or move. This facility is provided by Pan/Tilt feature. This

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

allows the human controller to change the Point of View (POV) of the camera

easily.

The self-righting feature provides for a very versatile operation of the robot over

uneven terrain. In case during navigation, Xabre turns upside down, we can actually

flip it to right side up without the intervention of the human controller. This is done

automatically by the self-righting feature.

The gripper feature is the small object manipulator provided on Xabre to allow it

to physically interact with its environment and place or retrieve small objects into

the target location. The gripper has a single Degree of Freedom (DoF) apart from the

gripping action.

Xabre is targeted to be deployed into environments wherein, it may be loaded

with other tools that are required for it to perform desired tasks. Since it would be

improper to not provide the facility for the direct control of such tools without

additional overhead of hardware, we have already provided for the extension tools.

As of now a minimum of 5 such tools can be controlled by Zeus.

At times, Xabre may have to venture into areas where there is minimal light. In

such cases, since we can’t implement IR vision systems (reason being cost

constraints); we have the path illumination feature. This allows the camera to be able

to see the region ahead of it, after being illuminated.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

TARGET APPLICATIOS:

The target applications are surveillance and object retrieval purposes, basically

where it is practically difficult for humans to venture. The need to have a system like

the one we have designed is commonly felt in certain cases very frequently. One of

such target applications, for which this project was designed, is the case of hostage

situation. Another situation being a criminal is hiding in a house. In either situation,

the law enforcement officials would find it very convenient to not risk any human

life by sending someone inside. Instead, if Xabre is sent in, it can peruse the

surroundings and communicate, to the officials outside, the scene inside through

Zeus.

Xabre can also be used to approach and investigate any suspicious object which

could be hazardous. For this purpose, the gripper mechanism which has the ability to

grasp and extricate small objects, can actually manipulate or extract such objects

which are accessible to it. Since the beginning of the project, we have tried to design

a system which can easily be upgraded with the minimum effort. As a result of this,

the present design allows for the implementation of system upgrades in form of

extension operation tools. The extension operations make the Xabre versatile and

upgradeable. It can be fitted with upto 5 tools that can perform remotely controllable

tasks. For e.g. when equipped with a miniaturized metal detector, Xabre can also be

used for detection of personnel landmines which have some metallic structure.

Additionally Xabre can be used to navigate into ducts or small places that are not

easily accessible by humans and investigate faults in equipment placed there.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Technology
Nirma Institute of Technology
XABRE
Project Report
7th Sem I.C.

SYSTEM BLOCK DIAGRAM (explanation)

The stated target is to implement a robotic vehicle which can be manually

controlled using a wireless link and perform specific functions. The application of

the device as a mobile surveillance system and a small object manipulator requires

the presence of vision and a small gripper system onboard the vehicle. The vehicle

also incorporates a feature called self-righting. The additional features to be

implemented in the system are the pan/tilt operation of the camera & path lighting.

For further development and tool addition, provision for 5 extension operation tools

is also provided. The whole project is hence broadly divided into the following

modules:

Module List

M01. PC Control Module (Human Machine Interface or HMI)

M02. Locomotion Module

M03. Self-Righting Module

M04. Pan/Tilt Module

M05. Gripper Tool Module

M06. Extension Tools Module

M07. System Controller & Power Module

M08. Control Communication

M09. Camera Module (Video Acquisition, Transmission and Reception)

M10. Light Module

The modules are present over both the Zeus control and Xabre bot. The
module definition basically separates out sets of hardware doing a specific common
objective task.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

The above modules can be broadly divided into 2 parts by way of location:
1. Zeus (The Control) : The immobile PC side systems including modules:
M01, M08 (partially) & M09 (partially)
2. Xabre (Bot): The actual robot including modules: M02, M03, M04, M05,
M06, M07, M08 (partially), M09 (partially) & M10

The system block diagram shows how the operation of the Xabre is carried out.
The human controller determines an action to be carried out. Then he/she gives the
corresponding directive to the Human Machine Interface (HMI) which is a VB form
object present on the PC monitor screen. The HMI does the required processing of
the directive and generates a bit pattern which is basically a command that the µC on
Xabre can understand. It sends the directive to the Transmitter module on Zeus
through the COM port. The Transmitter module then transmits the command to
Xabre.

The receiver module on Xabre receives the command and sends it to the C
through its Serial UART 0. The µC then processes the command and detects as to
for which module the command is for, based on the bit pattern. It then actuates the
module as required. Some modules have their own feedbacks to the µC. These are
basically limit indicators and for these modules, the µC checks for limit status before
actuating the module.

The Camera module is kept entirely isolated from this control scheme. This
module being a fully separate and ‘plug n play’ system, has its own communication
system. It sends back the video data to Zeus, wherein the receiver o/p is converted to
PC display compatible form and displayed onto the PC monitor screen. The pan/tilt
operation of the camera is listed separately because it is under direct control of the
µC and is a separate entity than the Camera module.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

TARGETS FOR 7TH SEMESTER


The project development requires the generation of mechanical structure,
controller circuitry and operating software for the system. The 7th semester
objectives were hence:
1. Complete Design and Analysis: The whole system, its objectives,
architecture of the hardware, mechanical systems and finally the software
architecture was to be complete on paper so as to serve as a reference for the
further steps in development.
2. Mechanical Systems: Piecewise testing of the whole system would prove
unsatisfactory in a project as this one, where the electronics play an equal
and important role as the mechanical assembly. Hence the most important
objective was to have a fully functional mechanical system.
3. Preliminary system integration: We plan to complete the operational
integration of the system so that its basic locomotory function can be
activated.
4. HMI Software and PC side controller: The system’s HMI that allows
commands to be sent to Xabre along with the camera output display on the
PC screen. Hence the targeted controller for Xabre also features in the targets
for 7th semester.

Ground Reality
The projected targets have been somewhat satisfactorily met after a number
of obstacles. The whole mechanical design has been carried out by us, without any
external help, using AutoCAD 2000i software. The system architecture and the
software design for the µC has been completed. The software implementation for the
µC for some of the modules has been completed for this semester.
The delays caused due to availability of motors, mechanical structure
manufacturing etc were the main obstacles in the achievement of the objectives.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

SECTIO 2
Function Description:
The modules are controlled remotely or otherwise by way of functions, each
of which is defined for a specific module. The function defines the activities of the
module based on the commands or external input received by the module. These
functions are normally executed when either a command is received or any interrupt
is received from the interrupt i/ps. The general program then performs the task of
continually ascertaining if the control communication link is still active or not. All
the actuatory actions are only executed as responses to interrupts. The functions are
explained below:

Functions:
1. Locomotion (Ref M02):
Class: Manual Control
Description: The robot works on the tank-style drive. The differential motion
generated by the 2 motors gives the required direction navigation and
maneuverability. The magnitude and the direction are specified in the
commands. The driver IC (the LMD18200T) accepts PWM input only. For this
purpose, we are using Timer 0 in mode 1 to generate the PWM output for both
the drives simultaneously. The locomotion motors on the right and left of the
system are driven by 2 bit signals each. 1 bit determines the direction and the
other bit provides PWM o/p. The port P0’s lower nibble is utilized for this
purpose. This is the only module under the control of the µC that doesn’t use the
system bus (viz. Port P1 as the data bus and bits of Port P2 used for the device
select)
Sensors: none
Inputs: none
Command Bytes: 2 (10Y-Di-MMMM)
Internal Status Bytes: Locomotion Byte (Loc_Byte)
External Port Bytes: 4 bits (RDRPWM-LDLPWM)

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

2. Self Righting Auto


Class: Auto Control
Description: When the system overturns, this function detects the overturning
and carries out actions to make sure that the system flips over back to upside up
position. This is carried out by first rotating the arms CW until the system flips
over properly. When the system has flipped upright, the SR arms are brought
back to lock-in position by rotating the Sr arms ACW. Additionally a manual
override for the command is also provided. This is obtained by the SR disable
command. System carries out the sequence of righting the system if it flips over
while disabling locomotion during operation. It also restarts locomotion after
sequence is over. Self righting has 2 steps. First, on detection of flip-over
through sensor, initiate ‘OPEN’ action of self-righting arms. Second, on
detection of flip-right through sensor, initiate ‘CLOSE’ action and continue it till
sensor indicates lock-in of arms.
Sensors: 1 tilt sensor, 3 IR LED-PXTOR pairs
Inputs: 4 bits, interrupt driven
Command Bytes: X1 (1 bit)
Internal Status Bytes: SR Status Byte (SR_Stat_Byte)
External Port Bytes: 2 bits (SRMSRD)

3. Self Righting Manual


Class: Manual Control with auto trip
Description: In some cases the operation of the SR arms is required to raise the
front end of the robot. For this manual operation is implemented to either open
the SR arms outwards or inwards as per command issued. Also the limiting
position is determined by either the stop command or the lock-in/extremity
position being achieved. Hence on receiving Zeus command and if lock-in is
true, C initiates ‘M_OPEN’ action of self-righting arms. Stop opening when
‘M_OPEN’ limit is reached. OR On Zeus command, if lock-in is true, initiate
‘M_CLOSE’ action. Stop closing when ‘M_CLOSE’ limit is reached. If lock-in
is not true for either close command continue till lock-in is true. If new Zeus

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

command is received before the end of the previous Zeus command, the older
one is discarded. These commands are scrapped if the Self Righting Auto action
is triggered.
Sensors: 3 IR LED-PXTOR pairs (Same as Self Righting Auto)
Inputs: 3 bits, interrupt driven.
Command Bytes: 2 bits (XY)
Internal Status Bytes: SR Status Byte (SR_Stat_Byte) [Same as Self Righting
Auto]
External Port Bytes: 2 bits (Same as Self Righting Auto)

4. Gripper Operation.
Class: Manual Control with auto trip
Description: This function pertains to the micro-manipulator implemented on
Xabre used to grip and lift (if required) small objects (size < 10 cm). The
implemented system has a total of 4 functions to perform. The first 2 pertain to
the direct gripping action. These are namely: Gripper Open and Gripper Close.
They are limited by Gripper Open Limit Switch and the Gripper Close Limit
Switch. The Gripper Open Limit Switch prevents damage to either motor or
gripper if we try to open it beyond its limit. The Gripper Close Limit Switch
prevents damage to motor or gripped object when gripper is closing. The
additional system functions are namely: Lift and Drop. The Lift function allows
the Gripper to rise up by 300o after gripping object, such that the object is lifted
off the ground. This allows Xabre to move, after having picked up the object and
ensuring that the object is not dragged while Xabre is moving. Drop function is
required to place the object back on ground after returning to the base station.
Sensors: 4 microswitches
Inputs: 4 bits, interrupt driven.
Command Bytes: 4 bits (AB UV)
Internal Status Bytes: Gripper Status Byte (G_Stat_Byte)
External Port Bytes: 2 bits (G1G2 G3G4)

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

5. Pan/Tilt of Camera.
Class: Manual Control with auto trip
Description: The camera module is independent in its operation of image
acquisition and data transmission. However the system is not equipped with the
ability to change its POV on its own. This requires a setup to physically rotate
the camera so as to move its POV Camera panning or tilting is carried out as per
the Zeus commands sent to it. The panning action is limited to 300o by limit
switches on either extremities and the tilting action is limited to 135o by limit
switches on either extremities. The action is continued until one of the
microswitches is tripped or Zeus command orders a stop.
Sensors: 4 microswitches.
Inputs: 4 bits, interrupt mode
Command Bytes: 1 byte (110- _ - CD - EF)
Internal Status Bytes: P/T Status Byte (PT_Stat_Byte)
External Port Bytes: 4 bits (TDTM - PDPM)

6. Light Operation
Class: Manual
Description: The light function is manually controlled and lights up only when
the system is asked to switch it on. This is essential for surveillance as Xabre
should let its presence known only when there is explicit need for the same.
Light is turned on after receiving ‘Turn_On’ command from Zeus. On receiving
‘Turn_Off’ command from Zeus, the light is turned off. Light provides only
forward path lighting only presently. The light system can be attached to the PT
System to allow it to have the same POV as the camera.
Sensors: none
Inputs: none
Command Bytes: 1 bit (G)
Internal Status Bytes: l (SR_Stat_Byte)
External Port Bytes: 1 bit (L)

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

7. Extension Operations 1
Class: Manual with no processing
Description: Used for allowing additional tools to be added to the system.
Extension Ops 1 carries the 3 bit command and a 1 bit command for the
extension tools.
Sensors: none
Inputs: none
Command Bytes: 111 - 0 – E31E32E33 – E41
Internal Status Bytes: Higher order nibble of Extension Byte (Extn_Byte)
External Port Bytes: 4 bits (HIJK)
8. Extension Operations 2
Class: Manual with no processing
Description: Used for allowing additional tools to be added to the system.
Extension Ops 2 carries the 2 bit command and two 1 bit commands for the
extension tools.
Sensors: none
Inputs: none
Command Bytes: 111 - 1 - E21E22 – E11 – E51
Internal Status Bytes: Lower order nibble of Extension Byte (Extn_Byte)
External Port Bytes: 4 bits (NOQR) (same byte as Ext Ops 1)
9. Reset Operation
This operation sets Xabre to initial operative stage loading default values for the
system.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Zeus Command Byte Definitions:


The µC is configured to accept commands over the wireless link from Zeus. These
commands are hence called Zeus Commands. The command structure of the same is
shown below:
Brief definitions
Core Information Indicated Functions
Class D4 D3 D2 D1 D0
000 1 1 0 0 0 Reset
010 1 0 0 1 1 Test Command 1
011 1 0 1 0 1 Test Command 2
001 0 A B V U Gripper 1 and 2 Command
001 1 X Y 1 X1 SRM & SR Auto Override Command
100 Di M3 M2 M1 M0 Left Drive Command
101 Di M3 M2 M1 M0 Right Drive Command
110 G C D E F Light and Pan/Tilt Command
111 0 E31 E32 E33 E41 Extension Ops 1
111 1 E21 E22 E11 E51 Extension Ops 2

Detailed explanation:
I. Two bit commands
Bit SRM Pan Tilt Gripper 1 Gripper 2
Pattern XY CD EF AB UV
00 Do Nothing Do Nothing Do Nothing Do Nothing Do Nothing
01 Stop Stop Stop Stop Stop
10 Open CW* Pan Left Tilt Up Open Lift Up
11 Open ACW* Pan Right Tilt Down Close Drop Down
*CW opening is also implemented for SR Auto in the initial phase. To bring the SR
arms back into the lock-in position, ACW rotation is applied.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

II. Locomotion commands


D4 bit defines the direction. If 1 then rotate motor to generate forward motion. If 0
then rotate motor to generate reverse motion. M3-0 determines magnitude. The
locomotion magnitudes are converted to values which are used as Timer0 High load
values so that the single timer can be used to generate two PWM signal for both
drive motors.

III. Extension Operations:


The bits are output as sent by Zeus. A single byte is output and the related nibble is
set as per the commands.

Inputs & Sensors:


Two ports are used for the inputs. The inputs are from the sensors on the Xabre
system and bring in specific information about the system status. The most
important information is the overturning detection. For this a tilt sensor is used. This
sensor gives a ‘1’ signal for normal state and when the system flips over, the sensor
gives a ‘0’ as input. The microswitches used for the remaining inputs give ‘0’ for
normal states and for the tripped state gives ‘1’. The photo-transistor systems are
arranged as a PXTOR on one side of a disc with 3 holes and the IR LEDs on the
other side of the disc. The photo-transistor systems give ‘1’ output for hole and for
blank, give ‘0’. During normal operation only the PXTOR for the lock-in indication
gives 1 and the remaining two extremity detectors give 0 as output. The arrangement
is such that only one system in front of a hole will give output 1 and for the
remaining times none of the 3 systems will give output 1.
The input port 1, being used for gripper microswitches, is common to the SR inputs.
This port is interrupt driven, i.e. when there is any change of state of any of the 8
inputs, an interrupt is generated by the debouncing IC and sent to INT0 of Thor.
Then Thor can read in the states of the 8 switches.
The input port 2, being used for the Pan/Tilt microswitches, is also an interrupt
driven port. The inputs from this port are read in and two steps are carried out by
Thor. First, it saves the trip status to the P/T status byte and then writes stop

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

commands to the tripped system (Pan or Tilt for which microswitch has tripped) if
the on bits for the same are set.

External Port Bytes:


Port Information Indicated Functions/Port names
P2.x D7 D6 D5 D4 D3 D2 D1 D0
RPW LPW Locomotion Port
P0.x# x X x x RD LD
M M

000b SRT SRLI SRC SRA 0 0 1 1 I/P PORT, int. driven


010b SRD SRM 0 0 1 1 1 L SR & Light Port
Gripper & Pan/Tilt
011b G1M G1D G2M G2D TM TD PM PD
Port
100b TUL TDL PRL PLL GUL GDL GCL GOL I/P PORT, int. driven
101b H I J K N O Q R Extension ops. Port
#Only the locomotion commands don’t use the P1 data bus and P2.x address select
system.
I. Inputs:
Interrupt Driven Inputs -1
SRT: SR Tilt sensor. SRLI: SR Lock-in sensor.
SRC: SR CW limit sensor. SRA: SR ACW limit sensor.
Interrupt Driven Inputs -2
GUL: Gripper Up limit sensor. GDL: Gripper Down limit sensor.
GCL: Gripper Close limit sensor. GOL: Gripper Open limit sensor.
PLL: Pan Left limit sensor. PRL: Pan Right limit sensor.
TDL: Tilt Down limit sensor. TUL: Tilt Up limit sensor.

II. Outputs:
Locomotion
LD Left or Right Direction LPWM Drive PWM signal.
RD 1=Forward; 0=Reverse RPWM 1=ON ; 0=OFF
SR/Gripper 1-2/Pan/Tilt

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

SRD Direction determining bit. SRM


G1D 1 indicates CW / Open / Lift / G1M ON/OFF determining bit. If the
G2D Tilt Up / Pan Left G2M bit is 1, the motor runs else it
TD 0 indicates ACW / Close / Drop / TM doesn’t run.
PD Tilt Down / Pan Right PM
Light/Extension Operations
L, H, I, J, K, N, O, Q, R 1 indicates ON; 0 indicates OFF

Internal Status Bytes:


Byte Name Information Indicated
D7 D6 D5 D4 D3 D2 D1 D0
Loc_Byte LD LM3 LM2 LM1 RD RM3 RM2 RM1
SR_Stat_Byte SRT SRLI SRC SRA SR On SR Cw Aut_O L
G_Stat_Byte G1D G1M G2D G2M GUL GDL GCL GOL
PT_Stat_Byte TUL TDL PRL PLL TD TM PD PM
Extn_Byte H I J K N O Q R

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

SECTIO 3
SOFTWARE
HMI:
The interface is a form object coded in VB6 Enterprise Edition,
incorporating Microsoft Communication Control Toolbox ver 6. The HMI is an
intuitively designed interface which allows the user to easily control Xabre by using
the k/b and a joystick. The interface is shown
below:

The joystick interface needs to be calibrated for different PCs and for
different temperature regions, since this tends to affect the potentiometers which are
integral to the construction of the joystick. To compensate for change in the
potentiometer resistance and allow the proper operation, we use the joystick
calibration form called Calib as a child form of the main Zeus form. This form is
shown below:

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Since we are using RS-232 serial output port viz. Com1 or any other
available Com port (usually Com 2), the satisfactory operation of the Com port has
to be verified before starting communication with Xabre. For this we use the ‘Serial
Settings Select’ form. This form is shown below:

The code for the same consists of 2 .bas modules and 3 form objects. The
code listing for the same is as follows next.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

ZEUS Form Object


VERSION 5.00 ScaleWidth = 480
Object = "{648A5603-2C6E-101B-82B6- TabIndex = 24
000000000014}#1.1#0"; "MSCOMM32.OCX" Top = 600
Begin VB.Form Zeus Width = 540
BorderStyle = 1 'Fixed Single End
Caption = "Zeus" Begin VB.PictureBox Ext_op_pics
ClientHeight = 2490 AutoRedraw = -1 'True
ClientLeft = 1575 AutoSize = -1 'True
ClientTop = 2400 Height = 375
ClientWidth = 9765 Index = 7
FillColor = &H00C0FFFF& Left = 1440
LinkTopic = "Form1" Picture = "Xabre 161003.frx":03ED
LockControls = -1 'True ScaleHeight = 315
MaxButton = 0 'False ScaleWidth = 480
MinButton = 0 'False TabIndex = 23
Moveable = 0 'False Top = 600
ScaleHeight = 2490 Width = 540
ScaleWidth = 9765 End
Begin MSCommLib.MSComm MSComm1 Begin VB.PictureBox Ext_op_pics
Left = 0 AutoRedraw = -1 'True
Top = 960 AutoSize = -1 'True
_ExtentX = 1005 Height = 375
_ExtentY = 1005 Index = 6
_Version = 393216 Left = 720
DTREnable = 0 'False Picture = "Xabre 161003.frx":07DA
NullDiscard = -1 'True ScaleHeight = 315
RThreshold = 1 ScaleWidth = 480
InputMode = 1 TabIndex = 22
End Top = 600
Begin VB.Frame Ext_Ops_frame Width = 540
BorderStyle = 0 'None End
Height = 1095 Begin VB.PictureBox Ext_op_pics
Left = 3480 AutoRedraw = -1 'True
TabIndex = 17 AutoSize = -1 'True
Top = 1320 Height = 375
Width = 2535 Index = 1
Begin VB.PictureBox Ext_op_pics Left = 0
AutoRedraw = -1 'True Picture = "Xabre 161003.frx":0BC8
AutoSize = -1 'True ScaleHeight = 315
Height = 375 ScaleWidth = 480
Index = 5 TabIndex = 21
Left = 0 Top = 0
Picture = "Xabre 161003.frx":0000 Width = 540
ScaleHeight = 315 End

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Begin VB.PictureBox Ext_op_pics ScaleWidth = 540


AutoRedraw = -1 'True TabIndex = 16
AutoSize = -1 'True Top = 120
Height = 375 Width = 600
Index = 4 End
Left = 1680 Begin VB.Frame Keyboard_Controlled_Frame
Picture = "Xabre 161003.frx":0FB6 BorderStyle = 0 'None
ScaleHeight = 315 Height = 2295
ScaleWidth = 240 Left = 6480
TabIndex = 20 TabIndex = 8
Top = 0 Top = 120
Width = 300 Width = 2295
End Begin VB.PictureBox Kb_pics
Begin VB.PictureBox Ext_op_pics AutoRedraw = -1 'True
AutoRedraw = -1 'True AutoSize = -1 'True
AutoSize = -1 'True Height = 810
Height = 375 Index = 0
Index = 3 Left = 720
Left = 1080 Picture = "Xabre 161003.frx":2B0A
Picture = "Xabre 161003.frx":1050 ScaleHeight = 750
ScaleHeight = 315 ScaleWidth = 750
ScaleWidth = 480 TabIndex = 13
TabIndex = 19 Top = 720
Top = 0 Width = 810
Width = 540 End
End Begin VB.CommandButton Kb_Button
Begin VB.PictureBox Ext_op_pics DownPicture = "Xabre 161003.frx":48FC
AutoRedraw = -1 'True Height = 405
AutoSize = -1 'True Index = 1
Height = 375 Left = 720
Index = 2 MaskColor = &H8000000F&
Left = 600 Picture = "Xabre 161003.frx":57B2
Picture = "Xabre 161003.frx":143E Style = 1 'Graphical
ScaleHeight = 315 TabIndex = 12
ScaleWidth = 240 Top = 120
TabIndex = 18 UseMaskColor = -1 'True
Top = 0 Width = 810
Width = 300 End
End Begin VB.CommandButton Kb_Button
End DownPicture = "Xabre 161003.frx":66CC
Begin VB.PictureBox Light_Pic Height = 810
AutoRedraw = -1 'True Index = 4
AutoSize = -1 'True Left = 1680
Height = 840 MaskColor = &H8000000F&
Left = 4440 Picture = "Xabre 161003.frx":759A
Picture = "Xabre 161003.frx":14D8 Style = 1 'Graphical
ScaleHeight = 780 TabIndex = 11

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Top = 720 DownPicture = "Xabre 161003.frx":C0D0


UseMaskColor = -1 'True Height = 810
Width = 405 Index = 3
End Left = 120
Begin VB.CommandButton Kb_Button MaskColor = &H8000000F&
DownPicture = "Xabre 161003.frx":84B4 Picture = "Xabre 161003.frx":CF9E
Height = 405 Style = 1 'Graphical
Index = 2 TabIndex = 7
Left = 720 Top = 720
MaskColor = &H8000000F& UseMaskColor = -1 'True
Picture = "Xabre 161003.frx":93CE Width = 405
Style = 1 'Graphical End
TabIndex = 10 Begin VB.CommandButton Joy_Button
Top = 1680 DownPicture = "Xabre 161003.frx":DEB8
UseMaskColor = -1 'True Height = 405
Width = 810 Index = 2
End Left = 720
Begin VB.CommandButton Kb_Button MaskColor = &H8000000F&
DownPicture = "Xabre 161003.frx":A2E8 Picture = "Xabre 161003.frx":EDD2
Height = 810 Style = 1 'Graphical
Index = 3 TabIndex = 6
Left = 120 Top = 1680
MaskColor = &H8000000F& UseMaskColor = -1 'True
Picture = "Xabre 161003.frx":B1B6 Width = 810
Style = 1 'Graphical End
TabIndex = 9 Begin VB.CommandButton Joy_Button
Top = 720 Appearance = 0 'Flat
UseMaskColor = -1 'True DownPicture = "Xabre 161003.frx":FCEC
Width = 405 Height = 810
End Index = 4
Begin VB.Label Label4 Left = 1680
Caption = "Keyboard Buttons" MaskColor = &H8000000F&
Height = 375 Picture = "Xabre 161003.frx":10BBA
Left = 0 Style = 1 'Graphical
TabIndex = 15 TabIndex = 5
Top = 0 Top = 720
Width = 735 UseMaskColor = -1 'True
End Width = 405
End End
Begin VB.Frame Joystick_Controlled_frame Begin VB.CommandButton Joy_Button
BorderStyle = 0 'None Default = -1 'True
Height = 2295 DownPicture = "Xabre 161003.frx":11AD4
Left = 960 Height = 405
TabIndex = 2 Index = 1
Top = 120 Left = 720
Width = 2295 MaskColor = &H8000000F&
Begin VB.CommandButton Joy_Button Picture = "Xabre 161003.frx":1298A

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Style = 1 'Graphical EndProperty


TabIndex = 4 ForeColor = &H00FFFFFF&
Top = 120 Height = 255
UseMaskColor = -1 'True Left = 4560
Width = 810 TabIndex = 25
End Top = 960
Begin VB.PictureBox Joy_pics Width = 315
AutoRedraw = -1 'True End
AutoSize = -1 'True Begin VB.Label Label2
Height = 810 AutoSize = -1 'True
Index = 0 Caption = "Right"
Left = 720 Height = 195
Picture = "Xabre 161003.frx":138A4 Left = 0
ScaleHeight = 750 TabIndex = 1
ScaleWidth = 750 Top = 2280
TabIndex = 3 Width = 375
Top = 720 End
Width = 810 Begin VB.Label Label1
End AutoSize = -1 'True
Begin VB.Label Label3 Caption = "Left"
Caption = "Joystick Buttons" Height = 195
Height = 375 Left = 0
Left = 0 TabIndex = 0
TabIndex = 14 Top = 2040
Top = 120 Width = 270
Width = 615 End
End End
End Attribute VB_Name = "Zeus"
Begin VB.Timer Op_Mode_Timer Attribute VB_GlobalNameSpace = False
Enabled = 0 'False Attribute VB_Creatable = False
Interval = 100 Attribute VB_PredeclaredId = True
Left = 10 Attribute VB_Exposed = False
Top = 1560 '>>> VARIABLE DECLARATIONS <<<'
End Private X() As Integer
Begin VB.Label TX_label Private Y() As Integer
AutoSize = -1 'True Private ari As Integer
BackColor = &H000000FF& Private joyb_states(4) As Boolean
BorderStyle = 1 'Fixed Single Private joyb_pressed(4) As Boolean
Caption = "TX" Private kbb_states(4) As Boolean
BeginProperty Font Private light_status As Boolean
Name = "MS Sans Serif" Private alternate_drive As Boolean
Size = 8.25 Private ext_ops_status(5) As Integer
Charset = 0 Dim JoyInfo As tJoyInfo
Weight = 700 Dim OP_vals As JoyVariables
Underline = 0 'False Dim l_drive_matrix(30, 30) As Byte
Italic = 0 'False Dim r_drive_matrix(30, 30) As Byte
Strikethrough = 0 'False Dim r_drive As Byte

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Dim l_drive As Byte Load Calib_Form


Private TX_on As Boolean End Sub
'>>> SUBROUTINES <<<'
Private Sub Form_Load() Private Sub set_Op_vals()
'>>> Setup form position on the screen <<<' OP_vals.XCntr = 32767
Call relocate_form OP_vals.YCntr = 32767
'>>> Initialization ops <<<' OP_vals.Xmax = 65535
Call init OP_vals.Xmin = 0
End Sub OP_vals.Ymax = 65535
OP_vals.Ymin = 0
Private Sub init() OP_vals.X_Lower_Range = OP_vals.XCntr -
'>>> Shutoff TX for main form <<<' OP_vals.Xmin
TX_on = False OP_vals.X_Upper_Range = OP_vals.Xmax -
OP_vals.XCntr
'>>> Stick Control Array Init <<<' OP_vals.Y_Lower_Range = OP_vals.YCntr -
ReDim X(10) OP_vals.Ymin
ReDim Y(10) OP_vals.Y_Upper_Range = OP_vals.Ymax -
OP_vals.YCntr
'>>> Stick Control Array Position Indicator <<<' OP_vals.X_Upper_Scale = OP_vals.X_Upper_Range /
ari = 0 15
OP_vals.X_Lower_Scale = OP_vals.X_Lower_Range /
'>>> Initialise drive alternation variable <<<' 15
alternate_drive = True OP_vals.Y_Upper_Scale = OP_vals.Y_Upper_Range /
'>>> Init Op_vals structure <<<' 15
Call set_Op_vals OP_vals.Y_Lower_Scale = OP_vals.Y_Lower_Range /
15
'>>> Set frame positions and current kb controlled OP_vals.Set_val = False
module <<<' End Sub
Call set_Frames
Private Sub set_button_states()
'>>> Set Ext Ops Frame <<<' '>>> Set values for joystick buttons as false<<<'
Call set_ext_ops_frame For i = 1 To 4
joyb_states(i) = False
'>>> Initialise state value arrays <<<' joyb_pressed(i) = False
Call set_button_states kbb_states(i) = False
Next i
'>>> Light status init <<<" End Sub
Call light_setup
Private Sub init_l_drive()
'>>> Initialise the drive matrices <<<' Dim m As Byte
Call init_l_drive m = 16
Call init_r_drive For i = 0 To 15
r_drive = 0 m=m-1
l_drive = 0 seed = m
For j = 0 To 30
Zeus.Show '>>> Update seed <<<'
Zeus.Enabled = False seed = seed + 1

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

'>>> Change if required <<<' Next j


If seed = 32 Then seed = 31 Next i
If seed < 16 Then
l_drive_matrix(i, j) = 16 - seed For i = 27 To 29
Else For j = 1 To 30
l_drive_matrix(i, j) = seed If j < i Then l_drive_matrix(i, j) =
End If l_drive_matrix(30, j)
Next j Next j
Next i Next i
End Sub
m = 16
For i = 30 To 16 Step -1 Private Sub init_r_drive()
m=m+1 Dim m As Byte
seed = m m = 16
For j = 30 To 0 Step -1 For i = 0 To 15
'>>> Change if required <<<' m=m-1
If seed = 0 Then seed = 1 seed = m
'>>> Update seed <<<' For j = 30 To 0 Step -1
seed = seed - 1 '>>> Update seed <<<'
If seed < 16 Then seed = seed + 1
l_drive_matrix(i, j) = 16 - seed '>>> Change if required <<<'
If l_drive_matrix(i, j) = 16 Then l_drive_matrix(i, If seed = 32 Then seed = 31
j) = 15 If seed < 16 Then
Else r_drive_matrix(i, j) = 16 - seed
l_drive_matrix(i, j) = seed Else
End If r_drive_matrix(i, j) = seed
Next j End If
Next i Next j
Next i
'>>> Desensitize Central Paths <<<' m = 16
For i = 14 To 16 For i = 30 To 16 Step -1
For j = 0 To 30 m=m+1
l_drive_matrix(i, j) = l_drive_matrix(15, j) seed = m
Next j For j = 0 To 30
Next i '>>> Change if required <<<'
If seed = 0 Then seed = 1
For j = 14 To 16 '>>> Update seed <<<'
For i = 0 To 30 seed = seed - 1
l_drive_matrix(i, j) = l_drive_matrix(i, 15) If seed < 16 Then
Next i r_drive_matrix(i, j) = 16 - seed
Next j If r_drive_matrix(i, j) = 16 Then r_drive_matrix(i,
j) = 15
'>>> Desensitized Forward Extremities <<<' Else
For i = 1 To 3 r_drive_matrix(i, j) = seed
For j = 1 To 30 End If
If j > i Then l_drive_matrix(i, j) = l_drive_matrix(0, Next j
j) Next i

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

'>>> Desensitize Central Paths <<<' Private Sub display_received()


For i = 14 To 16 Dim Instring As Variant
For j = 0 To 30 Dim bytes As Variant
r_drive_matrix(i, j) = r_drive_matrix(15, j) Dim RX_string As String
Next j RX_string = ""
Next i Instring = MSComm1.Input
bytes = Instring
For j = 14 To 16 Debug.Print CInt(bytes(0))
For i = 0 To 30 'MsgBox (RX_string)
r_drive_matrix(i, j) = r_drive_matrix(i, 15) End Sub
Next i
Next j Private Sub Op_Mode_Timer_Timer()
If gSerial_Settings_Sel_loaded Or gCalib_form_loaded
'>>> Desensitized Forward Extremities <<<' Then Op_Mode_Timer.Enabled = False
For i = 1 To 3 If Not gSerial_first_init And Not gCalib_form_loaded
For j = 1 To 30 Then
If j < 30 - i Then r_drive_matrix(i, j) = Zeus.Enabled = False
r_drive_matrix(0, j) Op_Mode_Timer.Enabled = False
Next j Load Serial_Settings_Sel
Next i GoTo out_of_timer
End If
For i = 27 To 29 Call CTSHolding_check
For j = 1 To 30 Call Joyread
If j > 30 - i Then r_drive_matrix(i, j) = Call show_joy_buttons_pressed
r_drive_matrix(30, j) out_of_timer:
Next j End Sub
Next i
End Sub Private Sub CTSHolding_check()
If MSComm1.PortOpen = False Then
Private Sub Form_GotFocus() MSComm1.commport = gPortNumber
Zeus.Joy_Button(1).SetFocus TX_label.ToolTipText = "COM" +
End Sub CStr(MSComm1.commport)
If MSComm1.CTSHolding Then
Public Sub xfer_calib() TX_label.Caption = "LP"
If OP_tf_vals.Set_val Then OP_vals = OP_tf_vals TX_label.BackColor = vbBlue
End Sub TX_label.ForeColor = vbRed
TX_label.ToolTipText = "Make sure Green LED is
'>>> Test code <<<' ON"
Private Sub MSComm1_OnComm() Else
eventid = MSComm1.CommEvent TX_label.Caption = "TX"
Select Case eventid If Not TX_on Then
Case comEvReceive: TX_label.BackColor = vbRed
Call display_received '>>>DEBUG DATA: If event TX_label.ForeColor = vbWhite
not being triggered <<<' If MSComm1.PortOpen = True Then
End Select MSComm1.PortOpen = False
End Sub Else

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

TX_label.BackColor = vbGreen
TX_label.ForeColor = vbBlack '>>> Save Button states <<<'
If MSComm1.PortOpen = False Then For i = 1 To 4
MSComm1.PortOpen = True joyb_states(i) = joyb_pressed(i)
End If Next i
End If
End Sub '>>> if state has changed, options are"
' 1. both off
Private Sub Joyread() ' 2. u on
Dim state_changed(4) As Boolean ' 3. d on
Dim msg1 As String ' 4. both on is not possible
Dim msg2 As String
Dim frwd As Integer If state_changed(1) Or state_changed(2) Then
Dim side As Integer If Not joyb_states(1) And Not joyb_states(2) Then
Dim run_locomotion_command As Boolean msg1 = "STOP"
run_locomotion_command = True If joyb_states(1) And Not joyb_states(2) Then msg1
rc = GetJoystickPos(JOYSTICK1, JoyInfo) = "UP"
If rc = 0 Then If Not joyb_states(1) And joyb_states(2) Then msg1
= "DOWN"
'>>> Process Button changes <<<' Else
'>>> Transfer Button pressed info from joyinfo to array msg1 = "DO NOTHING"
<<<' End If
For i = 1 To 4
If JoyInfo.ButtonDown(i) Then If state_changed(3) Or state_changed(4) Then
joyb_pressed(i) = True If Not joyb_states(3) And Not joyb_states(4) Then
Else msg2 = "STOP"
joyb_pressed(i) = False If joyb_states(3) And Not joyb_states(4) Then msg2
End If = "LEFT"
Next i If Not joyb_states(3) And joyb_states(4) Then msg2
= "RIGHT"
'>>> Filter the array for opposite button pressed Else
conflicts <<<' msg2 = "DO NOTHING"
For i = 1 To 4 End If
If joyb_pressed(i) Then
If Not joyb_states(4 - (i + 1) Mod 4) Then If state_changed(1) Or state_changed(2) Or
joyb_pressed(i) = True state_changed(3) Or state_changed(4) Then
Else Call joy_command(msg1, msg2)
joyb_pressed(i) = False run_locomotion_command = False
End If End If
End If End If
Next i

'>>> Check for change in state <<<' ari = (ari) Mod 10 + 1


state_changed(1) = joyb_pressed(1) Xor joyb_states(1) If JoyInfo.X >= OP_vals.XCntr Then
state_changed(2) = joyb_pressed(2) Xor joyb_states(2) X(ari) = (JoyInfo.X - OP_vals.XCntr) /
state_changed(3) = joyb_pressed(3) Xor joyb_states(3) OP_vals.X_Upper_Scale + 15
state_changed(4) = joyb_pressed(4) Xor joyb_states(4) Else

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

X(ari) = (JoyInfo.X - OP_vals.Xmin) / If msg2 = "RIGHT" Then msg2 = "DROP"


OP_vals.X_Lower_Scale Call gripper(msg1, msg2)
End If End If
End Sub
If JoyInfo.Y >= OP_vals.YCntr Then
Y(ari) = (JoyInfo.Y - OP_vals.YCntr) / '>>> Module subroutines <<<'
OP_vals.Y_Upper_Scale + 15
Else '>>> MODULE LOCOMOTION <<<'
Y(ari) = (JoyInfo.Y - OP_vals.Ymin) / '>>> Locomotion command subroutine <<<'
OP_vals.Y_Lower_Scale '>>> Byte format is 10Y-Di-MMMM <<<'
End If '>>> Drive matrices give direct values for Di-MMMM
<<<'
'>>> Joystick's X is Sideways <<<' '>>> Y=0 => Left locomotion command (128) <<<'
'>>> Joystick's Y is Forward <<<' '>>> Y=1 => Right locomotion command (160)<<<'
side = integrator(X) Private Sub locomotion_command(frwd As Integer, side
frwd = integrator(Y) As Integer)
If run_locomotion_command Then Dim r_old As Byte
frwd = Fix(frwd / 10) Dim r_new As Byte
side = Fix(side / 10) Dim l_old As Byte
Call locomotion_command(frwd, side) Dim l_new As Byte
End If Dim command As Byte
End Sub '>>> To prevent access of a array element outside array
size <<<'
Private Function integrator(fn() As Integer) As Long '>>> Both drive arrays are of same size <<<'
Dim val As Double '>>> So singular check will do <<<'
Dim i As Integer If frwd > UBound(l_drive_matrix, 1) Then frwd =
val = 0 UBound(l_drive_matrix, 1)
For i = 1 To 10 If side > UBound(l_drive_matrix, 2) Then frwd =
val = val + fn(i) UBound(l_drive_matrix, 2)
Next i
integrator = val l_new = l_drive_matrix(frwd, side)
End Function r_new = r_drive_matrix(frwd, side)
l_old = l_drive
'>>> Divert the command to the proper destination r_old = r_drive
subroutine <<<'
'>>> This performs check as to which module is being '>>> Send LDRV Command if it is its turn <<<'
controlled by joystk <<<' If (l_new Xor l_old) <> 0 And alternate_drive Then
'>>> It accordingly calls the relevant module's command l_drive = l_new
subroutine <<<' command = 128 + l_drive
Private Sub joy_command(msg1 As String, msg2 As Label1.Caption = "Left: " + CStr(l_drive)
String) '>>> Presentation test code <<<'
If joy_control = "Camera" Then Call camera(msg1, Zeus.Caption = "Zeus: Command => " +
msg2) CStr(command)
If joy_control = "Gripper" Then '>>> Next drive command has to be Right drive
If msg1 = "UP" Then msg1 = "CLOSE" command <<<'
If msg1 = "DOWN" Then msg1 = "OPEN" alternate_drive = False
If msg2 = "LEFT" Then msg2 = "LIFT"

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

'>>> Prevent 2 commands being sent simultaneously


<<<'
GoTo loco_out '>>> MODULE PAN/TILT<<<'
End If '>>> P/T module command subroutines <<<'
'>>> Byte format is 110-light-pan-tilt <<<'
If (r_new Xor r_old) <> 0 And Not alternate_drive Then '>>> Light_status 0 => base Command =192 <<<'
r_drive = r_new '>>> Light status 1 => base Command =208 <<<'
command = 160 + r_drive '>>> Pan/tilt 00 => Do nothing; 01 => Stop (P:4 ; T:1);
Label2.Caption = "Right: " + CStr(r_drive) <<<'
Zeus.Caption = "Zeus: Command => " + '>>> 10 => PL/TU (P:8 ; T:2) ; 11 => PR/TD (P:12 ; T:3)
CStr(command) <<<'
alternate_drive = True Private Sub camera(msg1 As String, msg2 As String)
'>>> Prevent 2 commands being sent simultaneously Dim command As Byte
<<<' If TX_on And Not MSComm1.CTSHolding = True Then
GoTo loco_out command = 192
End If If light_status Then command = command + 16
loco_out:
If TX_on Then Call TX_write(command) '>>>MSG1 carries the Up/Down strings <<<"
End Sub If msg1 = "STOP" Then command = command + 1
If msg1 = "UP" Then command = command + 2
'>>> MODULE LIGHT<<<' If msg1 = "DOWN" Then command = command + 3
'>>> Light module command subroutine <<<' If msg1 = "DO NOTHING" Then command =
'>>> Byte format is 110-light-pan-tilt <<<' command + 0
'>>> Light_status 0 => Command =192 <<<'
'>>> Light status 1 => Command =208 <<<' '>>>MSG2 carries the Left/Right strings <<<"
'>>> P/T: 00=> DO NOTHING for Pan/Tilt <<<' If msg2 = "STOP" Then command = command + 4
Private Sub light_toggle() If msg2 = "LEFT" Then command = command + 8
Dim command As Byte If msg2 = "RIGHT" Then command = command + 12
If TX_on And Not MSComm1.CTSHolding = True Then If msg2 = "DO NOTHING" Then command =
If light_status Then command + 0
light_status = False
Light_Pic.Picture = LoadPicture(App.Path + "\Light 'Debug.Print command
off.bmp") Call TX_write(command)
command = 192 Zeus.Caption = "Zeus: Command => " +
Else CStr(command)
light_status = True End If
Light_Pic.Picture = LoadPicture(App.Path + "\Light End Sub
on.bmp")
command = 208 '>>> MODULE GRIPPER <<<'
End If '>>> Gripper module command subroutines <<<'
'>>> Byte format is 001-0-G1-G2 <<<'
'Debug.Print command '>>> G1/G2 00 => Do nothing; 01 => Stop (G1:4 ; G2:1);
Call TX_write(command) <<<'
Zeus.Caption = "Zeus: Command => " + '>>> 10 => G1_Open/G2_Lift (G1:8 ; G2:2) ; 11 =>
CStr(command) G1_Close/G2_Drop (G1:12 ; G2:3) <<<'
End If Private Sub gripper(msg1 As String, msg2 As String)
End Sub Dim command As Byte

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

If TX_on And Not MSComm1.CTSHolding = True Then End If


command = 32 Else '>>> Ext ops 2, Extension Tool 2
'>>>MSG1 carries the G1 related strings <<<" command <<<'
If msg1 = "STOP" Then command = command + 4 If KeyCode < vbKey4 And KeyCode > vbKey0
If msg1 = "CLOSE" Then command = command + 12 Or KeyCode = 192 Then
If msg1 = "OPEN" Then command = command + 8 If KeyCode = 192 Then KeyCode = 48
If msg1 = "DO NOTHING" Then command = Ext_op_pics(2).Picture =
command + 0 LoadPicture(App.Path + "\img" + CStr(KeyCode - 48) +
".gif")
'>>>MSG2 carries the G2 related strings <<<" ext_ops_status(2) = KeyCode - 48
If msg2 = "STOP" Then command = command + 1 command = 240 + ext_ops_status(2) * 4 +
If msg2 = "LIFT" Then command = command + 2 ext_ops_status(1) * 2 + ext_ops_status(5)
If msg2 = "DROP" Then command = command + 3 Else
If msg2 = "DO NOTHING" Then command = GoTo jump_out
command + 0 End If
End If
'Debug.Print command Else
Call TX_write(command) ext_ops_status(KeyCode) =
Zeus.Caption = "Zeus: Command => " + (ext_ops_status(KeyCode) + 1) Mod 2
CStr(command) Ext_op_pics(Shift).Picture = LoadPicture(App.Path
End If + "\E" + CStr(KeyCode) +
End Sub CStr(ext_ops_status(KeyCode)) + ".gif")
If KeyCode = 4 Then '>>>Ext ops 1, Extension Tool
'>>> MODULE EXTENSION OPS 1&2<<<' 4 command <<<'
'>>> Extension ops module command subroutines <<<' command = 224 + ext_ops_status(3) * 2 +
'>>> Byte format 1: 111 - 0 - E31E32E33 - E41 ext_ops_status(4)
(Command 224+) <<<' Else '>>>Ext ops 2, Extension Tool 1 OR 5
'>>> Byte format 2: 111 - 1 - E21E22 - E11 - E51 command <<<'
(Command 240+) <<<' command = 240 + ext_ops_status(2) * 4 +
Private Sub ext_ops_event(KeyCode As Integer, Shift As ext_ops_status(1) * 2 + ext_ops_status(5)
Integer, toggle As Boolean) End If
Dim command As Byte End If
If TX_on And Not MSComm1.CTSHolding = True Then
If Not toggle Then 'Debug.Print command
If Shift = 0 Then '>>> Ext ops 1, Extension Tool 3 Zeus.Caption = "Zeus: Command => " +
command <<<' CStr(command)
'>>> Key 1 to 7 or Tilde Key (~) representing Call TX_write(command)
zero <<<' jump_out: '>>> Jump out since EOps2 can have a max
If KeyCode < vbKey8 And KeyCode > vbKey0 value of 3 and not any more <<<'
Or KeyCode = 192 Then End If
If KeyCode = 192 Then KeyCode = 48 End Sub
Ext_op_pics(4).Picture =
LoadPicture(App.Path + "\img" + CStr(KeyCode - 48) + '>>> Incomplete CODE FINISH THIS <<<'
".gif") '>>> MODULE SRM <<<'
ext_ops_status(3) = KeyCode - 48 '>>> SRM module command subroutines <<<'
command = 224 + ext_ops_status(3) * 2 + '>>> Byte format 001-1-XY-1-X1 <<<'
ext_ops_status(4)

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

'>>> EO INcomplete code list <<<' 'If the key is already pressed then do nothing
If key = 1 And kbb_states(1) Then GoTo l_jump
'>>> TX Label <<<' If key = 2 And kbb_states(2) Then GoTo l_jump
Private Sub TX_label_Click() If key = 3 And kbb_states(3) Then GoTo l_jump
If Not MSComm1.CTSHolding Then If key = 4 And kbb_states(4) Then GoTo l_jump
If TX_on Then
TX_label.BackColor = vbRed 'Key pressed passes above two test so is a valid
TX_label.ForeColor = vbWhite keypress
MSComm1.PortOpen = False kbb_states(key) = True
TX_on = False Kb_Button(key).Picture = LoadPicture(App.Path +
"\k" + CStr(key) + "on.bmp")
Else
TX_label.BackColor = vbGreen Else
TX_label.ForeColor = vbBlack 'Event is a keyup event
MSComm1.PortOpen = True 'Keyup is a key conflicting with previously pressed key
TX_on = True so do nothing
End If If key = 5 And kbb_states(2) Then GoTo l_jump
End If If key = 6 And kbb_states(1) Then GoTo l_jump
End Sub If key = 7 And kbb_states(4) Then GoTo l_jump
If key = 8 And kbb_states(3) Then GoTo l_jump
'>>> BYTE COMMAND WRITER SUB <<<'
Private Sub TX_write(command As Byte) kbb_states(key - 4) = False
Dim bytes(1) As Byte Kb_Button(key - 4).Picture = LoadPicture(App.Path +
Dim tx_buf As Variant "\k" + CStr(key - 4) + "off.bmp")
bytes(1) = command End If
tx_buf = bytes
If TX_on Then '>>> Read the stored states and determine required action
tx_buf(1) = command <<<'
MSComm1.Output = tx_buf If kbb_states(1) Then
End If msg1 = "UP"
End Sub Else
If kbb_states(2) Then
Private Sub kb_frame_event(key As Integer) msg1 = "DOWN"
'>>> For keyboard keys: E,S,D,X <<<' Else
'>>> Key = 1 to 4 => key pressed event <<<' If Not kbb_states(1) And Not kbb_states(2) And
'>>> Key = 5 to 8 => key released event <<<' (key = 5 Or key = 6) Then
Dim msg1 As String msg1 = "STOP"
Dim msg2 As String Else
msg1 = "DO NOTHING"
If key < 5 Then End If
'IF key pressed conflicts with previously pressed key End If
so do nothing End If
If key = 1 And kbb_states(2) Then GoTo l_jump
If key = 2 And kbb_states(1) Then GoTo l_jump If kbb_states(3) Then
If key = 3 And kbb_states(4) Then GoTo l_jump msg2 = "LEFT"
If key = 4 And kbb_states(3) Then GoTo l_jump Else
If kbb_states(4) Then

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

msg2 = "RIGHT" '>>> KEYBOARD KEY EVENTS PROCESSORS <<<'


Else '>>> Total Controls having key events on Form = 6 <<<'
If Not kbb_states(3) And Not kbb_states(4) And
(key = 7 Or key = 8) Then '>>> KEYDOWN EVENT Handlers <<<'
msg2 = "STOP" '>>> Keydown Handler 1 <<<'
Else Private Sub Joy_pics_KeyDown(Index As Integer,
msg2 = "DO NOTHING" KeyCode As Integer, Shift As Integer)
End If Call Form_KeyDown(KeyCode, Shift)
End If End Sub
End If
Call kb_command(msg1, msg2) '>>> Keydown Handler 2 <<<'
l_jump: Private Sub Joy_Button_KeyDown(Index As Integer,
End Sub KeyCode As Integer, Shift As Integer)
Call Form_KeyDown(KeyCode, Shift)
Private Sub toggle_frames() End Sub
'Debug.Print "Toggle Called"
'Debug.Print joy_control '>>> Keydown Handler 3 <<<'
If joy_control = "Camera" Then Private Sub Kb_pics_KeyDown(Index As Integer,
joy_control = "Gripper" KeyCode As Integer, Shift As Integer)
Joy_pics(0).Picture = Kb_pics(0).Picture Call Form_KeyDown(KeyCode, Shift)
Kb_pics(0).Picture = LoadPicture(App.Path + End Sub
"\Camview.bmp")
Else '>>> Keydown Handler 4 <<<'
joy_control = "Camera" Private Sub Kb_Button_KeyDown(Index As Integer,
Joy_pics(0).Picture = Kb_pics(0).Picture KeyCode As Integer, Shift As Integer)
Kb_pics(0).Picture = LoadPicture(App.Path + Call Form_KeyDown(KeyCode, Shift)
"\Gripper.bmp") End Sub
End If
'>>> Keydown Handler 5 <<<'
Zeus.Caption = "Zeus: Current Joystick Control is " + Private Sub Light_Pic_KeyDown(KeyCode As Integer,
CStr(joy_control) Shift As Integer)
End Sub Call Form_KeyDown(KeyCode, Shift)
End Sub
Private Sub kb_command(msg1 As String, msg2 As
String) '>>> Keydown Handler 6 <<<'
If joy_control = "Camera" Then Private Sub ext_op_pics_KeyDown(Index As Integer,
If msg1 = "UP" Then msg1 = "CLOSE" KeyCode As Integer, Shift As Integer)
If msg1 = "DOWN" Then msg1 = "OPEN" Call Form_KeyDown(KeyCode, Shift)
If msg2 = "LEFT" Then msg2 = "LIFT" End Sub
If msg2 = "RIGHT" Then msg2 = "DROP"
Call gripper(msg1, msg2)
End If '>>> KEYUP EVENT Handlers <<<'
If joy_control = "Gripper" Then Call camera(msg1, '>>> Keyup Handler 1 <<<'
msg2) Private Sub Joy_pics_KeyUp(Index As Integer, KeyCode
As Integer, Shift As Integer)
End Sub Call Form_KeyUp(KeyCode, Shift)
End Sub

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

End Select
'>>> KeyUp Handler 2 <<<'
Private Sub Joy_Button_KeyUp(Index As Integer, End Sub
KeyCode As Integer, Shift As Integer)
Call Form_KeyUp(KeyCode, Shift) '>>> Form KeyDown Event Handle <<<'
End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift
As Integer)
'>>> KeyUp Handler 3 <<<' Select Case KeyCode
Private Sub Kb_pics_KeyUp(Index As Integer, KeyCode '>>> Cases for normal kb keys <<<'
As Integer, Shift As Integer) '>>> KB Frame Control Keys <<<'
Call Form_KeyUp(KeyCode, Shift) Case vbKeyE: ' ^ '
End Sub Call kb_frame_event(1)
Case vbKeyX: ' v '
'>>> KeyUp Handler 4 <<<' Call kb_frame_event(2)
Private Sub Kb_Button_KeyUp(Index As Integer, Case vbKeyS: ' < '
KeyCode As Integer, Shift As Integer) Call kb_frame_event(3)
Call Form_KeyUp(KeyCode, Shift) Case vbKeyD: ' > '
End Sub Call kb_frame_event(4)
Case vbKey1 To vbKey7, 192:
'>>> KeyUp Handler 5 <<<' Call ext_ops_event(KeyCode, Shift, False)
Private Sub Light_Pic_KeyUp(KeyCode As Integer, Shift '>>> Light Control Key <<<"
As Integer) Case vbKeyL:
Call Form_KeyDown(KeyCode, Shift) Call light_toggle
End Sub '>>> Cases for Function Keys <<<'
'>>> Extension Ops Toggles E1, E4 and E5 <<<'
'>>> KeyUp Handler 6 <<<' '>>> Ext_Op# passed byVal to Keycode <<<'
Private Sub ext_op_pics_KeyUp(Index As Integer, '>>> Ext_Picture# passed byVal to Shift <<<'
KeyCode As Integer, Shift As Integer) '>>> Toggle operation is true as passed byVal to Toggle
Call Form_KeyDown(KeyCode, Shift) <<<'
End Sub Case vbKeyF2:
Call ext_ops_event(1, 5, True)
'>>> Form KeyUp Event Handler <<<' Case vbKeyF3:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Call ext_ops_event(4, 6, True)
Integer) Case vbKeyF4:
'>>> Required to send stop signal to <<<' Call ext_ops_event(5, 7, True)
'>>> the currently active kb-controlled <<<'
'>>> module subsystem <<<' '>>> User asks to shutdown Zeus <<<'
Select Case KeyCode Case vbKeyF10:
'>>> Check which key has been released <<<' 'Set confirm and then unload code here'
Case vbKeyE: ' ^ ' If Not gCalib_form_loaded And Not
Call kb_frame_event(5) gSerial_Settings_Sel_loaded Then
Case vbKeyX: ' v ' '>>> Ensure shutdown(=reset) command is fired and only
Call kb_frame_event(6) then shutdown
Case vbKeyS: ' < ' Debug.Print "Fire shutdown command"
Call kb_frame_event(7) Unload_Check:
Case vbKeyD: ' > ' If check_buffer_empty() Then
Call kb_frame_event(8) Unload Me

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Else: Ext_op_pics(1).Picture = LoadPicture(App.Path +


GoTo Unload_Check "\E2.gif")
End If Ext_op_pics(2).Picture = LoadPicture(App.Path + "\img"
Else: + CStr(ext_ops_status(2)) + ".gif")
If gCalib_form_loaded Then Calib_Form.SetFocus Ext_op_pics(3).Picture = LoadPicture(App.Path +
If gSerial_Settings_Sel_loaded Then "\E3.gif")
Serial_Settings_Sel.SetFocus Ext_op_pics(4).Picture = LoadPicture(App.Path + "\img"
End If + CStr(ext_ops_status(3)) + ".gif")
Ext_op_pics(5).Picture = LoadPicture(App.Path + "\E1"
'>>> User asks to transfer current kb controlled module to + CStr(ext_ops_status(1)) + ".gif")
joystick <<<' Ext_op_pics(6).Picture = LoadPicture(App.Path + "\E4"
Case vbKeyF5: + CStr(ext_ops_status(4)) + ".gif")
Call toggle_frames Ext_op_pics(7).Picture = LoadPicture(App.Path + "\E5"
+ CStr(ext_ops_status(5)) + ".gif")
'>>> User wants to re-calibrate locomotion controller
<<<' '>>> Position Pictures in Ext_Ops Frame <<<'
Case vbKeyF9: Ext_Ops_frame.Width = 4 * (50 +
Zeus.Op_Mode_Timer = False Ext_op_pics(1).Width)
Zeus.Enabled = False
Calib_Form.SetFocus Ext_op_pics(1).Left = (Ext_Ops_frame.Width -
Load Calib_Form Ext_op_pics(1).Width) * 0.05
If OP_tf_vals.Set_val Then OP_vals = OP_tf_vals Ext_op_pics(2).Left = ((Ext_Ops_frame.Width * 0.45 -
End Select Ext_op_pics(2).Width)) * 0.95
End Sub Ext_op_pics(3).Left = Ext_Ops_frame.Width * 0.55 +
(Ext_Ops_frame.Width * 0.5 - Ext_op_pics(3).Width) *
'>>> Cosmetics <<<' 0.05
Private Sub relocate_form() Ext_op_pics(4).Left = (Ext_Ops_frame.Width -
Me.Width = (Screen.Width * 0.95) Ext_op_pics(4).Width) * 0.95
Me.Move (Screen.Width * 0.05) / 2, (0.95 * Ext_op_pics(5).Left = (Ext_Ops_frame.Width -
Screen.Height - Me.Height) Ext_op_pics(5).Width) * 0.05
End Sub Ext_op_pics(6).Left = (Ext_Ops_frame.Width -
Ext_op_pics(6).Width) * 0.5
Private Sub set_Frames() Ext_op_pics(7).Left = (Ext_Ops_frame.Width -
Joystick_Controlled_frame.Left = (Zeus.Width - Ext_op_pics(7).Width) * 0.95
Joystick_Controlled_frame.Width) * 0.1
Keyboard_Controlled_Frame.Left = (Zeus.Width - Ext_Ops_frame.Left = (Zeus.Width -
Keyboard_Controlled_Frame.Width) * 0.9 Ext_Ops_frame.Width) / 2
joy_control = "Camera" TX_label.Left = Ext_Ops_frame.Left
End Sub End Sub

Private Sub set_ext_ops_frame() Private Sub light_setup()


'>>> Init the ext_ops_status array <<<' light_status = False
For i = 1 To 5 Light_Pic.Left = (Zeus.Width - Light_Pic.Width) / 2
ext_ops_status(i) = 0 Light_Pic.Top = Joystick_Controlled_frame.Top
Next i End Sub

'>>> Load Default Pictures to the Ext_Ops Frame <<<' Private Sub show_joy_buttons_pressed()

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

For i = 1 To 4 Joy_Button(i).Picture = LoadPicture(App.Path + "\j"


If joyb_pressed(i) Then + CStr(i) + "off.bmp")
Joy_Button(i).Picture = LoadPicture(App.Path + "\j" joyb_states(i) = False
+ CStr(i) + "on.bmp") End If
joyb_states(i) = True Next i
Else End Sub
End Sub

The Vbjoy32.bas module takes care of reading the joystick’s potentiometers using
the Windows API called winmm.dll. The code listing for the same is as follows:
' Joystick Capabilities Declare Function joyGetPos Lib "winmm.dll" (ByVal
Const MAXPNAMELEN = 32 IDDevice As Integer, JPos As tJoyInfo) As Integer
Const MAXOEMVXD = 128 Function GetJoystickPos(IDDevice As Long, JoyInfo As
Type tJoyCaps tJoyInfo) As Integer
Mid As Integer '-------------------------------------------------------
Pid As Integer ' This function is a wrapper around the joyGetPos API
Pname As String * MAXPNAMELEN ' call. That call returns coordinates as unsigned
Xmin As Long ' long integers, which VB doesn't support. We move
Xmax As Long ' these coordinates into long values so that they
Ymin As Long ' can be easily evaluated.
Ymax As Long '-------------------------------------------------------
Zmin As Long Dim rc As Integer
Zmax As Long Static NotFirstTime As Integer
NumButtons As Long If Not NotFirstTime Then
PeriodMin As Long NotFirstTime = False
PeriodMax As Long rc = joyGetDevCaps(IDDevice, JoyCaps,
wRmin As Long Len(JoyCaps))
wRmax As Long If rc <> 0 Then
wUmin As Long GetJoystickPos = rc
wUmax As Long Exit Function
wVmin As Long End If
wVmax As Long End If
wCaps As Long rc = joyGetPos(IDDevice, JoyInfo)
wMaxAxes As Long GetJoystickPos = rc
wNumAxes As Long If rc <> 0 Then Exit Function
wMaxButtons As Long JoyInfo.ButtonDown(1) = (JoyInfo.ButtonStates And
szRegKey As String * MAXPNAMELEN JOY_BUTTON1) = JOY_BUTTON1
szOEMVxD As String * MAXOEMVXD JoyInfo.ButtonDown(2) = (JoyInfo.ButtonStates And
End Type JOY_BUTTON2) = JOY_BUTTON2
Global JoyCaps As tJoyCaps JoyInfo.ButtonDown(3) = (JoyInfo.ButtonStates And
' Joystick API Calls JOY_BUTTON3) = JOY_BUTTON3
Declare Function joyGetDevCaps Lib "winmm.dll" Alias JoyInfo.ButtonDown(4) = (JoyInfo.ButtonStates And
"joyGetDevCapsA" (ByVal IDDevice As Integer, JCaps JOY_BUTTON4) = JOY_BUTTON4
As tJoyCaps, ByVal CapSize As Integer) As Integer End Function

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

The global declarations of variables accessed all over the program are declared in
globalvariables.bas as shown below:
Attribute VB_Name = "Module2"
Public Type JoyVariables
Xmin As Long
Xmax As Long
Ymin As Long
Ymax As Long
XCntr As Long
YCntr As Long
X_Upper_Range As Long
X_Lower_Range As Long
Y_Upper_Range As Long
Y_Lower_Range As Long
X_Upper_Scale As Long
X_Lower_Scale As Long
Y_Upper_Scale As Long
Y_Lower_Scale As Long
Set_val As Boolean
End Type
Public OP_tf_vals As JoyVariables
Global gCalib_form_loaded As Boolean
Global gSerial_Settings_Sel_loaded As Boolean
Global gSerial_first_init As Boolean
Global joy_control As String

The serial port settings are done through the Serial port settings form object which
has the following code listing

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

µC Operations Flowcharts and Algorithms:


Some of the flowcharts & algorithms used for the development of the µC
software are shown below:
Function Algorithms
1. SRM Auto:
IF tilt_sw = open ‘indicates overturning, sensed thru interrupt.
SET Sr_History=true; ‘Indicate SR Action is going on
ROTATE acw; ‘acw wrt to Xabre’s upright left view
REPEAT TILL tilt_sw = close; ‘Xabre is upright now,
‘sensed thru interrupt
END IF
IF Sr_History=true; Indicates that previous action was SR Action
ROTATE cw; ‘cw wrt to Xabre’s upright left view
REPEAT TILL lock_in = close; ‘SR arm is locked-in
SET Sr_History=false; ‘Indicate SR Action completed

2. SRM Manual
IF Command=Open_CW_manual
ROTATE cw;
ROTATE TILL Command = Stop_Rotation;
IF Command=Open_ACW_manual
ROTATE acw;
ROTATE TILL Command = Stop_Rotation;
IF Command=Open_CW_auto
ROTATE cw;
ROTATE TILL lock_in = close; ‘SR arm is locked-in
IF Command=Open_ACW_auto
ROTATE acw;
ROTATE TILL lock_in = close; ‘SR arm is locked-in;

3. P/T Operation
a. Command Operation
IF PLL = open
ON PL_Command: Pan Left;
IF PRL = open
ON PR_Command: Pan Right;
IF TUL = open
ON TU_Command: Tilt Up;
IF TDL = open
ON TD_Command: Tilt Down;

b. Limit switch actuation


Recognize Switch
IF Switch = closed
STOP Motion;

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

4. Light Operation:
ON Light_ON_Command: Light = ON;
ON Ligth_OFF_Command: Light = OFF;

Function flowcharts:

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

HARDWARE
A PCB for the implementation of the circuit was manufactured. The
schematic design was prepared in Orcad V9.0 and the final layout was generated
using Protel V3.0.
This sub section includes the PCB layout diagrams.

Nirma Institute of Technology


Technology
XABRE
5 4 3 2 1

PRIMARY CONTROL CARD 12V


D2 12V 12V
12V 100uF C6 100uF C15
R16
1N4007 10K

6
EXT 12V 5V 12V U8 LMD18200T U11 LMD18200T
R10 10K
D1 U7 7805/TO 9 2 R17 9 2

VCC

VCC
5V 5V 5V TH OUT OUT1 LM1 TH OUT OUT1 RM1
1 3 8 6K8 8

GND
J1 VIN VOUT C30 0.1uF C33 0.1uF CS OUT CS OUT
U1 SRM LATCH U4 1 C7 1 C16
1N4007 R11 6K8 BS1 BS1
1 C2 R1 R 39 1 3 2
C1 R2 R P0.0 P1.0/T2 D0 Q0
2 10uF 38 P0.1 P1.1/T2X 2 4 D1 Q1
5 LDRV MOTOR RDRV MOTOR

2
10uF R3 R 37 3 7 6 3 10 3 10
R4 R P0.2 P1.2 D2 Q2 DIR BS2 C8 DIR BS2 C17
36 4 8 9 5 5

GND

GND
HEADER 2 P0.3 P1.3 D3 Q3 PWM 10nF PWM 10nF
35 P0.4 P1.4 5 13 D4 Q4 12 4 11 LM2 4 11 RM2
BRAKE OUT2 BRAKE OUT2
34 P0.5 P1.5 6 14 D5 Q5 15
33 P0.6 P1.6 7 17 16
D6 Q6

7
32 P0.7 P1.7 8 18 19
D7 Q7
D D
J9 12 21 11
INT0 P2.0 LE
13 22 1
INT1 P2.1 OE
1 17 23
5V RD P2.2 74LS373
2 10 24
RXD P2.3 12V
3 14 25
T0 P2.4 5V 12V LS1 LS2
4 15 26
T1 P2.5 U5 C34 0.1uF
11
TXD P2.6
27 G-PT LATCH 12V D12 RELAY DPDT RELAY DPDT
16 28 3 2 100uF C9 12V 4 4
HEADER 4 WR P2.7 D0 Q0 R12
4 D1 5 1N4007 3 3 SRM1
Q1 10K
19 30 7 6 5 5

6
X1 ALE/P D2 Q2 U9 LMD18200T 12V
18 X2 PSEN
29 8 D3 Q3
9 8 8 SRM MOTOR
13 12 R13 9 Q2
OUT1 2
6 6

VCC
5V D4 Q4 TH OUT PM1 SRM2
31 14 15 6K8 8 D11 2N2222 7 7 J5
EA/VP D5 Q5 CS OUT C10
9 RST 17 D6 16 1 1 1
Q6 BS1 RM1
18 19 1N4007 2 2 1
D7 Q7 5V RM2
DS89C420 PAN MOTOR LM1
2
11 3 10 3
LE RESISTOR SIP 10 5K DIR BS2 C11 Q3 LM2
1 5 4

GND
1
C3 XTAL C4 OE RS3 PWM 10nF PM1
4 11 PM2 2N2222 5
30pF 11.0592 Mhz 30pF 74LS373 BRAKE OUT2 PM2 6
G2M1 7
5V 12V G2M2

7
C35 0.1uF 8
EOPs LATCH U6 12V G1M1 9
3 2 100uF C18 G1M2 10
C5 D0 Q0 R18 SRM1
4 5 11

10
D1 Q1 SRM2

2
3
4
5
6
7
8
9
10uF 7 6 10K 12

6
D2 Q2 U12 LMD18200T TM1
VCC 8 9 13
D3 Q3 R19 TM2
13 12 9
OUT1 2
14

VCC
D4 Q4 12V TH OUT TM1
R5 R6 14 15 D3 6K8 8
10K 100E 5V 5V D5 Q5 LED 12V CS OUT C19
C31 0.1uF 17 16 1
U2 D6 Q6 D4 100uF C12 BS1 HEADER 14
18 19
PB D7 Q7 LED R14
1
EN Vcc
20 TILT MOTOR
5V 2 19 11 D5 10K 3 10
0

6
IN1 OUT1 LE LED U10 LMD18200T DIR BS2 C20
3 18 1 2 1 5

GND
IN2 OUT2 OE D6 R15 PWM 10nF
4 17 9 OUT1 2 4 11

VCC
IN3 OUT3 TH OUT G2M1 BRAKE OUT2 TM2
5 16 74LS373 LED 6K8 8
IN4 OUT4 J12 D7 CS OUT C13
6 15 1
IN5 OUT5 BS1

7
7 14 JUMPER1 LED
IN6 OUT6 R9 1K D8
8
IN7 OUT7 13 G2 MOTOR
J4 9 12 LED 3 10
IN8 OUT8 5V D9 DIR BS2 C14
10 11 5

GND
C C
GND CH J13 LED PWM 10nF 12V
4 11 G2M2
D10 BRAKE OUT2 12V
1 MAX6818
2 1 LED 100uF C21

7
to SRM 3 2 R20
5V
4 3 10K
LIMIT

6
5 4 U13 LMD18200T
SENSORS 6 5 R21 9 OUT1 2

VCC
TH OUT G1M1
6 6K8 8 CS OUT C22
7 1
BS1
8
HEADER 6 9 G1 MOTOR
10 3 10
DIR BS2 C23
11 5

GND
5V 5V 12V PWM 10nF
C32 0.1uF 12 4 11 G1M2
U3 5V BRAKE OUT2
J11 13
1 20 14
EN Vcc

7
1 2 19 15
IN1 OUT1 D17
2 3 IN2 OUT2 18 J3
3 4 17
IN3 OUT3 HEADER 15 1N4007
to various 4 5
IN4 OUT4 16 1
5 6 15 2
LIMIT 6 7
IN5 OUT5
14
IN6 OUT6 Q1
SENSORS 7 8
IN7 OUT7 13 HEADER 2
8 9 12
IN8 OUT8
9 10 11
GND CH 2N2222
10
10

MAX6818
2
3
4
5
6
7
8
9

HEADER 10
RESISTOR SIP 10 5K
VCC RS1
1

B B

TRANSMITTER CARD D14 DIODE

SW DPDT SW1 U16 7805 U18 TLP916F ANTENNA


D13
1 3
GND

VIN VOUT E1
D15
DATA IN

LED R23 LED R22


VCC
4K7
GND

VCC

10K C24
ANT
2

0.1uF 5V

GND
Ant
1

RECEIVER CARD
J7 U15 RLP916F
5V
8
CTS U17 HIN232 Ant

DOut
1

LOut

Gnd
Gnd
Gnd

Vcc
Vcc
2 RXD CTS TTL 11 14
GND RXD TTL T1IN T1OUT
3 10 T2IN T2OUT 7
4 SW2 SW DPDT U14

1
6
7

4
5
13 12
TXD R1IN R1OUT
8 9 3 2
HEADER 4 R2IN R2OUT RXD TTL VIN VOUT
C25
1uF 1 1
C1+ ADJ R8
3 C1- CTS TTL LM317/TO220 330E
C26 4 R7
C2+ 5V VAR R
1uF 5
C2- D16 J8 RLP916F Conn.
2 LED
GND
VCC

C27 V+
6 1
2.2uF V-
2
0
C28 3
16

15

2.2uF R24 4
10K

5V
C29
A A
C
(On PC Side)

Title
XABRE HARDWARE
Size Document Number Rev
1 1

Date: Thursday, December 11, 2003 Sheet 1 of 1

5 4 3 2 1
Project Report
7th Sem I.C.

SECTIO 5

Dual PWM Generation


This is required to control the driving of the two locomotion motors which
have speed control implement in them by way of use of the H-bridge IC.

Phase 3

Phase 2

Phase 1
Small_Val Diff

Big_Val Delay
FFh

Drv_bit2=1 =>Drive magnitudes equal (Drv_bit1=0 then)


Drv_bit1=1 =>LD lesser than RD (Drv_bit2=0 then)
Drv_bit1=0 =>RD lesser than LD (Drv_bit2=0 then)
Phase_bits 3,2,1
Phase_bit3 for phase 3
Phase_bit2 for phase 2
Phase_bit1 for phase 1
1 indicates currently active phase, while rest of the bits will be zero
Port Bits (Hardware defined)
P0.0: Left Drv PWM Bit
P0.1: Left Drv Direction Bit
P0.2: Right Drv PWM Bit
P0.3: Right Drv Direction Bit
Phases
Phase 1: Delay part of the whole time period. Value equal to 255-Small_val-Diff
Load 255-40 Phase 3 indicated by 100 If 100 stop both
On overflow set 255-50 Phase 2 indicated by 010 If 010 stop LD else stop
RD
On overflow set 255-6F Phase 1 indicated by 001 Both Drives off
On LD command
Save value to Left Locomotion Reg. M4M3M2M1-D-000
Call Set_Timer

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

On RD command
Save value to Right Locomotion Reg. M4M3M2M1-D-000
Call Set_Timer

Set_Timer:
Load L magnitude to temp1
Load R magnitude to temp2
Compare both magnitudes
If L_Mag=R_Mag
Set Drv_bit2
Clr Drv_bit1
Small_val=L_mag
Big_val=R_mag
Diff=01h
Delay=255-Big_val
If L_Mag<R_Mag
Clr Drv_bit2
Set Drv_bit1
Small_val=255-L_mag
Big_val=R_mag
Diff=Small_val-Big_val)
Delay=255-Big_val
If L_Mag>R_Mag
Clr Drv_bit2
Clr Drv_bit1
Small_val=255-R_mag
Big_val=L_mag
Diff=Small_val-Big_val)
Delay=255-Big_val

On overflow ;At µC’s ISR for TF0


Goto PWM_sub; ;Jump to prog’s ISR

PWM_sub: ;Prog’s ISR


Stop Timer0; ;Stop the timer0
If Phase_bit3 set ;Indicates end of phase 3
Set Phase_bit2; ;Set start of phase 2
Clr Phase_bit3; ;Reset bit to show end of phase
3
Load Diff to TL0 ;Phase 2 counts for Diff period
Goto PWM_writer; ;Perform PWM toggling
Else
If Phase_bit2 set ;Indicates end of phase 2
Set Phase_bit1; ;Set start of phase 1

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

Clr Phase_bit2; ;Reset bit to show end of phase


2
Load Delay to TL0 ;Phase 1 counts for Delay
period
Goto PWM_writer;
Else ;Indicates end of phase 1
Set Phase_bit3; ;Set start of phase 3
Clr Phase_bit1; ;Reset bit to show end of phase
1
Load Small_val to TL0; ;Phase 3 counts for Small val
period
Goto PWM_writer; ;Perform PWM toggling
PWM_writer
Start Timer0;
If Phase_bit3 set ;Phase 3 ON, so both drives ON
P0.1 = 1; ;Turn ON LD
P0.2 = 1; ;Turn ON RD
Write Mag_bits; ;Magnitude bits are also set
Else
If Phase_bit2 set ;Phase 2 ON so lesser drive
OFF
If Drv_bit2set ;Both drives equal, turn ‘em
OFF
P0.1 = 0; ;Turn OFF LD
P0.2 = 0; ;Turn OFF RD
Else
If Drv_bit1 set ;Drv_bits=01 so LD is less, so
OFF
P0.1 = 0; ;Turn OFF LD
Else ;Drv_bits=00 so RD is less, so
OFF
P0.0 = 0; ;Turn OFF RD
Else
If Phase_bit1 set ;Phase 1 ON so both drive OFF
P0.1 = 0; ;Turn OFF LD
P0.2 = 0; ;Turn OFF RD

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

H-Bridge Logic
(Extracted from Mag I.C. ’03, the annual magazine of IC Dept irma Institute of
Technology. Authored by Abhijit Karnik.)
There’s this nice idea you have floating about in your mind about a tank style
robot you would like to build. All goes well till you decide to have the ability to
reverse and there you have a nice pitfall. You can’t find a way to make your motor
to get voltage in the reverse direction except use cumbersome relays with a number
of switches. If you have been using a digital logic operation mode then again even
relays are difficult to use. So what do you do? The answer lies in the H-bridge.
The H-Bridge is basically a configuration which allows you to run the D.C.
motor in any direction you want. The D.C. motor has 2 terminals. If one of the
terminals is given positive D.C and the second terminal is grounded, the motor
rotates in one direction. If the connections are reversed then, the motor rotates in the
other direction. Now this means we need a circuit which allows either terminal to be
connected to positive supply and the other one to ground as per our wish. As in
figure 1 we have path A indicating connection for CCW motion, and path B for CW
motion and arrangement that at a time only one path is
active, then the resulting configuration is the basic H-bridge.
The blocks marked 1, 1’, 2 and 2’ in the figure are devices
which allow the above requirement to be fulfilled.
The simplest option would be to use n-channel
MOSFETs, as the blocks, which have the adequate power
rating. The gate signal would be delivered from a logic gate
that turns ON FETs 1 and 1’ while FETs 2 and 2’ would be
OFF. This can be achieved by connecting the gates of FETs
Figure 1 1 and 1’ directly to gate output while the gates of FETs 2
and 2’ are connected to the inverted output of the same gate.
The operation of the H-Bridge is then as follows: If the gate output is high, FETs 1
and 1’ are ON and FETs 2 and 2’ are OFF. Path A is open while path B is closed
and we have CCW motion. When the gate output is low, FETs 2 and 2’ are ON and
FETs 1 and 1’ are OFF. Path B is open while path A is closed and we have CW
motion.
This arrangement is seemingly quite simple and easy to setup. So there should be
some problems too. The 2 most basic problems in this arrangement are speed control
and switching transients.
For the first problem, we see that the H-bridge has no arrangements for
controlling the speed of the motor. Either the motor is rotating CCW or CW at full
power. The solution to this problem lies in pulse width modulation or PWM method.
In short this method varies the operational duty cycle, i.e. the on time of the motor.
The average DC delivered to the motor is varied by providing to the gate, pulses of
variable time duration, ensuring that the motor speed is controlled. If we ‘AND’ the
output of the control gate before it is supplied to any of the FET gate terminals, with
a variable pulse width generator, PWM input is available to the FET gate terminals.
The variable pulse width generator can be an IC555 in monostable mode with the
time constant being varied by a pot and another IC555 in astable mode providing
trigger input. The duty cycle can be varied from nearly 0% to ~99% of the frequency

Nirma Institute of Technology


Technology
XABRE
Project Report
7th Sem I.C.

of the astable IC555. Accordingly the motor speed varies from 0 rpm to full rated
value.
The second problem (which is a bigger problem) is the switching transients.
The motor coil can be considered to be an inductor. An inductor tries to oppose
changes in current magnitude flowing through it. Abruptly switching off the current
supply induces large transient spikes in voltage due to the collapsing magnetic field
in the motor coil. This transient voltage and current can fry your FETs if they are not
built to handle the voltages. Another possible source of transient current is known as
‘free wheeling’. Due to motor inertia, the rotation of the motor may not stop
immediately. During this time the motor can act as a generator sourcing large
current values. These problems are more complicated and need more control
circuitry that keep both FETs 1’ and 2’ ON during switching and allow transients to
run to ground. Another option would be to use zener diodes with knee voltage
greater than supply and with enough power dissipation ratings connected between
ground and both terminals (Cathodes towards motor). In any case the FETs tend to
dissipate a lot of heat while switching, which needs to be diverted to a sink properly.
Another solution to this problem is using one of the H-bridge ICs that are
available. These ICs come with internal arrangements for transient protection and
thermal shutdown. There is simple arrangement for direction control and speed
control in form of separate pins. Normally you would find a pin labeled PWM input
and another labeled direction. Their limitations are in terms of peak voltages and
current ratings. Another limitation is cost. They are a trifle bit too expensive. One of
the H-bridge ICs is LMD18200T from National Semiconductor. I have mentioned
this IC since it allows 3A and 55V and best of all, National sends free samples (it
costs $8.5) so experiments are easier to conduct. Texas Instruments also has similar
ICs. Specific part numbers of FETs are not mentioned since it depends on your
motor and supply and mostly because I haven’t used any. I learnt about the existence
of H-bridge and directly headed for National’s website to search for a related IC and
found the LMD18200T.
The H-bridge is a very good solution for speed-direction control of a DC
motor and if your motor is not going to take large currents, even FETs without
arrangements for transient bypassing can do the job satisfactorily. With the H-
Bridge, direction and speed control should never come in way of realizing the dream
of your very own bot!

Nirma Institute of Technology


Technology
XABRE
-

DS89C420
Ultra-High-Speed Microcontroller
www.maxim-ic.com

GENERAL DESCRIPTION FEATURES


The DS89C420 offers the highest performance § 80C52 Compatible
available in 8051-compatible microcontrollers. It 8051 Pin- and Instruction-Set Compatible
features a redesigned processor core that executes Four Bidirectional I/O Ports
every 8051 instruction (depending on the instruction Three 16-Bit Timer Counters
type) up to 12 times faster than the original for the 256 Bytes Scratchpad RAM
same crystal speed. Typical applications see a speed
§ On-Chip Memory
improvement of 10 times using the same code and
16kB Flash Memory
crystal. The DS89C420 offers a maximum crystal
In-System Programmable through Serial Port
speed of 33MHz, achieving execution rates up to 33
1kB SRAM for MOVX
million instructions per second (MIPS).
§ ROMSIZE Feature
APPLICATIONS Selects Internal Program Memory Size from
0 to 16k
Data Logging
Allows Access to Entire External Memory Map
Vending
Dynamically Adjustable by Software
Automotive Test Equipment
Motor Control § High-Speed Architecture
Magstripe Reader/Scanner 1 Clock-Per-Machine Cycle
Consumer Electronics DC to 33MHz Operation
Gaming Equipment Single-Cycle Instruction in 30ns
Appliances (Washers, Microwaves, etc.) Optional Variable Length MOVX to Access
Telephones Fast/Slow Peripherals
HVAC Dual Data Pointers with Auto
Building Security and Door Access Control Increment/Decrement and Toggle Select
Building Energy Control and Management Supports Four Paged Modes
Uninterruptible Power Supplies § Power Management Mode
Programmable Logic Controllers Programmable Clock Divider
Industrial Control and Automation Automatic Hardware and Software Exit
§ Two Full-Duplex Serial Ports
ORDERING INFORMATION
MAX § Programmable Watchdog Timer
CLOCK PIN-
PART TEMP RANGE
SPEED PACKAGE
§ 13 Interrupt Sources (Six External)
(MHz) § Five Levels of Interrupt Priority
DS89C420-MNG -40°C to +85°C 25 40 PDIP
DS89C420-QNG -40°C to +85°C 25 44 PLCC
§ Power-Fail Reset
DS89C420-ENG -40°C to +85°C 25 44 TQFP § Early Warning Power-Fail Interrupt
DS89C420-MCL 0°C to +70°C 33 40 PDIP
DS89C420-QCL 0°C to +70°C 33 44 PLCC
DS89C420-ECL 0°C to +70°C 33 44 TQFP
DS89C420-MNL -40°C to +85°C 33 40 PDIP
DS89C420-QNL -40°C to +85°C 33 44 PLCC
DS89C420-ENL -40°C to +85°C 33 44 TQFP

Pin Configurations appear at end of data sheet.

Note: Some revisions of this device may incorporate deviations from published specifications known as errata. Multiple revisions of any device
may be simultaneously available through various sales channels. For information about device errata, click here: www.maxim-ic.com/errata.

1 of 47 REV: 102203
DS89C420 Ultra-High-Speed Microcontroller

PIN CONFIGURATIONS

TOP VIEW TOP VIEW

33 23
6 1 40

7 39
34 22
Dallas
Dallas Semiconductor
Semiconductor DS89C420
DS89C420

44 12
17 29

18 28
1 11
PLCC
TQFP

TOP VIEW

P1.0/T2 1 40 VCC
P1.1/T2EX 2 39 P0.0
P1.2/RXD1 3 38 P0.1
P1.3/TXD1 4 37 P0.2
P1.4/INT2 5 36 P0.3
P1.5/INT3 6 35 P0.4
P1.6/INT4 7 34 P0.5
P1.7/INT5 8 33 P0.6
RST 9 32 P0.7
P3.0/RXD0 10 DS89C420 31 EA/VPP
P3.1/TXD0 11 30 ALE/PROG
P3.2/INT0 12 29 PSEN
P3.3/INT1 13 28 P2.7
P3.4/T0 14 27 P2.6
P3.5/T1 15 26 P2.5
P3.6/WR 16 25 P2.4
P3.7/RD 17 24 P2.3
XTAL2 18 23 P2.2
XTAL1 19 22 P2.1
VSS 20 21 P2.0

DIP

46 of 47
Ultra-High-Speed Flash
Microcontroller User’s Guide

UHSM UHSM 8051 8051 UHSM vs.


HEX CLOCK TIME CLOCK TIME 8051 SPEED
INSTRUCTION CODE CYCLES @ 25MHz CYCLES @ 25MHz ADVANTAGE
CJNE A, #data, rel B4 4 160 ns 24 960 ns 6
CJNE Rn, #data, rel B8..BF 4 160 ns 24 960 ns 6
CJNE @Ri, #data, rel B6..B7 5 200 ns 24 960 ns 4.8
DJNZ Rn, rel D8..DF 4 160 ns 24 960 ns 6
DJNZ direct, rel D5 5 200 ns 24 960 ns 4.8
NOP 00 1 40 ns 12 480 ns 12

Table 5-2. INSTRUCTION SPEED SUMMARY


SPEED
INSTRUCTION CATEGORY QUANTITY
ADVANTAGE
Total instructions: 1 byte 4.0 2
4.8 1
5.3 1
6.0 12
8.0 5
12.0 27
24.0 1
Total instructions: 2 byte 4.0 1
6.0 27
8.0 5
12.0 13
Total instructions: 3 byte 4.8 3
6.0 5
8.0 8
Average across all instructions 8.5 111
SPEED
OPCODE CATEGORY ADVANTAGE QUANTITY
Total opcodes: 1 byte 4.0 4
4.8 1
5.3 1
6.0 35
8.0 5
12.0 93
24.0 1
Total opcodes: two byte 4.0 1
6.0 42
8.0 5
12.0 43
Total opcodes: three byte 4.8 4
6.0 12
8.0 8
Average across all opcodes 9.4 255

SECTION 6: MEMORY ACCESS


The DS89C420 ultra-high-speed microcontroller supports the memory interface convention established for the industry standard
80C51, but also implements two new page mode memory interfaces needed to support ultra-high-speed external operation. These
external page mode interfaces are described later in this section.

53 _____________________________________________________________________________________________
Ultra-High-Speed Flash
Microcontroller User’s Guide

the watchdog reset function automatically. Other bits of this register are undefined and are at logic 1 when read. The value of this reg-
ister can be read at address FCh in parallel programming mode or by executing the verify option control register instruction in ROM
Loader or in-application programming mode.

FFFF FFFF

Note: The hatched areas shown on the internal and external


memory are disabled on power-up (Default)

INTERNAL
MEMORY
03FF
1kB x 8
SRAM External External
Program Data
INTERNAL SCRATCH Data OR Memory Memory
REGISTERS PAD prog mem
addr from
128 Bytes SFR 0000
400–7FF

4000
FF 3FFF

8kB x 8
128 Bytes Flash
Indirect Memory
Addressing (Program)
2000
80
7F
1FFF
2F
20 Bit Addressable 8kB x 8
1F Flash
Bank 3
Memory 03FF
Bank 2 Non-usable if
(Program)
Bank 1 Internal SRAM
Bank 0 is activated
00 0000 0000 0000

Figure 6-1. Memory Map

INTERNAL SRAM MEMORY


The DS89C420 ultra-high-speed microcontroller incorporates an internal 1kB SRAM that is usable as data, program, or merged pro-
gram/data memory. Upon a power-on reset, the internal 1kB memory is disabled and transparent to both program and data memory
maps.
When used for data, the memory is addressed through MOVX commands, and is in addition to the 256 bytes of scratchpad memory.
To enable the 1kB SRAM as internal data memory, software must set the DME0 bit (PMR.0). After setting this bit, all MOVX accesses
within the first 1kB (0000h–03FFh) is directed to the internal SRAM. Any data memory accesses outside of this range are still directed
to the expanded bus. One advantage of using the internal data memory is that MOVX operations automatically default to the fastest
access possible. Note that the DME0 bit is cleared after any reset, so access to the internal data memory is prohibited until this bit is
modified. The contents of the internal data memory are not affected by the changing of the data memory enable (DME0) bit. Table 6-
3 shows how the DME1, DME0 bits affect the data memory map.

_____________________________________________________________________________________________ 56
Ultra-High-Speed Flash
Microcontroller User’s Guide

Mode 1
Mode 1 is asynchronous and full duplex, using a total of 10 bits. The 10 bits consist of a start bit (logic 0), 8 data bits, and 1 stop bit
(logic 1) as illustrated in Figure 12-2. The data is transferred LSb first. As described above, the baud rates for mode 1 are generated
by either a divide-by-16 of timer 1 rollover, a divide-by-16 of the timer 2 rollover, or a divide-by-32 of timer 1 rollover. The UART begins
transmission after the first rollover of the divide-by-16 counter following a software write to SBUF. Transmission takes place on the TXD
pin. It begins by the start bit being placed on the pin. Data is then shifted out onto the pin, LSb first. The stop bit follows. The TI bit is
set by hardware after the stop bit is placed on the pin. All bits are shifted out at the rate determined by the baud-rate generator.
Once the baud-rate generator is active, reception can begin at any time. The REN bit (SCON0.4 or SCON1.4) must be set to a logic 1
to allow reception. The falling edge of a start bit on the RXD pin begins the reception process. Data is shifted in at the selected baud
rate. At the middle of the stop bit time, certain conditions must be met to load SBUF with the received data:
• RI must = 0, and either
• If SM2 = 0, the state of the stop bit does not matter, or
• If SM2 = 1, the state of the stop bit must = 1.
If these conditions are true, then SBUF (hex address 99h or C1h) is loaded with the received byte, the RB8 bit (SCON0.2 or SCON1.2)
is loaded with the stop bit, and the RI bit (SCON0.0 or SCON1.0) is set. If these conditions are false, then the received data is lost
(SBUF and RB8 not loaded) and RI is not set. Regardless of the receive word status, after the middle of the stop bit time, the receiver
goes back to looking for a 1 to 0 transition on the RXD pin.
Each data bit received is sampled on the 7th, 8th, and 9th clock used by the divide-by-16 counter. Using majority voting, two equal
samples out of the three determine the logic level for each received bit. If the start bit was determined to be invalid ( = 1), then the
receiver goes back to looking for a 1 to 0 transition on the RXD pin in order to start the reception of data.
Mode 2
Mode 2 uses a total of 11 bits in asynchronous full-duplex communication, as illustrated in Figure 12-3. The 11 bits consist of 1 start
bit (a logic 0), 8 data bits, 1 programmable 9th bit, and one stop bit (a logic 1). Like mode 1, the transmissions occur on the TXD sig-
nal pin and receptions on RXD. For transmission purposes, the 9th bit can be stuffed as a logic 0 or 1. A common use is to put the par-
ity bit in this location. The 9th bit is transferred from the TB8 bit position in the SCON register (SCON0.3 or SCON1.3) during the write
to SBUF. Baud rates are generated as a fixed function of the crystal frequency, as described earlier in this section. Like mode 1, mode
2’s transmission begins after the first rollover of the divide-by-16 counter following a software write to SBUF. It begins by the start bit
being placed on the TXD pin. The data is then shifted out onto the pin LSb first, followed by the 9th bit, and finally the stop bit. The TI
bit (SCON0.1 or SCON1.1) is set when the stop bit is placed on the pin.
Reception begins when a falling edge is detected as part of the incoming start bit on the RXD pin. The RXD pin is then sampled accord-
ing to the baud-rate speed. The 9th bit is placed in the RB8 bit location in SCON (SCON0.2 or SCON1.2). When a stop bit has been
received, the data value is transferred to the SBUF receive register (hex address 99 or C1). The RI bit (SCON0.0 or SCON1.0) is set to
indicate that a byte has been received. At this time, the UART can receive another byte.
Once the baud-rate generator is active, reception can begin at any time. The REN bit (SCON0.4 or SCON1.4) must be set to a logic 1
to allow reception. The falling edge of a start bit on the RXD pin begins the reception process. Data must be shifted in at the selected
baud rate. At the middle of the 9th bit time, certain conditions must be met to load SBUF with the received data.
• RI must = 0, and either
• If SM2 = 0, the state of the 9th bit does not matter, or
• If SM2 = 1, the state of the 9th bit must = 1.
If these conditions are true, then SBUF is loaded with the received byte, RB8 is loaded with the 9th bit, and RI is set. If these condi-
tions are false, then the received data is lost (SBUF and RB8 not loaded) and RI is set. Regardless of the receive word status, after the
middle of the stop bit time, the receiver goes back to looking for a 1 to 0 transition on RXD.
Data is sampled in a similar fashion to mode 1 with the majority voting on three consecutive samples. Mode 2 uses the sample divide-
by-16 counter with either the oscillator divided by 2 or 4.

____________________________________________________________________________________________ 114
Ultra-High-Speed Flash
Microcontroller User’s Guide

SBUF
TRANSMIT SHIFT REGISTER
TIMER 2 P3.1 TXD

CLOCK
S0

START
TIMER 1 OVERFLOW LATCH PIN

LOAD

STOP
OVERFLOW

D7
D6
D5
D4
D3
D2
D1
D0
AVAILABLE TO SERIAL

1 0
DIVIDE-
PORT 0 ONLY

BY-2
SMOD_0 =
PCON.7 0 1
OR
SMOD_1 = DATA BUS
WDCON.7 LDSBUF
RDSBUF
0 1
TCLK = LOAD SHIFT
T2CON.4 SBUF
SERIAL
READ
SERIAL I/O
BUFFER CONTROL RD RECEIVE DATA BUFFER WR
SERIAL
DIVIDE- BUFFER
BAUD
RCLK = BY-16
CLOCK
T2CON.5 0 1 LOAD
RESET
RB8 =
INTS

SCONx.2

T1 R1

START
CLOCK
FLAG = FLAG = STOP
D7
D6
D5
D4
D3
D2
D1
D0
SCONx.1 SCONx.0
SI
SERIAL
INTERRUPT RECEIVE SHIFT REGISTER

DIVIDE- BIT RXD


BY-16 DETECTION PIN

TRANSMIT TIMING
LDSBUF

SHIFT

TXD
START D0 D1 D2 D3 D4 D5 D6 D7 STOP

TI

RECEIVE TIMING
RXD
START D0 D1 D2 D3 D4 D5 D6 D7 STOP

BIT DETECTOR
SAMPLING

SHIFT

RI

Figure 12-2. Serial Port Mode 1

115 ____________________________________________________________________________________________
Ultra-High-Speed Flash
Microcontroller User’s Guide

SECTION 15: PROGRAM LOADING


INTRODUCTION
The DS89C420 family has the ability to perform program loading or reloading in a number of ways. First, ROM loader mode can be
invoked to create a serial communication channel, which permits in-system program/erase of the internal and external program mem-
ory. Secondly, parallel programming mode allows programming and erasure of the internal flash memory using industry-standard
EPROM or flash parallel programmers. Finally, user code in-application programming allows the capability to in-application erase and
reprogram the upper 8kb block of flash memory through a special function register interface.
Note: The terms ROM loader, serial loader, and bootstrap loader are used interchangeably in this section and refer to the same func-
tional entity.
ROM LOADER MODE
The DS89C420 defaults to the normal operating (nonloader) mode without external hardware. ROM loader mode can be invoked at
any time, as described later in this section. Once the loader session is complete, the device performs a hardware reset and begin
operation. This is identical to an external reset, except that the ROM loader during the loader session may modify locations in scratch-
pad RAM in order to execute properly. The Table 15-1 shows which areas of scratchpad RAM are guaranteed preserved and which
ones are of indeterminate state after exiting the loader.
Table 15-1. Preserved and Indeterminate Scratchpad Memory
DS89C420
SCRATCHPAD MEMORY
Guaranteed Preserved 80h–FFh
Indeterminate 00h–7Fh
The guaranteed preserved locations are areas in scratchpad RAM that are be changed by the bootstrap loader. The indeterminate
area contains various stacks and buffers used by the loader, and a given byte in this area may or may not be modified by the loader.
As such, the user should not rely on the loader preserving any data in this area.
It should also be noted that the loader, upon being invoked, clears the EWT bit (WDCON.1) so that the watchdog timer is prevented
from generating an internal reset during the loader session.
Invoking the ROM Loader Mode
The ROM loader mode is invoked by simultaneously applying a logic 1 to the RST pin, a logic 0 to the EA pin, and driving the PSEN
pin to a logic 0 level. If power were to cycle while the required input stimuli were present, the loader would be invoked on power-up.
When the ROM loader mode is invoked, the device awaits an incoming <CR> character (0Dh) on serial port 0 at a baud rate that can
be detected by the autobaud routine. The autobaud routine is described later in this section. The autobaud routine receives and trans-
mits data only on serial port 0, ignoring activity on serial port 1. Upon successful baud-rate detection, the bootstrap loader transmits
a banner similar to the one shown below, signaling to the host that loader mode has successfully been invoked. The banner is followed
by a “>” prompt, which indicates the device is ready to receive a command. The command set recognizable by the ROM loader is also
detailed later in this section. The flow of these conditions is shown in Figure 15-1.
Exiting the Loader
In order to exit ROM loader mode on the DS89C420 device, first float the PSEN signal, and then float or drive the RST pin low. The RST
pin has an internal pulldown. The PSEN signal is an output and drives itself high. When the loader stimulus is removed, the processor
performs a hardware reset and begin execution at location 0000h. Note that both of these conditions must occur, or the loader is exit-
ed. The flow of these conditions is shown in Figure 15-1.

127 ____________________________________________________________________________________________
Ultra-High-Speed Flash
Microcontroller User’s Guide

PROGRAM EXECUTION
INTERNAL MEMORY DISABLED EA\ =0
INTERNAL MEMORY ENABLED EA\ =1

N
RST = 1

N
DEVICE IN RESET
EA\ = 0 (INTERNAL MEMORY ENABLED)

N
DEVICE IN RESET
PSEN\ = 0 (INTERNAL MEMORY DISABLED)

AUTOBAUD ROUTINE
AWAITING <CR> CHARACTER ON RXD OF SERIAL PORT 0

Y
SERIAL COMMUNICATION WITH THE ROM LOADER CAN PSEN\
PROCEED AS ESTABLISHED ON SERIAL PORT 0 TOGGLED 0 1

N Y
POWER-ON
RESET

Figure 15-1. Invoking and Exiting the Loader on the DS89C420

____________________________________________________________________________________________ 128
Ultra-High-Speed Flash
Microcontroller User’s Guide

Serial Program Load Operation


Program loading through a serial port is a convenient method of loading application software into the flash memory or external mem-
ory. Communication is performed over a standard, asynchronous serial communications port using a terminal emulator program with
8-N-1 (8 data bits, no parity, 1 stop bit) protocol settings. A typical application would use a simple RS-232 serial interface to in-system
program the device as part of a final production procedure.
The hardware configuration for the serial program load operation is illustrated in Figure 15-2. A variety of crystals can be used to pro-
duce standard baud rates. The serial loader is designed to operate across a 3-wire interface from a standard UART. The receive, trans-
mit, and ground wires are all that are necessary to establish communication with the device.
The serial loader implements an easy-to-use command line interface, which allows an Intel hex file to be loaded and read back from
the device. Intel hex is the standard format output by 8051 cross-assemblers.

TO PC
TD
ROIN ROOUT RXDO

RD
TOOUT DS232A TOIN TXDO

DTR
R1IN R1OUT
DS89C420

T1OUT T1IN VCC RST

EA

PSEN

HC/AC125

Figure 15-2. Serial Load Hardware Configuration

AUTOBAUD-RATE DETECTION
The serial bootstrap loader can automatically detect, within certain limits, the external baud rate and configure itself to that speed. The
loader controls serial port 0 in mode 1 (asynchronous, 1 start bit, 8 data bits, no parity, 1 stop bit, full duplex), using timer 1 in 8-bit
autoreload mode with the serial port 0 doubler bit (PCON.7) set. For these settings, an equation to calculate possible serial loader
baud rates is provided as a function of crystal frequency and timer reload value. Table 15-1 shows baud rates generated using the
equation:

Crystal Frequency
Serial Loader_Baud rate =
192 x ( 256-Timer Reload )
** Timer reload values attempted by the loader:
FF, FE, FD, FC, FB, FA, F8, F6, F5, F4, F3, F0, EC, EA, E8,
E6, E0, DD, D8, D4, D0, CC, C0, BA, B0, A8, A0, 98, 80, 60, 40
When communicating with a PC COM port having a standard 8250/16450 UART, attempt to match the loader baud rate and PC COM
port baud rate within 3% in order to maintain a reliable communication channel. If baud rates cannot be matched exactly, it is suggest-
ed configuring the loader to the faster baud rate to avoid the possibility of overflowing the DS89C420 serial input buffer.

129 ____________________________________________________________________________________________
LMD18200 3A, 55V H-Bridge
December 1999

LMD18200
3A, 55V H-Bridge
General Description n No “shoot-through” current
n Thermal warning flag output at 145˚C
The LMD18200 is a 3A H-Bridge designed for motion control
n Thermal shutdown (outputs off) at 170˚C
applications. The device is built using a multi-technology pro-
cess which combines bipolar and CMOS control circuitry n Internal clamp diodes
with DMOS power devices on the same monolithic structure. n Shorted load protection
Ideal for driving DC and stepper motors; the LMD18200 ac- n Internal charge pump with external bootstrap capability
commodates peak output currents up to 6A. An innovative
circuit which facilitates low-loss sensing of the output current Applications
has been implemented.
n DC and stepper motor drives
n Position and velocity servomechanisms
Features n Factory automation robots
n Delivers up to 3A continuous output n Numerically controlled machinery
n Operates at supply voltages up to 55V n Computer printers and plotters
n Low RDS(ON) typically 0.3Ω per switch
n TTL and CMOS compatible inputs

Functional Diagram

DS010568-1

FIGURE 1. Functional Block Diagram of LMD18200

© 1999 National Semiconductor Corporation DS010568 www.national.com


LMD18200
Connection Diagrams and Ordering Information

DS010568-2

11-Lead TO-220 Package


Top View
Order Number LMD18200T
See NS Package TA11B

DS010568-25

24-Lead Dual-in-Line Package


Top View
Order Number LMD18200-2D-QV
5962-9232501VXA
LMD18200-2D/883
5962-9232501MXA
See NS Package DA24B

www.national.com 2
LMD18200
Electrical Characteristics Notes
Note 1: Absolute Maximum Ratings indicate limits beyond which damage to the device may occur. DC and AC electrical specifications do not apply when op-
erating the device beyond its rated operating conditions.
Note 2: See Application Information for details regarding current limiting.
Note 3: The maximum power dissipation must be derated at elevated temperatures and is a function of TJ(max), θJA, and TA. The maximum allowable power dis-
sipation at any temperature is PD(max) = (TJ(max) − TA)/θJA, or the number given in the Absolute Ratings, whichever is lower. The typical thermal resistance from junc-
tion to case (θJC) is 1.0˚C/W and from junction to ambient (θJA) is 30˚C/W. For guaranteed operation TJ(max) = 125˚C.
Note 4: Human-body model, 100 pF discharged through a 1.5 kΩ resistor. Except Bootstrap pins (pins 1 and 11) which are protected to 1000V of ESD.
Note 5: All limits are 100% production tested at 25˚C. Temperature extreme limits are guaranteed via correlation using accepted SQC (Statistical Quality Control)
methods. All limits are used to calculate AOQL, (Average Outgoing Quality Level).
Note 6: Output currents are pulsed (tW < 2 ms, Duty Cycle < 5%).
Note 7: Regulation is calculated relative to the current sense output value with a 1A load.
Note 8: Selections for tighter tolerance are available. Contact factory.

Typical Performance Characteristics


VSAT vs Flag Current RDS(ON) vs Temperature RDS(ON) vs
Supply Voltage

DS010568-16 DS010568-17

DS010568-18

Supply Current vs Supply Current vs Supply Current vs


Supply Voltage Frequency (VS = 42V) Temperature (VS = 42V)

DS010568-19
DS010568-20 DS010568-21

Current Sense Output Current Sense


vs Load Current Operating Region

DS010568-22 DS010568-23

www.national.com 4
LMD18200
Test Circuit

DS010568-8

Switching Time Definitions

DS010568-9

Pinout Description (See Connection Diagram) it is also necessary to apply logic high to PWM input, pin 5.
The drivers that short the motor are determined by the logic
Pin 1, BOOTSTRAP 1 Input: Bootstrap capacitor pin for half level at the DIRECTION input (Pin 3): with Pin 3 logic high,
H-bridge number 1. The recommended capacitor (10 nF) is both current sourcing output transistors are ON; with Pin 3
connected between pins 1 and 2. logic low, both current sinking output transistors are ON. All
Pin 2, OUTPUT 1: Half H-bridge number 1 output. output transistors can be turned OFF by applying a logic high
Pin 3, DIRECTION Input: See Table 1. This input controls to Pin 4 and a logic low to PWM input Pin 5; in this case only
the direction of current flow between OUTPUT 1 and OUT- a small bias current (approximately −1.5 mA) exists at each
PUT 2 (pins 2 and 10) and, therefore, the direction of rotation output pin.
of a motor load. Pin 5, PWM Input: See Table 1. How this input (and DIREC-
Pin 4, BRAKE Input: See Table 1. This input is used to TION input, Pin 3) is used is determined by the format of the
brake a motor by effectively shorting its terminals. When PWM Signal.
braking is desired, this input is taken to a logic high level and

5 www.national.com
LMD18200
Pinout Description
(See Connection Diagram) (Continued)

Pin 6, VS Power Supply


Pin 7, GROUND Connection: This pin is the ground return,
and is internally connected to the mounting tab.
Pin 8, CURRENT SENSE Output: This pin provides the
sourcing current sensing output signal, which is typically
377 µA/A.
Pin 9, THERMAL FLAG Output: This pin provides the ther-
mal warning flag output signal. Pin 9 becomes active-low at
DS010568-4
145˚C (junction temperature). However the chip will not shut
itself down until 170˚C is reached at the junction. FIGURE 2. Locked Anti-Phase PWM Control
Pin 10, OUTPUT 2: Half H-bridge number 2 output.
Sign/magnitude PWM consists of separate direction (sign)
Pin 11, BOOTSTRAP 2 Input: Bootstrap capacitor pin for
and amplitude (magnitude) signals (see Figure 3). The (ab-
Half H-bridge number 2. The recommended capacitor
solute) magnitude signal is duty-cycle modulated, and the
(10 nF) is connected between pins 10 and 11.
absence of a pulse signal (a continuous logic low level) rep-
resents zero drive. Current delivered to the load is propor-
TABLE 1. Logic Truth Table tional to pulse width. For the LMD18200, the DIRECTION in-
put (pin 3) is driven by the sign signal and the PWM input
PWM Dir Brake Active Output Drivers (pin 5) is driven by the magnitude signal.
H H L Source 1, Sink 2
H L L Sink 1, Source 2
L X L Source 1, Source 2
H H H Source 1, Source 2
H L H Sink 1, Sink 2
L X H NONE

Application Information
TYPES OF PWM SIGNALS
The LMD18200 readily interfaces with different forms of
PWM signals. Use of the part with two of the more popular DS010568-5
forms of PWM is described in the following paragraphs.
FIGURE 3. Sign/Magnitude PWM Control
Simple, locked anti-phase PWM consists of a single, vari-
able duty-cycle signal in which is encoded both direction and SIGNAL TRANSITION REQUIREMENTS
amplitude information (see Figure 2). A 50% duty-cycle To ensure proper internal logic performance, it is good prac-
PWM signal represents zero drive, since the net value of tice to avoid aligning the falling and rising edges of input sig-
voltage (integrated over one period) delivered to the load is nals. A delay of at least 1 µsec should be incorporated be-
zero. For the LMD18200, the PWM signal drives the direc- tween transitions of the Direction, Brake, and/or PWM input
tion input (pin 3) and the PWM input (pin 5) is tied to logic signals. A conservative approach is be sure there is at least
high. 500ns delay between the end of the first transition and the
beginning of the second transition. See Figure 4.

www.national.com 6
19-4770; Rev 1; 1/99

±15kV ESD-Protected, Single/Dual/Octal,


CMOS Switch Debouncers
General Description Features

MAX6816/MAX6817/MAX6818
The MAX6816/MAX6817/MAX6818 are single, dual, and ♦ Robust Inputs can Exceed Power Supplies
octal switch debouncers that provide clean interfacing up to ±25V
of mechanical switches to digital systems. They accept
one or more bouncing inputs from a mechanical switch ♦ ESD Protection for Input Pins
and produce a clean digital output after a short, preset ±15kV—Human Body Model
qualification delay. Both the switch opening bounce ±8kV—IEC 1000-4-2, Contact Discharge
and the switch closing bounce are removed. Robust ±15kV—IEC 1000-4-2, Air-Gap Discharge
switch inputs handle ±25V levels and are ±15kV ESD-
♦ Small SOT Packages (4 and 6 pins)
protected for use in harsh industrial environments. They
feature single-supply operation from +2.7V to +5.5V. ♦ Single-Supply Operation from +2.7V to +5.5V
Undervoltage lockout circuitry ensures the output is in
the correct state upon power-up. ♦ Single (MAX6816), Dual (MAX6817), and Octal
(MAX6818) Versions Available
The single MAX6816 and dual MAX6817 are offered in
SOT packages and require no external components. ♦ No External Components Required
Their low supply current makes them ideal for use in ♦ 6µA Supply Current
portable equipment.
The MAX6818 octal switch debouncer is designed for ♦ Three-State Outputs for Directly Interfacing
data-bus interfacing. The MAX6818 monitors switches Switches to µP Data Bus (MAX6818)
and provides a switch change-of-state output (CH), ♦ Switch Change-of-State Output Simplifies
simplifying microprocessor (µP) polling and interrupts. Polling and Interrupts (MAX6818)
Additionally, the MAX6818 has three-state outputs con-
trolled by an enable (EN) pin, and is pin-compatible ♦ Pin-Compatible with ’LS573 (MAX6818)
with the ‘LS573 octal latch (except for the CH pin),
allowing easy interfacing to a digital data bus. Ordering Information
PIN- SOT
Applications PART TEMP. RANGE
PACKAGE TOP MARK
µP Switch Interfacing MAX6816EUS-T -40°C to +85°C 4 SOT143 KABA
Industrial Instruments MAX6817EUT-T -40°C to +85°C 6 SOT23-6 AAAU
PC-Based Instruments MAX6818EAP -40°C to +85°C 20 SSOP —
Note: There is a minimum order increment of 2500 pieces for
Portable Instruments SOT packages.
Automotive Applications
Membrane Keypads
Pin Configurations
Typical Operating Circuit TOP VIEW

VCC VCC
4
GND 1

MAX6816
MAX6816 µP
MECHANICAL
SWITCH 0.1µF

IN OUT RESET IN 2 3 OUT


DEBOUNCED
GND OUTPUT
SOT143

Pin Configurations continued at end of data sheet.

________________________________________________________________ Maxim Integrated Products 1

For free samples & the latest literature: http://www.maxim-ic.com, or phone 1-800-998-8800.
For small orders, phone 1-800-835-8769.
±15kV ESD-Protected, Single/Dual/Octal,
CMOS Switch Debouncers
Pin Description
MAX6816/MAX6817/MAX6818

PIN
NAME FUNCTION
MAX6816 MAX6817 MAX6818
1 2 10 GND Ground
2 — — IN Switch Input
— 1, 3 — IN1, IN2 Switch Inputs
— — 2–9 IN1–IN8 Switch Inputs
3 — — OUT CMOS Debounced Output
— 4, 6 — OUT2, OUT1 CMOS Debounced Outputs
— — 12–19 OUT8–OUT1 CMOS Debounced Outputs
4 5 20 VCC +2.7V to +5.5V Supply Voltage
Active-Low, Three-State Enable Input for outputs. Resets CH.
— — 1 EN
Tie to GND to “always enable” outputs.
Change-of-State Output. Goes low on switch input change of
— — 11 CH
state. Resets on EN. Leave unconnected if not used.

D Q OUT
VCC
VCC
D Q LOAD
VCC COUNTER
OSC. R

RPU
UNDER-
IN VOLTAGE
LOCKOUT
MAX6816
ESD MAX6817
PROTECTION MAX6818

Figure 1. Block Diagram

_______________Detailed Description input does not equal the output, the XNOR gate issues
a counter reset. When the switch input state is stable
Theory of Operation for the full qualification period, the counter clocks the
The MAX6816/MAX6817/MAX6818 are designed to flip-flop, updating the output. Figure 2 shows the typical
eliminate the extraneous level changes that result from opening and closing switch debounce operation. On
interfacing with mechanical switches (switch bounce). the MAX6818, the change output (CH) is updated
Virtually all mechanical switches bounce upon opening simultaneously with the switch outputs.
or closing. These switch debouncers remove bounce
when a switch opens or closes by requiring that Undervoltage Lockout
sequentially clocked inputs remain in the same state for The undervoltage lockout circuitry ensures that the out-
a number of sampling periods. The output does not puts are at the correct state on power-up. While the sup-
change until the input is stable for a duration of 40ms. ply voltage is below the undervoltage threshold
(typically 1.9V), the debounce circuitry remains trans-
The circuit block diagram (Figure 1) shows the func-
parent. Switch states are present at the logic outputs
tional blocks consisting of an on-chip oscillator,
without delay.
counter, exclusive-NOR gate, and D flip-flop. When the

4 _______________________________________________________________________________________
±15kV ESD-Protected, Single/Dual/Octal,
CMOS Switch Debouncers

MAX6816/MAX6817/MAX6818
tDP
EN tEN
IN1 1/2 VCC 1/2 VCC

OUT1–OUT8 tPE tPD


OUT1 OUT NORMALLY
1/2 VCC VOL + 0.5V
LOW

tPE
1/2 VCC OUT NORMALLY VOH - 0.5V
IN2 OUT1–OUT8
HIGH
tPD
tPC
CH 1/2 VCC
OUT2

Figure 4. MAX6818 µP-Interface Timing Diagram


CH

+VCC

MAX6818 ONLY +VCC


0.1µF
Figure 2. Input Characteristics
SW1

IN1 EN I/O µP

CH IRQ
20V
IN MAX6818
0
(20V/div) OUT1 D0
-20V
IN8 OUT8 D7
SW8

4V
OUT
(2V/div)
0 Figure 5. MAX6818 Typical µP Interfacing Circuit

20ms/div approximately 0.5mA (up to 4mA for eight inputs) from


Figure 3. Switch Input ±25V Fault Tolerance the VCC supply. Driving an input to +25V will cause
approximately 0.32mA of current (up to 2.6mA for eight
Robust Switch Inputs inputs) to flow back into the VCC supply. If the total sys-
The switch inputs on the MAX6816/MAX6817/MAX6818 tem VCC supply current is less than the current flowing
have overvoltage clamping diodes to protect against back into the VCC supply, VCC will rise above normal
damaging fault conditions. Switch input voltages levels. In some low-current systems, a zener diode on
can safely swing ±25V to ground (Figure 3). Proprietary VCC may be required.
ESD-protection structures protect against high
±15kV ESD Protection
ESD encountered in harsh industrial environments,
As with all Maxim devices, ESD-protection structures
membrane keypads, and portable applications.
are incorporated on all pins to protect against electro-
They are designed to withstand ±15kV per the
static discharges encountered during handling and
IEC1000-4-2 Air Gap Discharge Test and ±8kV per the
assembly. The MAX6816/MAX6817/MAX6818 have
IEC1000-4-2 Contact Discharge Test.
extra protection against static electricity. Maxim's engi-
Since there are 63kΩ (typical) pull-up resistors con- neers have developed state-of-the-art structures to pro-
nected to each input, driving an input to -25V will draw tect against ESD of ±15kV at the switch inputs without

_______________________________________________________________________________________ 5
±15kV ESD-Protected, Single/Dual/Octal,
CMOS Switch Debouncers
meets Level 4 (the highest level) of IEC1000-4-2, with- Machine Model

MAX6816/MAX6817/MAX6818
out the need for additional ESD-protection compo- The Machine Model for ESD tests all pins using a
nents. 200pF storage capacitor and zero discharge resis-
The major difference between tests done using the tance. Its objective is to emulate the stress caused by
Human Body Model and IEC1000-4-2 is higher peak contact that occurs with handling and assembly during
current in IEC1000-4-2, because series resistance is manufacturing.
lower in the IEC1000-4-2 model. Hence, the ESD with- MAX6818 µP Interfacing
stand voltage measured to IEC1000-4-2 is generally The MAX6818 has an output enable (EN) input that
lower than that measured using the Human Body allows switch outputs to be three-stated on the µP data
Model. Figure 7a shows the IEC1000-4-2 model and bus until polled by the µP. Also, state changes at the
Figure 7b shows the current waveform for the 8kV, switch inputs are detected, and an output (CH) goes low
IEC1000-4-2, Level 4, ESD Contact-Discharge test. after the debounce period to signal the µP. Figure 4
The Air-Gap test involves approaching the device with shows the timing diagram for enabling outputs and read-
a charged probe. The Contact-Discharge method ing data. If the output enable is not used, tie EN to GND
connects the probe to the device before the probe is to “always enable’’ the switch outputs. If EN is low, CH is
energized. always high. If a change of state is not required, leave
CH unconnected.

Pin Configurations (continued)

TOP VIEW

EN 1 20 VCC
IN1 2 19 OUT1

IN2 3 18 OUT2
IN1 1 6 OUT1
IN3 4 17 OUT3

MAX6817 IN4 5 MAX6818 16 OUT4


GND 2 5 VCC
IN5 6 15 OUT5

IN6 7 14 OUT6
IN2 3 4 OUT2
IN7 8 13 OUT7

IN8 9 12 OUT8
SOT23-6
GND 10 11 CH

SSOP

___________________Chip Information
MAX6816 TRANSISTOR COUNT: 284
MAX6817 TRANSISTOR COUNT: 497
MAX6818 TRANSISTOR COUNT: 2130

SUBSTRATE CONNECTED TO GND

_______________________________________________________________________________________ 7
SN54LS373, SN54LS374, SN54S373, SN54S374,
SN74LS373, SN74LS374, SN74S373, SN74S374
OCTAL D-TYPE TRANSPARENT LATCHES AND EDGE-TRIGGERED FLIP-FLOPS
SDLS165B – OCTOBER 1975 – REVISED AUGUST 2002

D Choice of Eight Latches or Eight D-Type SN54LS373,


Flip-Flops in a Single Package
SN74LS373 . . . DW, N, OR NS PACKAGE
D 3-State Bus-Driving Outputs
D Full Parallel Access for Loading SN74S373 . . . DW OR N PACKAGE
(TOP VIEW)
D Buffered Control Inputs
D Clock-Enable Input Has Hysteresis to OC 1 20 VCC
Improve Noise Rejection (’S373 and ’S374) 1Q 2 19 8Q
D P-N-P Inputs Reduce DC Loading on Data 1D 3 18 8D
Lines (’S373 and ’S374) 2D 4 17 7D
2Q 5 16 7Q
description 3Q 6 15 6Q
3D 7 14 6D
These 8-bit registers feature 3-state outputs 4D 8 13 5D
designed specifically for driving highly capacitive 4Q 9 12 5Q
or relatively low-impedance loads. The GND 10 11 C
high-impedance 3-state and increased
high-logic-level drive provide these registers with C for ’LS373 and ’S373;
the capability of being connected directly to and
driving the bus lines in a bus-organized system SN54LS373, SN54S373,
. . . FK PACKAGE
without need for interface or pullup components. (TOP VIEW)
These devices are particularly attractive for

VCC
OC
implementing buffer registers, I/O ports,

1Q

8Q
1D
bidirectional bus drivers, and working registers.
3 2 1 20 19
The eight latches of the ’LS373 and ’S373 are 2D 4 18 8D
transparent D-type latches, meaning that while 2Q 5 17 7D
the enable (C or CLK) input is high, the Q outputs 3Q 6 16 7Q
follow the data (D) inputs. When C or CLK is taken 3D 7 15 6Q
low, the output is latched at the level of the data 4D 8 14 6D
that was set up. 9 10 11 12 13

The eight flip-flops of the ’LS374 and ’S374 are


4Q

5Q
5D
GND
edge-triggered D-type flip-flops. On the positive C
transition of the clock, the Q outputs are set to the C for ’LS373 and ’S373;
logic states that were set up at the D inputs.
Schmitt-trigger buffered inputs at the enable/clock lines of the ’S373 and ’S374 devices simplify system design
as ac and dc noise rejection is improved by typically 400 mV due to the input hysteresis. A buffered
output-control (OC) input can be used to place the eight outputs in either a normal logic state (high or low logic
levels) or the high-impedance state. In the high-impedance state, the outputs neither load nor drive the bus lines
significantly.
OC does not affect the internal operation of the latches or flip-flops. That is, the old data can be retained or new
data can be entered, even while the outputs are off.

Please be aware that an important notice concerning availability, standard warranty, and use in critical applications of
Texas Instruments semiconductor products and disclaimers thereto appears at the end of this data sheet.

PRODUCTION DATA information is current as of publication date. Copyright  2002, Texas Instruments Incorporated
Products conform to specifications per the terms of Texas Instruments On products compliant to MIL-PRF-38535, all parameters are tested
standard warranty. Production processing does not necessarily include unless otherwise noted. On all other products, production
testing of all parameters. processing does not necessarily include testing of all parameters.

POST OFFICE BOX 655303 • DALLAS, TEXAS 75265 1


SN54LS373, SN54LS374, SN54S373, SN54S374,
SN74LS373, SN74LS374, SN74S373, SN74S374
OCTAL D-TYPE TRANSPARENT LATCHES AND EDGE-TRIGGERED FLIP-FLOPS
SDLS165B – OCTOBER 1975 – REVISED AUGUST 2002

Function Tables

’LS373, ’S373
(each latch)
INPUTS OUTPUT
OC C D Q
L H H H
L H L L
L L X Q0
H X X Z

POST OFFICE BOX 655303 • DALLAS, TEXAS 75265 3


SN54LS373, SN54LS374, SN54S373, SN54S374,
SN74LS373, SN74LS374, SN74S373, SN74S374
OCTAL D-TYPE TRANSPARENT LATCHES AND EDGE-TRIGGERED FLIP-FLOPS
SDLS165B – OCTOBER 1975 – REVISED AUGUST 2002

logic diagrams (positive logic)


’LS373, ’S373 ’LS374, ’S374
Transparent Latches Positive-Edge-Triggered Flip-Flops

1 1
OC OC

11 11
C CLK

C1 2 C1 2
3 1Q 3 1Q
1D 1D 1D 1D

C1 5 C1 5
4 2Q 4 2Q
2D 1D 2D 1D

C1 6 C1 6
7 3Q 7 3Q
3D 1D 3D 1D

C1 9 C1 9
8 4Q 8 4Q
4D 1D 4D 1D

C1 12 C1 12
13 5Q 13 5Q
5D 1D 5D 1D

C1 15 C1 15
14 6Q 14 6Q
6D 1D 6D 1D

C1 16 C1 16
17 7Q 17 7Q
7D 1D 7D 1D

C1 19 C1 19
18 8Q 18 8Q
8D 1D 8D 1D

for ’S373 Only for ’S374 Only

Pin numbers shown are for DB, DW, J, N, NS, and W packages.

4 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265


µA7800 SERIES
POSITIVE-VOLTAGE REGULATORS
SLVS056G – MAY 1976 – REVISED OCTOBER 2001

D 3-Terminal Regulators KC PACKAGE

D Output Current up to 1.5 A


(TOP VIEW)

D Internal Thermal-Overload Protection OUTPUT


D High Power-Dissipation Capability
COMMON
INPUT
D Internal Short-Circuit Current Limiting
The COMMON terminal is in electrical
D Output Transistor Safe-Area Compensation contact with the mounting base.
D Direct Replacements for Fairchild µA7800 TO-220AB
Series
O
C
I
description
This series of fixed-voltage monolithic
integrated-circuit voltage regulators is designed
for a wide range of applications. These
applications include on-card regulation for
elimination of noise and distribution problems
associated with single-point regulation. Each of KTE PACKAGE
these regulators can deliver up to 1.5 A of output (TOP VIEW)
current. The internal current-limiting and
thermal-shutdown features of these regulators OUTPUT
essentially make them immune to overload. In
COMMON
addition to use as fixed-voltage regulators, these
devices can be used with external components to INPUT
obtain adjustable output voltages and currents,
and also can be used as the power-pass element The COMMON terminal is in
in precision regulators. electrical contact with the mounting
base.
The µA7800C series is characterized for
O
operation over the virtual junction temperature C
range of 0°C to 125°C. I

AVAILABLE OPTIONS
PACKAGED DEVICES
VO(NOM) PLASTIC HEAT-SINK
TJ
(V) FLANGE MOUNT MOUNTED
(KC) (KTE)
5 µA7805CKC µA7805CKTE
8 µA7808CKC µA7808CKTE
10 µA7810CKC µA7810CKTE
0°C to 125°C
12 µA7812CKC µA7812CKTE
15 µA7815CKC µA7815CKTE
24 µA7824CKC µA7824CKTE
The KTE package is only available taped and reeled. Add the suffix R to the
device type (e.g., µA7805CKTER).

Please be aware that an important notice concerning availability, standard warranty, and use in critical applications of
Texas Instruments semiconductor products and disclaimers thereto appears at the end of this data sheet.

PRODUCTION DATA information is current as of publication date. Copyright  2001, Texas Instruments Incorporated
Products conform to specifications per the terms of Texas Instruments
standard warranty. Production processing does not necessarily include
testing of all parameters.

POST OFFICE BOX 655303 • DALLAS, TEXAS 75265 1


µA7800 SERIES
POSITIVE-VOLTAGE REGULATORS
SLVS056G – MAY 1976 – REVISED OCTOBER 2001

APPLICATION INFORMATION

+V µA78xx +VO

0.33 µF 0.1 µF

Figure 1. Fixed-Output Regulator

IN OUT
+ µA78xx G

VI IL
COM
– –VO

Figure 2. Positive Regulator in Negative Configuration (VI Must Float)

Input µA78xx Output

R1
IO

0.33 µF 0.1 µF
R2

VO +V )
xx ǒ )Ǔ
NOTE A: The following formula is used when Vxx is the nominal output voltage (output to common) of the fixed regulator:
V xx
R1
I Q R2

Figure 3. Adjustable-Output Regulator

Input µA78xx

R1
0.33 µF VO(Reg)

Output

IO
IO = (VO/R1) + IO Bias Current

Figure 4. Current Regulator

6 POST OFFICE BOX 655303 • DALLAS, TEXAS 75265


®
HIN232, HIN236, HIN237,HIN238,
HIN239, HIN240, HIN241
Data Sheet June 2003 FN3138.13

+5V Powered RS-232 Features


Transmitters/Receivers • Meets All RS-232E and V.28 Specifications
The HIN232-HIN241 family of RS-232 transmitters/receivers • Requires Only Single +5V Power Supply
interface circuits meet all ElA RS-232E and V.28 specifications, - (+5V and +12V - HIN239)
and are particularly suited for those applications where ±12V is
not available. They require a single +5V power supply (except • High Data Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . 120kbps
HIN239) and feature onboard charge pump voltage converters • Onboard Voltage Doubler/Inverter
which generate +10V and -10V supplies from the 5V supply.
• Low Power Consumption
The family of devices offer a wide variety of RS-232
transmitter/receiver combinations to accommodate various • Low Power Shutdown Function
applications (see Selection Table). • Three-State TTL/CMOS Receiver Outputs
The drivers feature true TTL/CMOS input compatibility, slew- • Multiple Drivers
rate-limited output, and 300Ω power-off source impedance. - ±10V Output Swing for 5V lnput
The receivers can handle up to ±30V, and have a 3kΩ to
- 300Ω Power-Off Source Impedance
7kΩ input impedance. The receivers also feature hysteresis
- Output Current Limiting
to greatly improve noise rejection.
- TTL/CMOS Compatible
- 30V/µs Maximum Slew Rate
• Multiple Receivers
- ±30V Input Voltage Range
- 3kΩ to 7kΩ Input Impedance
- 0.5V Hysteresis to Improve Noise Rejection

Applications
• Any System Requiring RS-232 Communication Ports
- Computer - Portable, Mainframe, Laptop
- Peripheral - Printers and Terminals
- Instrumentation
- Modems

Selection Table
NUMBER OF NUMBER OF LOW POWER
PART POWER SUPPLY RS-232 RS-232 EXTERNAL SHUTDOWN/TTL NUMBER OF
NUMBER VOLTAGE DRIVERS RECEIVERS COMPONENTS THREE-STATE LEADS
HIN232 +5V 2 2 4 Capacitors No/No 16

HIN236 +5V 4 3 4 Capacitors Yes/Yes 24

HIN237 +5V 5 3 4 Capacitors No/No 24

HIN238 +5V 4 4 4 Capacitors No/No 24

HIN239 +5V and +7.5V to 13.2V 3 5 2 Capacitors No/Yes 24

HIN240 +5V 5 5 4 Capacitors Yes/Yes 44


HIN241 +5V 4 5 4 Capacitors Yes/Yes 28

1 CAUTION: These devices are sensitive to electrostatic discharge; follow proper IC Handling Procedures.
1-888-INTERSIL or 321-724-7143 | Intersil (and design) is a registered trademark of Intersil Americas Inc.
Copyright © Intersil Americas Inc. 2003. All Rights Reserved.
All other trademarks mentioned are the property of their respective owners.
HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241

Pin Descriptions
PIN FUNCTION

VCC Power Supply Input 5V ±10%.

V+ Internally generated positive supply (+10V nominal), HIN239 requires +7.5V to +13.2V.

V- Internally generated negative supply (-10V nominal).

GND Ground lead. Connect to 0V.

C1+ External capacitor (+ terminal) is connected to this lead.

C1- External capacitor (- terminal) is connected to this lead.

C2+ External capacitor (+ terminal) is connected to this lead.

C2- External capacitor (- terminal) is connected to this lead.

TIN Transmitter Inputs. These leads accept TTL/CMOS levels. An internal 400kΩ pull-up resistor to VCC is connected to each lead.

TOUT Transmitter Outputs. These are RS-232 levels (nominally ±10V).

RIN Receiver Inputs. These inputs accept RS-232 input levels. An internal 5kΩ pull-down resistor to GND is connected to each input.

ROUT Receiver Outputs. These are TTL/CMOS levels.

EN Enable input. This is an active low input which enables the receiver outputs. With EN = 5V, the receiver outputs are placed
in a high impedance state.

SD Shutdown Input. With SD = 5V, the charge pump is disabled, the receiver outputs are in a high impedance state and the
transmitters are shut off.

NC No Connect. No connections are made to these leads.

Ordering Information
PART TEMP.
NUMBER RANGE (oC) PACKAGE PKG. DWG. #
HIN232CB 0 to 70 16 Ld SOIC M16.3
HIN232CB-T 0 to 70 Tape and Reel
HIN232CP 0 to 70 16 Ld PDIP E16.3
HIN232IB -40 to 85 16 Ld SOIC M16.3
HIN232IP -40 to 85 16 Ld PDIP E16.3
HIN236CB 0 to 70 24 Ld SOIC M24.3
HIN236IB -40 to 85 24 Ld SOIC M24.3
HIN237CB 0 to 70 24 Ld SOIC M24.3
HIN237CB-T 0 to 70 Tape and Reel
HIN238CB 0 to 70 24 Ld SOIC M24.3
HIN238CB-T 0 to 70 Tape and Reel
HIN238CP 0 to 70 24 Ld PDIP E24.3
HIN238IB -40 to 85 24 Ld SOIC M24.3
HIN239CB 0 to 70 24 Ld SOIC M24.3
HIN239CB-T 0 to 70 Tape and Reel
HIN239CP 0 to 70 24 Ld PDIP E24.3
HIN240CN 0 to 70 44 Ld MQFP Q44.10X10
HIN241CA 0 to 70 28 Ld SSOP M28.209
HIN241CB 0 to 70 28 Ld SOIC M28.3
HIN241IB -40 to 85 28 Ld SOIC M28.3

2
HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241

Pinouts
HIN232 (PDIP, SOIC) HIN236 (SOIC)
TOP VIEW TOP VIEW

C1+ 1 16 VCC T3OUT 1 24 T4OUT

V+ 2 15 GND T1OUT 2 23 R2IN

14 T1OUT T2OUT 3 22 R2OUT


C1- 3
R1IN 4 21 SD
C2+ 4 13 R1IN
R1OUT 5 20 EN
C2- 5 12 R1OUT
T2IN 6 19 T4IN
V- 6 11 T1IN
T1IN 7 18 T3IN
T2OUT 7 10 T2IN
GND 8 17 R3OUT
R2IN 8 9 R2OUT
VCC 9 16 R3IN

C1+ 10 15 V-
V+ 11 14 C2-
C1- 12 13 C2+

+5V +5V

+ 9
1µF 10 1µF
16 C1+ VCC +
+ 11
1µF +5V TO 10V V+
12
C1- VOLTAGE DOUBLER
VCC 13
1 NOTE 1 C2+
C1+ + + +10V TO -10V
NOTE 1
+ +5V TO 10V 2 1µF
14 V- 15
V+ VOLTAGE INVERTER
3 VOLTAGE DOUBLER C2- 1µF
C1- +
4 +5V T1
C2+ 7 400kΩ 2
+ +10V TO -10V T1IN T1OUT
NOTE 1
5 V- 6
VOLTAGE INVERTER
C2- NOTE 1 +5V T2
+ 6 400kΩ 3
T2IN T2OUT
+5V T1
11 400kΩ 14 +5V
T1IN T1OUT T3
18 400kΩ 1
T3IN T3OUT
+5V T2 +5V
10 400kΩ 7 T4
T2IN T2OUT 19 400kΩ 24
T4IN T4OUT
5 4
12 13 R1OUT R1IN
R1OUT R1IN
R1 5kΩ
R1 5kΩ

22 23
R2OUT R2IN
9 8
R2OUT R2IN R2 5kΩ
R2 5kΩ
17 16
R3OUT R3IN
15 R3 5kΩ 21
20
EN SD

NOTE: 8
1. Either 0.1µF or 1µF capacitors may be used. The V+ capacitor
may be terminated to VCC or to GND.

3
HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241

Electrical Specifications Test Conditions: VCC = +5V ±10%, TA = Operating Temperature Range (Continued)

PARAMETER TEST CONDITIONS MIN TYP MAX UNITS

TIMING CHARACTERISTICS

Baud Rate (1 Transmitter Switching) RL = 3kΩ 120 - - kbps

Output Enable Time, tEN HIN236, HIN239, HIN240, HIN241 - 400 - ns

Output Disable Time, tDIS HIN236, HIN239, HIN240, HIN241 - 250 - ns

Propagation Delay, tPD RS-232 to TTL - 0.5 - µs

Instantaneous Slew Rate SR CL = 10pF, RL = 3kΩ, TA = 25oC (Note 4) - - 30 V/µs

Transition Region Slew Rate, SRT RL = 3kΩ, CL = 2500pF Measured from +3V to -3V or - 3 - V/µs
-3V to +3V, 1 Transmitter Switching

TRANSMITTER OUTPUTS

Output Voltage Swing, TOUT Transmitter Outputs, 3kΩ to Ground ±5 ±9 ±10 V

Output Resistance, TOUT VCC = V+ = V- = 0V, VOUT = ±2V 300 - - Ω

RS-232 Output Short Circuit Current, ISC TOUT shorted to GND - ±10 - mA
NOTE:
4. Guaranteed by design.

VOLTAGE DOUBLER VOLTAGE INVERTER

S1 C1+ S2 V+ = 2VCC S5 C2+ S6


VCC GND

+ + + +
C1 C3 C2 C4
- - - -
GND VCC GND V- = -(V+)
S3 C1- S4 S7 C2- S8

RC
OSCILLATOR

FIGURE 1. CHARGE PUMP

Detailed Description to 5.5V. The output impedance of the voltage doubler section
(V+) is approximately 200Ω, and the output impedance of the
The HIN232 thru HIN241 family of RS-232
voltage inverter section (V-) is approximately 450Ω. A typical
transmitters/receivers are powered by a single +5V power
application uses 1µF capacitors for C1-C4, however, the
supply (except HIN239), feature low power consumption, and
value is not critical. Increasing the values of C1 and C2 will
meet all ElA RS-232C and V.28 specifications. The circuit is
lower the output impedance of the voltage doubler and
divided into three sections: The charge pump, transmitter, and
inverter, increasing the values of the reservoir capacitors, C3
receiver.
and C4, lowers the ripple on the V+ and V- supplies.
Charge Pump
During shutdown mode (HIN236, HIN240 and HIN241),
An equivalent circuit of the charge pump is illustrated in SHUTDOWN control line set to logic “1”, the charge pump is
Figure 1. The charge pump contains two sections: the voltage turned off, V+ is pulled down to VCC , V- is pulled up to GND,
doubler and the voltage inverter. Each section is driven by a and the supply current is reduced to less than 10µA. The
two phase, internally generated clock to generate +10V and transmitter outputs are disabled and the receiver outputs are
-10V. The nominal clock frequency is 16kHz. During phase placed in the high impedance state.
one of the clock, capacitor C1 is charged to VCC . During
phase two, the voltage on C1 is added to VCC , producing a
signal across C3 equal to twice VCC . During phase one, C2 is
also charged to 2VCC , and then during phase two, it is
inverted with respect to ground to produce a signal across C4
equal to -2VCC . The charge pump accepts input voltages up

8
HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241

Transmitters Receivers
The transmitters are TTL/CMOS compatible inverters which The receiver inputs accept up to ±30V while presenting the
translate the inputs to RS-232 outputs. The input logic threshold required 3kΩ to 7kΩ input impedance even if the power is off
is about 26% of VCC , or 1.3V for VCC = 5V. A logic 1 at the (VCC = 0V). The receivers have a typical input threshold of
input results in a voltage of between -5V and V- at the output, 1.3V which is within the ±3V limits, known as the transition
and a logic 0 results in a voltage between +5V and (V+ -0.6V). region, of the RS-232 specifications. The receiver output is
Each transmitter input has an internal 400kΩ pullup resistor so 0V to VCC . The output will be low whenever the input is
any unused input can be left unconnected and its output greater than 2.4V and high whenever the input is floating or
remains in its low state. The output voltage swing meets the driven between +0.8V and -30V. The receivers feature 0.5V
RS-232C specifications of ±5V minimum with the worst case hysteresis to improve noise rejection. The receiver Enable
conditions of: all transmitters driving 3kΩ minimum load line EN, when set to logic “1”, (HIN236, 239, 240, and 241)
impedance, VCC = 4.5V, and maximum allowable operating disables the receiver outputs, placing them in the high
temperature. The transmitters have an internally limited output impedance mode. The receiver outputs are also placed in
slew rate which is less than 30V/µs. The outputs are short the high impedance state when in shutdown mode.
circuit protected and can be shorted to ground indefinitely. The
powered down output impedance is a minimum of 300Ω with VCC

±2V applied to the outputs and VCC = 0V. RXIN ROUT


-30V < RXIN < +30V 5kΩ GND < VROUT < VCC
V+
GND
VCC
400kΩ 300Ω
TXIN TOUT FIGURE 3. RECEIVER
GND < TXIN < VCC V- < VTOUT < V+

V-

FIGURE 2. TRANSMITTER

TIN
OR
RIN

TOUT VOL
OR
ROUT VOL
tPHL tPLH

tPHL + tPLH
Average Propagation Delay =
2

FIGURE 4. PROPAGATION DELAY DEFINITION

9
HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241

Applications +5V
-
The HIN2XX may be used for all RS-232 data terminal and +
communication links. It is particularly useful in applications 1 16 DTR (20) DATA
where ±12V power supplies are not available for C1 + 2 TERMINAL READY
1µF - 3 DSRS (24) DATA
conventional RS-232 interface circuits. The applications HIN232 SIGNALING RATE
presented represent typical interface configurations. 4 6 SELECT
C2 + -
1µF - 5 + RS-232
A simple duplex RS-232 port with CTS/RTS handshaking is INPUTS AND OUTPUTS
T1
illustrated in Figure 9. Fixed output signals such as DTR TD
11 14
TD (2) TRANSMIT DATA
(data terminal ready) and DSRS (data signaling rate select) T2
10 7
TTL/CMOS RTS RTS (4) REQUEST TO SEND
is generated by driving them through a 5kΩ resistor
INPUTS AND 12 13
connected to V+. OUTPUTS RD RD (3) RECEIVE DATA
R2 R1
9 8
In applications requiring four RS-232 inputs and outputs CTS CTS (5) CLEAR TO SEND

(Figure 10), note that each circuit requires two charge pump
15 SIGNAL GROUND (7)
capacitors (C1 and C2) but can share common reservoir
capacitors (C3 and C4). The benefit of sharing common
reservoir capacitors is the elimination of two capacitors and FIGURE 9. SIMPLE DUPLEX RS-232 PORT WITH CTS/RTS
HANDSHAKING
the reduction of the charge pump source impedance which
effectively increases the output swing of the transmitters.

1 4
C1 + + C2
HIN232
1µF - 3 5 - 1µF
11 T1 14
TD TD (2) TRANSMIT DATA
T2
10 7
TTL/CMOS RTS RTS (4) REQUEST TO SEND
INPUTS AND 12 13
OUTPUTS RD RD (3) RECEIVE DATA
R2 R1
9 8
CTS CTS (5) CLEAR TO SEND
15

16
6 2
C4 C3 +5V
- -
+

V- V+
2µF 2µF RS-232
6 2 INPUTS AND OUTPUTS
16

HIN232
1 4
C1 + + C2
1µF - 3 5 - 1µF
11 T1 14
DTR DTR (20) DATA TERMINAL READY
T2
10 7
TTL/CMOS DSRS DSRS (24) DATA SIGNALING RATE SELECT
INPUTS AND 12 13
OUTPUTS DCD DCD (8) DATA CARRIER DETECT
R2 R1
9 8
R1 R1 (22) RING INDICATOR

15 SIGNAL GROUND (7)

FIGURE 10. COMBINING TWO HIN232s FOR 4 PAIRS OF RS-232 INPUTS AND OUTPUTS

11
Wireless Video Camera 208CV
LYD208CV (Wireless)

• Camera apparatus: 1/3, 1/4 picture sensor


• System: PAL/CCIR/NTSC/EIR ( Not multi system )
• Validity pixel: PAL: 628X582 or NTSC: 510X492
• Picture area: PAL:5.78X4.19mm or NTSC:4.69X3.45mm
• Horizontal definition: 380line
• Scan frequency: PAL/CCIR:50Hz or NTSC/EIA: 60Hz
• Miniumum illumination: 3LUX
• Sensitivity : +18DB=AGL NO-OFF
• Output power : 50MW / 300MB
• Output frequency : 0.9G / 1.2G
• Frequency control : adopt CPU frequency lock the wreath to control, with high
frequency stability.
• Transmission signal : Video Only
• Deliver the distance : 50-100M / 300-500M
• Voltage : DC+8V
• Current : 200mA
• Power consumption < or = 640MW
• Size : 25X35X15(mm)
Include Power Adapter 9V and 8V Input 110V or 220V
RC100

Manual-modulated receiver
• High receive sensitivity : +18DB
• Receive frequency : 0.9G/1.2G
• Receive signal : Video Only
• Voltage : DC 9V
• Current : 500mA
• Size : 115X60X20(mm)

Anda mungkin juga menyukai