Xabre (7th Semester) Project Report

  • Uploaded by: Abhijit Karnik
  • 0
  • 0
  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Xabre (7th Semester) Project Report as PDF for free.

More details

  • Words: 23,055
  • Pages: 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) I TER AL GUIDE

DATE:

(Dr. M.D. Desai) HEAD OF THE ELECTRICAL E GI EERI G DEPARTME T

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

Technology Nirma Institute of Te chnology XABRE

Project Report 7th Sem I.C.

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

Class D4

Functions

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

111

0

E31

E32

E33

E41

Extension Ops 1

111

1

E21

E22

E11

E51

Extension Ops 2

Light and Pan/Tilt Command

Detailed explanation: I. Two bit commands Bit

SRM

Pattern XY

Pan

Tilt

Gripper 1

Gripper 2

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

P2.x

D7

D6

D5

D4

x

X

x

x

P0.x#

Functions/Port names D3 RD

D2 RPW

D1 LD

M

000b

SRT

SRLI SRC

010b

SRD

SRM

011b

G1M

100b 101b

D0 LPW

Locomotion Port

M

SRA

0

0

1

1

I/P PORT, int. driven

0

0

1

1

1

L

SR & Light Port

G1D

G2M

G2D

TM

TD

PM

PD

TUL

TDL

PRL

PLL

GUL

GDL

GCL

GOL

H

I

J

K

N

O

Q

R

Gripper & Pan/Tilt Port I/P PORT, int. driven 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

PD

Tilt Down / Pan Right

PM

doesn’t run.

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

G_Stat_Byte

G1D

G1M

G2D

G2M

GUL

GDL

GCL

GOL

PT_Stat_Byte

TUL

TDL

PRL

PLL

TD

TM

PD

PM

H

I

J

K

N

O

Q

R

Extn_Byte

Nirma Institute of Technology Technology XABRE

SR Cw Aut_O

L

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

Object = "{648A5603-2C6E-101B-82B6-

TabIndex

000000000014}#1.1#0"; "MSCOMM32.OCX"

Top

Begin VB.Form Zeus

Width

BorderStyle Caption

= 1 'Fixed Single = "Zeus"

ClientHeight

= 2490

= 480 = 24 = 600 = 540

End Begin VB.PictureBox Ext_op_pics AutoRedraw

= -1 'True

ClientLeft

= 1575

AutoSize

ClientTop

= 2400

Height

= 375

Index

= 7

ClientWidth FillColor

= 9765 = &H00C0FFFF&

LinkTopic

= "Form1"

Left

= -1 'True

= 1440

Picture

= "Xabre 161003.frx":03ED

LockControls = -1 'True

ScaleHeight

MaxButton

= 0 'False

ScaleWidth

MinButton

= 0 'False

TabIndex

Moveable

= 0 'False

Top

ScaleHeight

= 2490

Width

ScaleWidth

= 9765

Begin MSCommLib.MSComm MSComm1

= 315 = 480 = 23

= 600 = 540

End Begin VB.PictureBox Ext_op_pics

Left

= 0

AutoRedraw

Top

= 960

AutoSize

_ExtentX

= 1005

Height

_ExtentY

= 1005

Index

_Version

= 393216

Left

DTREnable

= 0 'False

NullDiscard

= 375 = 6 = 720

Picture

= "Xabre 161003.frx":07DA

= -1 'True

ScaleHeight

RThreshold

= 1

ScaleWidth

InputMode

= 1

TabIndex

End

Top

Begin VB.Frame Ext_Ops_frame

Width

BorderStyle Height Left

= 0 'None = 1095

= 3480

TabIndex Top Width

= 17 = 1320 = 2535

Begin VB.PictureBox Ext_op_pics AutoRedraw AutoSize

= -1 'True = -1 'True

Nirma Institute of Technology Technology XABRE

= 1 = 0

Picture

= "Xabre 161003.frx":0BC8

ScaleHeight

TabIndex

= 315

= 375

Index Left

Top Width End

= -1 'True = -1 'True

Height

ScaleWidth

= "Xabre 161003.frx":0000

= 540

AutoSize

= 375

ScaleHeight

= 600

AutoRedraw

= 5

Picture

= 480 = 22

End

Index

= 0

= 315

Begin VB.PictureBox Ext_op_pics

Height

Left

= -1 'True = -1 'True

= 315 = 480 = 21

= 0 = 540

Project Report 7th Sem I.C.

Begin VB.PictureBox Ext_op_pics AutoRedraw AutoSize

= -1 'True = -1 'True

Height

= 375

Index

= 4

Left

= 1680

Picture

= "Xabre 161003.frx":0FB6

ScaleWidth

Begin VB.Frame Keyboard_Controlled_Frame BorderStyle Height

= 240

Left

= 20

Width

= 300

= 600

End

= 315

= 0

= 120

Width

ScaleWidth

Top

= 16

Top

ScaleHeight

TabIndex

= 540

TabIndex

= 0 'None = 2295

= 6480

TabIndex Top

= 8 = 120

Width

= 2295

Begin VB.PictureBox Kb_pics

End Begin VB.PictureBox Ext_op_pics AutoRedraw AutoSize

= -1 'True = -1 'True

AutoRedraw

= 375

Index

Index

= 3

Left

= 1080

Picture

= "Xabre 161003.frx":1050 = 315

ScaleWidth

= 480

TabIndex

= 19 = 0

Width

= 540

= "Xabre 161003.frx":2B0A

Top Width

= 750 = 750 = 13

= 720 = 810

End Begin VB.CommandButton Kb_Button

End Begin VB.PictureBox Ext_op_pics AutoRedraw AutoSize

= -1 'True = -1 'True

DownPicture

= 405

Index

= 1

= 375

Left

Index

= 2

MaskColor

Left

= 600

Picture

= "Xabre 161003.frx":143E

= "Xabre 161003.frx":57B2 = 1 'Graphical

= 315

TabIndex

= 240

Top

Top

= 0

Width

= 300

= &H8000000F&

Style

ScaleWidth

= 18

= 720

Picture

ScaleHeight

TabIndex

= "Xabre 161003.frx":48FC

Height

Height

= 12 = 120

UseMaskColor Width

= -1 'True

= 810

End Begin VB.CommandButton Kb_Button

End

DownPicture

End Begin VB.PictureBox Light_Pic AutoRedraw AutoSize

= -1 'True = -1 'True

Height Left

= 0 = 720

ScaleHeight

ScaleWidth

Top

= 810

Picture

ScaleHeight

TabIndex

= -1 'True

Height

Height

Left

= -1 'True

AutoSize

= 840 = 4440

Picture ScaleHeight

= "Xabre 161003.frx":14D8 = 780

Nirma Institute of Technology Technology XABRE

= "Xabre 161003.frx":66CC

Height

= 810

Index

= 4

Left MaskColor

= 1680 = &H8000000F&

Picture

= "Xabre 161003.frx":759A

Style

= 1 'Graphical

TabIndex

= 11

Project Report 7th Sem I.C.

Top

= 720

UseMaskColor Width

= -1 'True

= 405

DownPicture Height Index

End

Left

Begin VB.CommandButton Kb_Button

MaskColor

Index Left

= "Xabre 161003.frx":CF9E

Style

= 1 'Graphical

= 2

TabIndex

MaskColor

= &H8000000F&

Picture

= "Xabre 161003.frx":93CE

Style

= 1 'Graphical

TabIndex

= 10 = 1680

UseMaskColor Width

= -1 'True

= 810

Width End

DownPicture

= 405

Index

= 2

= &H8000000F&

Picture

= "Xabre 161003.frx":EDD2

Style

= 1 'Graphical

= 3

TabIndex

= "Xabre 161003.frx":A2E8

= 120

MaskColor

= &H8000000F&

Picture

= "Xabre 161003.frx":B1B6

Style

= 1 'Graphical = 9 = 720

UseMaskColor Width

= 720

= 810

DownPicture

Top

= "Xabre 161003.frx":DEB8

Height

Left

TabIndex

= -1 'True

= 405

Begin VB.CommandButton Joy_Button

MaskColor

Left

= 720

UseMaskColor

End

Index

= 7

Top

Begin VB.CommandButton Kb_Button

Height

= &H8000000F&

Picture

= "Xabre 161003.frx":84B4

= 720

Top

= 3 = 120

= 405

DownPicture Height

= "Xabre 161003.frx":C0D0

= 810

= -1 'True

= 405

= 6

Top

= 1680

UseMaskColor Width

= -1 'True

= 810

End Begin VB.CommandButton Joy_Button Appearance

= 0 'Flat

DownPicture Height

End

Index

Begin VB.Label Label4

Left

= "Xabre 161003.frx":FCEC

= 810 = 4 = 1680

Caption

= "Keyboard Buttons"

MaskColor

Height

= 375

Picture

= "Xabre 161003.frx":10BBA

Style

= 1 'Graphical

Left

= 0

TabIndex

= 15

Top

= 0

Width

= 735

TabIndex Top

= 5 = 720

UseMaskColor Width

End

= &H8000000F&

= -1 'True

= 405

End

End

Begin VB.Frame Joystick_Controlled_frame

Begin VB.CommandButton Joy_Button

BorderStyle Height Left TabIndex Top Width

= 0 'None = 2295

= 960 = 2 = 120 = 2295

Begin VB.CommandButton Joy_Button

Nirma Institute of Technology Technology XABRE

Default

= -1 'True

DownPicture

= "Xabre 161003.frx":11AD4

Height

= 405

Index

= 1

Left MaskColor Picture

= 720 = &H8000000F& = "Xabre 161003.frx":1298A

Project Report 7th Sem I.C.

Style

= 1 'Graphical

TabIndex

= 4

Top

= 120

UseMaskColor Width

= -1 'True

= 810

EndProperty ForeColor Height Left TabIndex

End

Top

Begin VB.PictureBox Joy_pics

Width

AutoRedraw AutoSize

= -1 'True = -1 'True

= &H00FFFFFF& = 255 = 4560 = 25 = 960 = 315

End Begin VB.Label Label2

Height

= 810

AutoSize

= -1 'True

Index

= 0

Caption

= "Right"

= 720

Height

Left Picture

= "Xabre 161003.frx":138A4

Left

ScaleHeight

= 750

TabIndex

ScaleWidth

= 750

Top

TabIndex

= 3

Top

= 720

Width

= 810

Width

= 195 = 0 = 1 = 2280 = 375

End Begin VB.Label Label1

End

AutoSize

= -1 'True

Begin VB.Label Label3

Caption

= "Left"

Caption

= "Joystick Buttons"

Height

Height

= 375

Left

Left

= 0

TabIndex

= 14

Top

= 120

Width

= 615

TabIndex Top Width

= 195 = 0 = 0 = 2040 = 270

End End

End End

Attribute VB_Name = "Zeus"

Begin VB.Timer Op_Mode_Timer

Attribute VB_GlobalNameSpace = False

Enabled

= 0 'False

Interval

= 100

Attribute VB_Creatable = False Attribute VB_PredeclaredId = True

Left

= 10

Attribute VB_Exposed = False

Top

= 1560

'>>> VARIABLE DECLARATIONS <<<' Private X() As Integer

End Begin VB.Label TX_label AutoSize

= -1 'True

Private Y() As Integer Private ari As Integer

BackColor

= &H000000FF&

Private joyb_states(4) As Boolean

BorderStyle

= 1 'Fixed Single

Private joyb_pressed(4) As Boolean

Caption

= "TX"

BeginProperty Font Name Size

= "MS Sans Serif" = 8.25

Private kbb_states(4) As Boolean Private light_status As Boolean Private alternate_drive As Boolean 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

Strikethrough = 0 'False

Nirma Institute of Technology Technology XABRE

Dim r_drive_matrix(30, 30) As Byte Dim r_drive As Byte

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 <<<' Call set_button_states

joyb_pressed(i) = False 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 <<<' If seed = 32 Then seed = 31

Next j Next i

If seed < 16 Then l_drive_matrix(i, j) = 16 - seed Else l_drive_matrix(i, j) = seed End If Next j

For i = 27 To 29 For j = 1 To 30 If j < i Then l_drive_matrix(i, j) = l_drive_matrix(30, 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 If seed < 16 Then

j) = 15

r_drive_matrix(i, j) = 16 - seed

Else l_drive_matrix(i, j) = seed

Else r_drive_matrix(i, j) = seed

End If Next j Next i

End If 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 l_drive_matrix(i, j) = l_drive_matrix(15, j) Next j Next i

m=m+1 seed = m For j = 0 To 30 '>>> Change if required <<<' If seed = 0 Then seed = 1

For j = 14 To 16 For i = 0 To 30 l_drive_matrix(i, j) = l_drive_matrix(i, 15)

'>>> Update seed <<<' seed = seed - 1 If seed < 16 Then r_drive_matrix(i, j) = 16 - seed

Next i

If r_drive_matrix(i, j) = 16 Then r_drive_matrix(i,

Next j j) = 15 '>>> Desensitized Forward Extremities <<<'

Else r_drive_matrix(i, j) = seed

For i = 1 To 3 For j = 1 To 30 If j > i Then l_drive_matrix(i, j) = l_drive_matrix(0, j)

Nirma Institute of Technology Technology XABRE

End If Next j Next i

Project Report 7th Sem I.C.

'>>> Desensitize Central Paths <<<'

Private Sub display_received()

For i = 14 To 16

Dim Instring As Variant Dim bytes As Variant

For j = 0 To 30 r_drive_matrix(i, j) = r_drive_matrix(15, j)

Dim RX_string As String RX_string = ""

Next j

Instring = MSComm1.Input

Next i

bytes = Instring Debug.Print CInt(bytes(0))

For j = 14 To 16

'MsgBox (RX_string)

For i = 0 To 30 r_drive_matrix(i, j) = r_drive_matrix(i, 15)

End Sub

Next i Private Sub Op_Mode_Timer_Timer()

Next j

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 Then

For j = 1 To 30 If j < 30 - i Then r_drive_matrix(i, j) =

Zeus.Enabled = False Op_Mode_Timer.Enabled = False

r_drive_matrix(0, j)

Load Serial_Settings_Sel

Next j

GoTo out_of_timer

Next i

End If Call CTSHolding_check

For i = 27 To 29

Call Joyread

For j = 1 To 30 If j > 30 - i Then r_drive_matrix(i, j) =

Call show_joy_buttons_pressed out_of_timer:

r_drive_matrix(30, j)

End Sub

Next j Next i

Private Sub CTSHolding_check()

End Sub

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 TX_label.BackColor = vbRed

Case comEvReceive: Call display_received '>>>DEBUG DATA: If event not being triggered

<<<'

End Select End Sub

Nirma Institute of Technology Technology XABRE

TX_label.ForeColor = vbWhite If MSComm1.PortOpen = True Then MSComm1.PortOpen = False Else

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) Next i

End If End If

'>>> if state has changed, options are"

End Sub

' 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 Dim side As Integer Dim run_locomotion_command As Boolean run_locomotion_command = True rc = GetJoystickPos(JOYSTICK1, JoyInfo) If rc = 0 Then

If state_changed(1) Or state_changed(2) Then If Not joyb_states(1) And Not joyb_states(2) Then msg1 = "STOP" If joyb_states(1) And Not joyb_states(2) Then msg1 = "UP" If Not joyb_states(1) And joyb_states(2) Then msg1 = "DOWN"

'>>> Process Button changes <<<' '>>> Transfer Button pressed info from joyinfo to array

Else msg1 = "DO NOTHING" End If

<<<' For i = 1 To 4 If JoyInfo.ButtonDown(i) Then joyb_pressed(i) = True

If state_changed(3) Or state_changed(4) Then If Not joyb_states(3) And Not joyb_states(4) Then msg2 = "STOP"

Else joyb_pressed(i) = False End If

If joyb_states(3) And Not joyb_states(4) Then msg2 = "LEFT" If Not joyb_states(3) And joyb_states(4) Then msg2

Next i

= "RIGHT" '>>> Filter the array for opposite button pressed conflicts <<<' For i = 1 To 4

Else msg2 = "DO NOTHING" End If

If joyb_pressed(i) Then If Not joyb_states(4 - (i + 1) Mod 4) Then joyb_pressed(i) = True Else joyb_pressed(i) = False End If End If

If state_changed(1) Or state_changed(2) Or state_changed(3) Or state_changed(4) Then Call joy_command(msg1, msg2) run_locomotion_command = False 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) state_changed(3) = joyb_pressed(3) Xor joyb_states(3) state_changed(4) = joyb_pressed(4) Xor joyb_states(4)

Nirma Institute of Technology Technology XABRE

X(ari) = (JoyInfo.X - OP_vals.XCntr) / OP_vals.X_Upper_Scale + 15 Else

Project Report 7th Sem I.C.

X(ari) = (JoyInfo.X - OP_vals.Xmin) / OP_vals.X_Lower_Scale End If

If msg2 = "RIGHT" Then msg2 = "DROP" Call gripper(msg1, msg2) 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 Y(ari) = (JoyInfo.Y - OP_vals.Ymin) / OP_vals.Y_Lower_Scale End If

'>>> MODULE LOCOMOTION <<<' '>>> Locomotion command subroutine <<<' '>>> Byte format is 10Y-Di-MMMM <<<' '>>> 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 End Sub

Dim command As Byte '>>> 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) If joy_control = "Gripper" Then If msg1 = "UP" Then msg1 = "CLOSE" If msg1 = "DOWN" Then msg1 = "OPEN" If msg2 = "LEFT" Then msg2 = "LIFT"

Nirma Institute of Technology Technology XABRE

CStr(command) '>>> Next drive command has to be Right drive command <<<' alternate_drive = False

Project Report 7th Sem I.C.

'>>> Prevent 2 commands being sent simultaneously <<<' GoTo loco_out End If

'>>> MODULE PAN/TILT<<<' '>>> 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 End If

command = 192 If light_status Then command = command + 16

loco_out: If TX_on Then Call TX_write(command) End Sub

'>>>MSG1 carries the Up/Down strings <<<" 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 off.bmp") command = 192 Else

'Debug.Print command Call TX_write(command) Zeus.Caption = "Zeus: Command => " + CStr(command)

light_status = True

End If

Light_Pic.Picture = LoadPicture(App.Path + "\Light

End Sub

on.bmp") command = 208 End If

'>>> MODULE GRIPPER <<<' '>>> 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.

End If

If TX_on And Not MSComm1.CTSHolding = True Then

Else

command = 32 '>>>MSG1 carries the G1 related strings <<<"

command <<<' If KeyCode < vbKey4 And KeyCode > vbKey0

If msg1 = "STOP" Then command = command + 4 If msg1 = "CLOSE" Then command = command + 12

'>>> Ext ops 2, Extension Tool 2

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 = LoadPicture(App.Path + "\img" + CStr(KeyCode - 48) +

command + 0

".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) Else

If msg2 = "DROP" Then command = command + 3

GoTo jump_out

If msg2 = "DO NOTHING" Then command =

End If

command + 0

End If 'Debug.Print command Call TX_write(command) Zeus.Caption = "Zeus: Command => " +

Else ext_ops_status(KeyCode) = (ext_ops_status(KeyCode) + 1) Mod 2 Ext_op_pics(Shift).Picture = LoadPicture(App.Path

CStr(command) End If

+ "\E" + CStr(KeyCode) +

End Sub

CStr(ext_ops_status(KeyCode)) + ".gif")

'>>> MODULE EXTENSION OPS 1&2<<<'

4 command <<<'

If KeyCode = 4 Then '>>>Ext ops 1, Extension Tool

command = 224 + ext_ops_status(3) * 2 +

'>>> Extension ops module command subroutines <<<' '>>> Byte format 1: 111 - 0 - E31E32E33 - E41

ext_ops_status(4) Else

(Command 224+) <<<' '>>> Byte format 2: 111 - 1 - E21E22 - E11 - E51

'>>>Ext ops 2, Extension Tool 1 OR 5

command <<<' command = 240 + ext_ops_status(2) * 4 +

(Command 240+) <<<' Private Sub ext_ops_event(KeyCode As Integer, Shift As Integer, toggle As Boolean)

ext_ops_status(1) * 2 + ext_ops_status(5) End If End If

Dim command As Byte If TX_on And Not MSComm1.CTSHolding = True Then

'Debug.Print command

If Not toggle Then If Shift = 0 Then

'>>> Ext ops 1, Extension Tool 3

command <<<' '>>> Key 1 to 7 or Tilde Key (~) representing

Zeus.Caption = "Zeus: Command => " + CStr(command) Call TX_write(command) jump_out:

zero <<<' If KeyCode < vbKey8 And KeyCode > vbKey0 Or KeyCode = 192 Then If KeyCode = 192 Then KeyCode = 48

'>>> Jump out since EOps2 can have a max

value of 3 and not any more <<<' End If 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 TX_label.ForeColor = vbWhite MSComm1.PortOpen = False TX_on = False

'Key pressed passes above two test so is a valid keypress kbb_states(key) = True Kb_Button(key).Picture = LoadPicture(App.Path + "\k" + CStr(key) + "on.bmp")

Else TX_label.BackColor = vbGreen TX_label.ForeColor = vbBlack MSComm1.PortOpen = True TX_on = True End If

Else 'Event is a keyup event 'Keyup is a key conflicting with previously pressed key so do nothing 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) Dim bytes(1) As Byte

kbb_states(key - 4) = False 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 End Sub

msg1 = "UP" Else If kbb_states(2) Then msg1 = "DOWN"

Private Sub kb_frame_event(key As Integer) '>>> For keyboard keys: E,S,D,X <<<'

Else If Not kbb_states(1) And Not kbb_states(2) And

'>>> Key = 1 to 4 => key pressed event <<<' '>>> Key = 5 to 8 => key released event <<<'

(key = 5 Or key = 6) Then msg1 = "STOP"

Dim msg1 As String Dim msg2 As String

Else

If key < 5 Then

End If

msg1 = "DO NOTHING"

'IF key pressed conflicts with previously pressed key so do nothing

End If 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 <<<' '>>> Total Controls having key events on Form = 6 <<<'

Else If Not kbb_states(3) And Not kbb_states(4) And (key = 7 Or key = 8) Then msg2 = "STOP" Else msg2 = "DO NOTHING" End If End If

'>>> KEYDOWN EVENT Handlers <<<' '>>> Keydown Handler 1 <<<' Private Sub Joy_pics_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) Call Form_KeyDown(KeyCode, Shift) 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 <<<' Private Sub Kb_Button_KeyUp(Index As Integer, KeyCode As Integer, Shift As Integer) Call Form_KeyUp(KeyCode, Shift) End Sub

Call kb_frame_event(2) Case vbKeyS: ' < ' Call kb_frame_event(3) Case vbKeyD: ' > ' 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) End Sub

Call light_toggle '>>> 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 <<<' Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '>>> Required to send stop signal to <<<'

Case vbKeyF3: Call ext_ops_event(4, 6, True) Case vbKeyF4: 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) Case vbKeyX: ' v ' Call kb_frame_event(6) Case vbKeyS: ' < ' Call kb_frame_event(7) Case vbKeyD: ' > ' Call kb_frame_event(8)

Nirma Institute of Technology Technology XABRE

gSerial_Settings_Sel_loaded Then '>>> Ensure shutdown(=reset) command is fired and only then shutdown Debug.Print "Fire shutdown command" Unload_Check: If check_buffer_empty() Then Unload Me

Project Report 7th Sem I.C.

Else: GoTo Unload_Check End If Else:

Ext_op_pics(1).Picture = LoadPicture(App.Path + "\E2.gif") Ext_op_pics(2).Picture = LoadPicture(App.Path + "\img" + 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 End If

Ext_op_pics(4).Picture = LoadPicture(App.Path + "\img" + 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.

Joy_Button(i).Picture = LoadPicture(App.Path + "\j"

For i = 1 To 4 If joyb_pressed(i) Then

+ CStr(i) + "off.bmp") joyb_states(i) = False

Joy_Button(i).Picture = LoadPicture(App.Path + "\j" + CStr(i) + "on.bmp") joyb_states(i) = True Else

End If Next i 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 NotFirstTime = False

PeriodMin As Long

rc

PeriodMax As Long wRmin As Long

=

joyGetDevCaps(IDDevice,

JoyCaps,

Len(JoyCaps)) If rc <> 0 Then

wRmax As Long

GetJoystickPos = rc

wUmin As Long

Exit Function

wUmax As Long

End If

wVmin As Long 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 szOEMVxD As String * MAXOEMVXD End Type Global JoyCaps As tJoyCaps ' Joystick API Calls Declare Function joyGetDevCaps Lib "winmm.dll" Alias

JOY_BUTTON1) = JOY_BUTTON1 JoyInfo.ButtonDown(2) = (JoyInfo.ButtonStates And JOY_BUTTON2) = JOY_BUTTON2 JoyInfo.ButtonDown(3) = (JoyInfo.ButtonStates And JOY_BUTTON3) = JOY_BUTTON3 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

Nirma Institute of Technology Technology XABRE

Function

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 SET Sr_History=true; ROTATE acw; REPEAT TILL tilt_sw = close; END IF IF Sr_History=true; ROTATE cw; REPEAT TILL lock_in = close; SET Sr_History=false;

‘indicates overturning, sensed thru interrupt. ‘Indicate SR Action is going on ‘acw wrt to Xabre’s upright left view ‘Xabre is upright now, ‘sensed thru interrupt Indicates that previous action was SR Action ‘cw wrt to Xabre’s upright left view ‘SR arm is locked-in ‘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

EA/VP RST

11 1 XTAL 11.0592 Mhz

C4 30pF

3 4 7 8 13 14 17 18

C5 10uF VCC R6 100E

5V U2

PB

1 2 3 4 5 6 7 8 9 10

5V

0

J4 C

1 2 3 4 5 6

5V

0.1uF

EN IN1 IN2 IN3 IN4 IN5 IN6 IN7 IN8 GND

Vcc OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 OUT8 CH

20 19 18 17 16 15 14 13 12 11

1

5V U5 C34 D0 D1 D2 D3 D4 D5 D6 D7

Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7

12V R12 10K 9 8

RESISTOR SIP 10 5K

D0 D1 D2 D3 D4 D5 D6 D7

J11

1 2 3 4 5 6 7 8 9 10

1 2 3 4 5 6 7 8 9 10

C32

RS3

Vcc OUT1 OUT2 OUT3 OUT4 OUT5 OUT6 OUT7 OUT8 CH

2 3 4 5 6 7 8 9 10

EN IN1 IN2 IN3 IN4 IN5 IN6 IN7 IN8 GND

BS2

11

OUT2

C11 10nF

6

GND

Q3 2N2222

PM2

12V

U12 R19 6K8

12V

D3 LED

12V

LED

R14 10K

D5

LE OE

LED R15 6K8

LED

9 8

D7

TH OUT CS OUT

LMD18200T OUT1 2 BS1

TH OUT CS OUT

LMD18200T OUT1 2 BS1

LED

3 5 4

G2M1

C19

1

HEADER 14

DIR PWM BRAKE

BS2 OUT2

10 C20 10nF

11

TM2

C13

1

D8

G2 MOTOR 3 5 4

D9 LED

DIR PWM BRAKE

BS2 OUT2

10 C14 10nF

11

C

12V

G2M2

12V 100uF

LED

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

C18

J5 1 2 3 4 5 6 7 8 9 10 11 12 13 14

TILT MOTOR U10

D6

9 8

C12

100uF

D4

D10

20 19 18 17 16 15 14 13 12 11

1N4007

10

R18 10K

LED

5V

7 1 2

100uF

5V

5V

DIR PWM BRAKE

6

12V

2 5 6 9 12 15 16 19

J13

0.1uF

D11

PAN MOTOR 3 5 4

0.1uF Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7

PM1 C10

1

5V

LE OE

5V C35 U6

TH OUT CS OUT

5 8 Q2 2N2222

R20 10K U13 R21 6K8

9 8

TH OUT CS OUT

C21

LMD18200T OUT1 2 BS1

G1M1 C22

1

G1 MOTOR 3 5 4

12V

DIR PWM BRAKE

BS2 OUT2

10 C23 10nF

11

G1M2

7

U3

RM2

LS2 RELAY DPDT 4 3 SRM1 5 8 SRM MOTOR 6 SRM2 7 1 RM1 2 RM2 LM1 LM2 PM1 PM2 G2M1 G2M2 G1M1 G1M2 SRM1 SRM2 TM1 TM2 TM1

3

12V

LMD18200T OUT1 2 BS1

MAX6818

5V

C17 10nF

11

LS1 RELAY DPDT 4

12V

1N4007 U9

R13 6K8

D12

C9

100uF

2 5 6 9 12 15 16 19

74LS373

5V

OUT2

10

12V 12V

0.1uF

J12 JUMPER1 R9 1K

HEADER 6

to various LIMIT SENSORS

11 1

2

BS2

D

7

to SRM LIMIT SENSORS

C31

LM2

DIR PWM BRAKE

LE OE

74LS373

EOPs LATCH

R5 10K

11

OUT2

3 5 4

7

3 4 7 8 13 14 17 18

DS89C420 C3 30pF

C8 10nF

7

30 29

RDRV MOTOR

10

BS2

GND

ALE/P PSEN

DIR PWM BRAKE

74LS373

G-PT LATCH

RM1 C16

1

LDRV MOTOR 3 5 4

GND

11 1

2 5 6 9 12 15 16 19

6

31 9

21 22 23 24 25 26 27 28

Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7

BS1

VCC

5V

X1 X2

P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7

D0 D1 D2 D3 D4 D5 D6 D7

GND

INT0 INT1 RD RXD T0 T1 TXD WR

19 18

3 4 7 8 13 14 17 18

LMD18200T 2 OUT1

7

12 13 17 10 14 15 11 16

HEADER 4

1 2 3 4 5 6 7 8

TH OUT CS OUT

C7

1

BS1

9 8

6

5V

P1.0/T2 P1.1/T2X P1.2 P1.3 P1.4 P1.5 P1.6 P1.7

R11 6K8

7

1 2 3 4

P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7

0.1uF

U11 R17 6K8

LM1

VCC

J9

39 38 37 36 35 34 33 32

C33

LMD18200T 2 OUT1

GND

R R R R

U4

SRM LATCH

TH OUT CS OUT

GND

R1 R2 R3 R4

0.1uF

9 8

6

C2 10uF

HEADER 2

D

C30

U1

U8

R10 10K

VCC

3

1

1N4007 C1 10uF

VOUT

5V

2 3 4 5 6 7 8 9 10

VIN

5V

5V

2

1 2

GND

1

J1

12V

7805/TO

VCC

5V U7

D1

6

EXT 12V

C15

100uF R16 10K

6

1N4007

12V

C6

100uF

VCC

12V

VCC

12V

D2

D17

J3 HEADER 15

1N4007

1 2 HEADER 2

Q1 2N2222

MAX6818

HEADER 10 RESISTOR SIP 10 5K RS1

1

VCC

B

B

TRANSMITTER CARD

D14 DIODE U18

TLP916F

ANTENNA

U15

C25 1uF

1 3 4 5

C26 1uF

2 6

C27 2.2uF

R1OUT R2OUT

3

RXD TTL CTS TTL

C2+ C2-

VIN

VOUT

ADJ LM317/TO220

2 R8 330E

R7 VAR R

5V

16

C28 2.2uF

U14

1

C1+ C1-

V+ V-

SW2 SW DPDT 12 9

8

Vcc Vcc

R1IN R2IN

Ant Gnd Gnd Gnd

T1OUT T2OUT

DOut

T1IN T2IN

14 7

RLP916F

4 5

13 8

TXD HEADER 4

11 10

GND

CTS TTL RXD TTL

HIN232

2

U17

15

CTS RXD GND

VCC

1 2 3 4

LOut

5V

1 6 7

1 J7

Ant

RECEIVER CARD

3

5V

GND

E1 ANT

R22 4K7

VCC

D15

4

LED

DATA IN

3

3

C24 0.1uF

7805 VOUT

2

LED R23 10K

VCC

VIN

GND

1

2

U16

D13

GND

SW DPDT SW1

D16 LED

J8

RLP916F Conn. 1 2 3 4

R24 10K

0

5V C29 A

A

C

(On PC Side)

Title

XABRE HARDWARE Size Date:

5

4

3

2

Document Number 1

Rev 1

Thursday, December 11, 2003

Sheet

1

1

of

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_MagR_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 Goto PWM_sub;

;At µC’s ISR for TF0 ;Jump to prog’s ISR

PWM_sub: Stop Timer0; If Phase_bit3 set Set Phase_bit2; Clr Phase_bit3; 3 Load Diff to TL0 Goto PWM_writer; Else If Phase_bit2 set Set Phase_bit1;

;Prog’s ISR ;Stop the timer0 ;Indicates end of phase 3 ;Set start of phase 2 ;Reset bit to show end of phase

Nirma Institute of Technology Technology XABRE

;Phase 2 counts for Diff period ;Perform PWM toggling ;Indicates end of phase 2 ;Set start of phase 1

Project Report 7th Sem I.C.

Clr Phase_bit2;

;Reset bit to show end of phase

Load Delay to TL0

;Phase 1 counts for Delay

2 period Goto PWM_writer; Else Set Phase_bit3; Clr Phase_bit1;

;Indicates end of phase 1 ;Set start of phase 3 ;Reset bit to show end of phase

Load Small_val to TL0;

;Phase 3 counts for Small val

1 period Goto PWM_writer; PWM_writer Start Timer0; If Phase_bit3 set P0.1 = 1; P0.2 = 1; Write Mag_bits; Else If Phase_bit2 set OFF If Drv_bit2set OFF P0.1 = 0; P0.2 = 0; Else If Drv_bit1 set OFF P0.1 = 0; Else OFF P0.0 = 0; Else If Phase_bit1 set P0.1 = 0; P0.2 = 0;

Nirma Institute of Technology Technology XABRE

;Perform PWM toggling

;Phase 3 ON, so both drives ON ;Turn ON LD ;Turn ON RD ;Magnitude bits are also set ;Phase 2 ON so lesser drive ;Both drives equal, turn ‘em ;Turn OFF LD ;Turn OFF RD ;Drv_bits=01 so LD is less, so ;Turn OFF LD ;Drv_bits=00 so RD is less, so ;Turn OFF RD ;Phase 1 ON so both drive OFF ;Turn OFF LD ;Turn OFF RD

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 HBridge, 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 available in 8051-compatible microcontrollers. It features a redesigned processor core that executes every 8051 instruction (depending on the instruction type) up to 12 times faster than the original for the same crystal speed. Typical applications see a speed improvement of 10 times using the same code and crystal. The DS89C420 offers a maximum crystal speed of 33MHz, achieving execution rates up to 33 million instructions per second (MIPS).

§

80C52 Compatible 8051 Pin- and Instruction-Set Compatible Four Bidirectional I/O Ports Three 16-Bit Timer Counters 256 Bytes Scratchpad RAM

§

On-Chip Memory 16kB Flash Memory In-System Programmable through Serial Port 1kB SRAM for MOVX

§

ROMSIZE Feature Selects Internal Program Memory Size from 0 to 16k Allows Access to Entire External Memory Map Dynamically Adjustable by Software

§

High-Speed Architecture 1 Clock-Per-Machine Cycle DC to 33MHz Operation Single-Cycle Instruction in 30ns Optional Variable Length MOVX to Access Fast/Slow Peripherals Dual Data Pointers with Auto Increment/Decrement and Toggle Select Supports Four Paged Modes

APPLICATIONS Data Logging Vending Automotive Test Equipment Motor Control Magstripe Reader/Scanner Consumer Electronics Gaming Equipment Appliances (Washers, Microwaves, etc.) Telephones HVAC Building Security and Door Access Control Building Energy Control and Management Uninterruptible Power Supplies Programmable Logic Controllers Industrial Control and Automation

§ Power Management Mode Programmable Clock Divider Automatic Hardware and Software Exit

ORDERING INFORMATION

§

Two Full-Duplex Serial Ports

§

Programmable Watchdog Timer

§

13 Interrupt Sources (Six External)

§

Five Levels of Interrupt Priority

PART

TEMP RANGE

DS89C420-MNG

-40°C to +85°C

MAX CLOCK SPEED (MHz) 25

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

PINPACKAGE 40 PDIP

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 6

1

23

40

7

39 34

22

Dallas Semiconductor DS89C420

Dallas Semiconductor DS89C420

44 17

12

29 18

28 1

PLCC

11

TQFP

TOP VIEW P1.0/T2 P1.1/T2EX P1.2/RXD1 P1.3/TXD1 P1.4/INT2 P1.5/INT3 P1.6/INT4 P1.7/INT5 RST P3.0/RXD0 P3.1/TXD0 P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD XTAL2 XTAL1 VSS

1 2 3 4 5 6 7 8 9 10 DS89C420 11 12 13 14 15 16 17 18 19 20

DIP

46 of 47

40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21

VCC P0.0 P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 EA/VPP ALE/PROG PSEN P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0

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 INSTRUCTION CATEGORY

SPEED ADVANTAGE

QUANTITY

4.0 4.8 5.3 6.0 8.0 12.0 24.0 4.0 6.0 8.0 12.0 4.8 6.0 8.0 8.5

2 1 1 12 5 27 1 1 27 5 13 3 5 8 111

SPEED ADVANTAGE

QUANTITY

4.0 4.8 5.3 6.0 8.0 12.0 24.0 4.0 6.0 8.0 12.0 4.8 6.0 8.0 9.4

4 1 1 35 5 93 1 1 42 5 43 4 12 8 255

Total instructions: 1 byte

Total instructions: 2 byte

Total instructions: 3 byte

Average across all instructions OPCODE CATEGORY Total opcodes: 1 byte

Total opcodes: two byte

Total opcodes: three byte

Average across all opcodes

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 register 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

INTERNAL REGISTERS

SCRATCH PAD

128 Bytes SFR

0000

1kB x 8 SRAM

External Program Memory

Data OR prog mem addr from 400–7FF

External Data Memory

4000 3FFF

FF

8kB x 8 Flash Memory (Program)

128 Bytes Indirect Addressing 2000

80 7F

1FFF 2F 20 1F

8kB x 8 Flash Memory (Program)

Bit Addressable

Bank 3 Bank 2 Bank 1

00

Bank 0

0000

03FF

0000

0000

Non-usable if Internal SRAM is activated

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 program/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 63 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 signal 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 parity 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 according 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 conditions 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 divideby-16 counter with either the oscillator divided by 2 or 4.

____________________________________________________________________________________________

114

Ultra-High-Speed Flash Microcontroller User’s Guide

SMOD_0 = PCON.7 OR SMOD_1 = WDCON.7

0

1

0

TCLK = T2CON.4

1

D1 D0 START

D4 D3 D2

D5

TXD PIN

0

DATA BUS

DIVIDEBY-16

0

P3.1 LATCH

S0

LDSBUF RDSBUF LOAD SERIAL BUFFER

RCLK = T2CON.5

D7 D6

STOP

LOAD

1

BAUD CLOCK

1

SHIFT SERIAL I/O CONTROL

DIVIDEBY-2

AVAILABLE TO SERIAL PORT 0 ONLY

TIMER 2 OVERFLOW

TIMER 1 OVERFLOW

CLOCK

SBUF TRANSMIT SHIFT REGISTER

SBUF

READ SERIAL BUFFER

RECEIVE DATA BUFFER

RD

WR

LOAD

RESET

D4 D3 D2

D5

D1 D0 START

SI SERIAL INTERRUPT

D7 D6

R1 FLAG = SCONx.0

CLOCK

T1 FLAG = SCONx.1

STOP

INTS

RB8 = SCONx.2

RECEIVE SHIFT REGISTER

DIVIDEBY-16

RXD PIN

BIT DETECTION

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

BIT DETECTOR SAMPLING SHIFT RI

Figure 12-2. Serial Port Mode 1

115

____________________________________________________________________________________________

D6

D7

STOP

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 memory. 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 functional 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 scratchpad 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 Indeterminate

80h–FFh 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 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 transmits 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 exited. 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

Y N DEVICE IN RESET (INTERNAL MEMORY ENABLED)

EA\ = 0

Y N DEVICE IN RESET (INTERNAL MEMORY DISABLED)

PSEN\ = 0 Y AUTOBAUD ROUTINE AWAITING CHARACTER ON RXD OF SERIAL PORT 0

N Y SERIAL COMMUNICATION WITH THE ROM LOADER CAN PROCEED AS ESTABLISHED ON SERIAL PORT 0

N

PSEN\ TOGGLED 0

1

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 memory. 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 produce standard baud rates. The serial loader is designed to operate across a 3-wire interface from a standard UART. The receive, transmit, 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 ROOUT

RXDO

TOOUT DS232A TOIN

TXDO

ROIN RD

DTR R1IN

R1OUT

T1OUT

T1IN

DS89C420 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:

Serial Loader_Baud rate =

Crystal Frequency 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 suggested 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 General Description The LMD18200 is a 3A H-Bridge designed for motion control applications. The device is built using a multi-technology process which combines bipolar and CMOS control circuitry with DMOS power devices on the same monolithic structure. Ideal for driving DC and stepper motors; the LMD18200 accommodates peak output currents up to 6A. An innovative circuit which facilitates low-loss sensing of the output current has been implemented.

Features n n n n

Delivers up to 3A continuous output Operates at supply voltages up to 55V Low RDS(ON) typically 0.3Ω per switch TTL and CMOS compatible inputs

n n n n n n

No “shoot-through” current Thermal warning flag output at 145˚C Thermal shutdown (outputs off) at 170˚C Internal clamp diodes Shorted load protection Internal charge pump with external bootstrap capability

Applications n n n n n

DC and stepper motor drives Position and velocity servomechanisms Factory automation robots Numerically controlled machinery Computer printers and plotters

Functional Diagram

DS010568-1

FIGURE 1. Functional Block Diagram of LMD18200

© 1999 National Semiconductor Corporation

DS010568

www.national.com

LMD18200 3A, 55V H-Bridge

December 1999

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 operating 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 dissipation 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 junction 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

DS010568-16

RDS(ON) vs Supply Voltage

DS010568-17 DS010568-18

Supply Current vs Supply Voltage

Supply Current vs Frequency (VS = 42V)

DS010568-19

DS010568-21

DS010568-20

Current Sense Output vs Load Current

Current Sense Operating Region

DS010568-22

www.national.com

Supply Current vs Temperature (VS = 42V)

DS010568-23

4

LMD18200

Test Circuit

DS010568-8

Switching Time Definitions

DS010568-9

Pinout Description

it is also necessary to apply logic high to PWM input, pin 5. The drivers that short the motor are determined by the logic level at the DIRECTION input (Pin 3): with Pin 3 logic high, both current sourcing output transistors are ON; with Pin 3 logic low, both current sinking output transistors are ON. All output transistors can be turned OFF by applying a logic high to Pin 4 and a logic low to PWM input Pin 5; in this case only a small bias current (approximately −1.5 mA) exists at each output pin. Pin 5, PWM Input: See Table 1. How this input (and DIRECTION input, Pin 3) is used is determined by the format of the PWM Signal.

(See Connection Diagram)

Pin 1, BOOTSTRAP 1 Input: Bootstrap capacitor pin for half H-bridge number 1. The recommended capacitor (10 nF) is connected between pins 1 and 2. Pin 2, OUTPUT 1: Half H-bridge number 1 output. Pin 3, DIRECTION Input: See Table 1. This input controls the direction of current flow between OUTPUT 1 and OUTPUT 2 (pins 2 and 10) and, therefore, the direction of rotation of a motor load. Pin 4, BRAKE Input: See Table 1. This input is used to brake a motor by effectively shorting its terminals. When 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 thermal warning flag output signal. Pin 9 becomes active-low at 145˚C (junction temperature). However the chip will not shut itself down until 170˚C is reached at the junction. Pin 10, OUTPUT 2: Half H-bridge number 2 output.

DS010568-4

FIGURE 2. Locked Anti-Phase PWM Control Sign/magnitude PWM consists of separate direction (sign) and amplitude (magnitude) signals (see Figure 3). The (absolute) magnitude signal is duty-cycle modulated, and the absence of a pulse signal (a continuous logic low level) represents zero drive. Current delivered to the load is proportional to pulse width. For the LMD18200, the DIRECTION input (pin 3) is driven by the sign signal and the PWM input (pin 5) is driven by the magnitude signal.

Pin 11, BOOTSTRAP 2 Input: Bootstrap capacitor pin for Half H-bridge number 2. The recommended capacitor (10 nF) is connected between pins 10 and 11. TABLE 1. Logic Truth Table PWM

Dir

Brake

H

H

L

Source 1, Sink 2

Active Output Drivers

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 forms of PWM is described in the following paragraphs. Simple, locked anti-phase PWM consists of a single, variable duty-cycle signal in which is encoded both direction and amplitude information (see Figure 2). A 50% duty-cycle PWM signal represents zero drive, since the net value of voltage (integrated over one period) delivered to the load is zero. For the LMD18200, the PWM signal drives the direction input (pin 3) and the PWM input (pin 5) is tied to logic high.

www.national.com

DS010568-5

FIGURE 3. Sign/Magnitude PWM Control SIGNAL TRANSITION REQUIREMENTS To ensure proper internal logic performance, it is good practice to avoid aligning the falling and rising edges of input signals. A delay of at least 1 µsec should be incorporated between transitions of the Direction, Brake, and/or PWM input signals. A conservative approach is be sure there is at least 500ns delay between the end of the first transition and the beginning of the second transition. See Figure 4.

6

19-4770; Rev 1; 1/99

±15kV ESD-Protected, Single/Dual/Octal, CMOS Switch Debouncers The MAX6816/MAX6817/MAX6818 are single, dual, and octal switch debouncers that provide clean interfacing of mechanical switches to digital systems. They accept one or more bouncing inputs from a mechanical switch and produce a clean digital output after a short, preset qualification delay. Both the switch opening bounce and the switch closing bounce are removed. Robust switch inputs handle ±25V levels and are ±15kV ESDprotected for use in harsh industrial environments. They feature single-supply operation from +2.7V to +5.5V. Undervoltage lockout circuitry ensures the output is in the correct state upon power-up. The single MAX6816 and dual MAX6817 are offered in SOT packages and require no external components. Their low supply current makes them ideal for use in portable equipment. The MAX6818 octal switch debouncer is designed for data-bus interfacing. The MAX6818 monitors switches and provides a switch change-of-state output (CH), simplifying microprocessor (µP) polling and interrupts. Additionally, the MAX6818 has three-state outputs controlled by an enable (EN) pin, and is pin-compatible with the ‘LS573 octal latch (except for the CH pin), allowing easy interfacing to a digital data bus.

Applications µP Switch Interfacing Industrial Instruments

Features ♦ Robust Inputs can Exceed Power Supplies up to ±25V ♦ ESD Protection for Input Pins ±15kV—Human Body Model ±8kV—IEC 1000-4-2, Contact Discharge ±15kV—IEC 1000-4-2, Air-Gap Discharge ♦ Small SOT Packages (4 and 6 pins) ♦ Single-Supply Operation from +2.7V to +5.5V ♦ Single (MAX6816), Dual (MAX6817), and Octal (MAX6818) Versions Available ♦ No External Components Required ♦ 6µA Supply Current ♦ Three-State Outputs for Directly Interfacing Switches to µP Data Bus (MAX6818) ♦ Switch Change-of-State Output Simplifies Polling and Interrupts (MAX6818) ♦ Pin-Compatible with ’LS573 (MAX6818)

Ordering Information PART

TEMP. RANGE

PINSOT PACKAGE TOP MARK

MAX6816EUS-T

-40°C to +85°C

4 SOT143

KABA

MAX6817EUT-T -40°C to +85°C 6 SOT23-6 AAAU MAX6818EAP -40°C to +85°C 20 SSOP — Note: There is a minimum order increment of 2500 pieces for SOT packages.

PC-Based Instruments Portable Instruments Automotive Applications Membrane Keypads

Pin Configurations

Typical Operating Circuit

TOP VIEW

VCC GND

4

VCC

3

OUT

MAX6816

MAX6816

MECHANICAL SWITCH

1

µP 0.1µF

IN

OUT GND

DEBOUNCED OUTPUT

RESET

IN

2

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.

MAX6816/MAX6817/MAX6818

General Description

±15kV ESD-Protected, Single/Dual/Octal, CMOS Switch Debouncers MAX6816/MAX6817/MAX6818

Pin Description PIN

NAME

FUNCTION

MAX6816

MAX6817

MAX6818

1

2

10

GND

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





1

EN

Active-Low, Three-State Enable Input for outputs. Resets CH. Tie to GND to “always enable” outputs.





11

CH

Change-of-State Output. Goes low on switch input change of state. Resets on EN. Leave unconnected if not used.

Ground

D

VCC VCC

D VCC

OSC.

COUNTER

Q

OUT

Q

LOAD

R

RPU UNDERVOLTAGE LOCKOUT

IN ESD PROTECTION

MAX6816 MAX6817 MAX6818

Figure 1. Block Diagram

_______________Detailed Description Theory of Operation The MAX6816/MAX6817/MAX6818 are designed to eliminate the extraneous level changes that result from interfacing with mechanical switches (switch bounce). Virtually all mechanical switches bounce upon opening or closing. These switch debouncers remove bounce when a switch opens or closes by requiring that sequentially clocked inputs remain in the same state for a number of sampling periods. The output does not change until the input is stable for a duration of 40ms. The circuit block diagram (Figure 1) shows the functional blocks consisting of an on-chip oscillator, counter, exclusive-NOR gate, and D flip-flop. When the 4

input does not equal the output, the XNOR gate issues a counter reset. When the switch input state is stable for the full qualification period, the counter clocks the flip-flop, updating the output. Figure 2 shows the typical opening and closing switch debounce operation. On the MAX6818, the change output (CH) is updated simultaneously with the switch outputs.

Undervoltage Lockout The undervoltage lockout circuitry ensures that the outputs are at the correct state on power-up. While the supply voltage is below the undervoltage threshold (typically 1.9V), the debounce circuitry remains transparent. Switch states are present at the logic outputs without delay.

_______________________________________________________________________________________

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

tEN

IN1

1/2 VCC

1/2 VCC

tPE

OUT1–OUT8 OUT1

1/2 VCC

tPE OUT1–OUT8

IN2

tPD

OUT NORMALLY LOW

VOL + 0.5V

1/2 VCC OUT NORMALLY

VOH - 0.5V

HIGH tPC

CH

OUT2

MAX6816/MAX6817/MAX6818

tDP

tPD

1/2 VCC

Figure 4. MAX6818 µP-Interface Timing Diagram CH +VCC MAX6818 ONLY

+VCC

0.1µF

Figure 2. Input Characteristics SW1 IN1 20V IN (20V/div)

EN

I/O

CH

IRQ

OUT1

D0

OUT8

D7

µP

MAX6818

0 -20V IN8 SW8 4V

OUT (2V/div)

Figure 5. MAX6818 Typical µP Interfacing Circuit

0

20ms/div

Figure 3. Switch Input ±25V Fault Tolerance

Robust Switch Inputs The switch inputs on the MAX6816/MAX6817/MAX6818 have overvoltage clamping diodes to protect against damaging fault conditions. Switch input voltages can safely swing ±25V to ground (Figure 3). Proprietary ESD-protection structures protect against high ESD encountered in harsh industrial environments, membrane keypads, and portable applications. They are designed to withstand ±15kV per the IEC1000-4-2 Air Gap Discharge Test and ±8kV per the IEC1000-4-2 Contact Discharge Test. Since there are 63kΩ (typical) pull-up resistors connected to each input, driving an input to -25V will draw

approximately 0.5mA (up to 4mA for eight inputs) from the VCC supply. Driving an input to +25V will cause approximately 0.32mA of current (up to 2.6mA for eight inputs) to flow back into the VCC supply. If the total system VCC supply current is less than the current flowing back into the VCC supply, VCC will rise above normal levels. In some low-current systems, a zener diode on VCC may be required.

±15kV ESD Protection As with all Maxim devices, ESD-protection structures are incorporated on all pins to protect against electrostatic discharges encountered during handling and assembly. The MAX6816/MAX6817/MAX6818 have extra protection against static electricity. Maxim's engineers have developed state-of-the-art structures to protect against ESD of ±15kV at the switch inputs without

_______________________________________________________________________________________

5

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

The major difference between tests done using the Human Body Model and IEC1000-4-2 is higher peak current in IEC1000-4-2, because series resistance is lower in the IEC1000-4-2 model. Hence, the ESD withstand voltage measured to IEC1000-4-2 is generally lower than that measured using the Human Body Model. Figure 7a shows the IEC1000-4-2 model and Figure 7b shows the current waveform for the 8kV, IEC1000-4-2, Level 4, ESD Contact-Discharge test. The Air-Gap test involves approaching the device with a charged probe. The Contact-Discharge method connects the probe to the device before the probe is energized.

Machine Model The Machine Model for ESD tests all pins using a 200pF storage capacitor and zero discharge resistance. Its objective is to emulate the stress caused by contact that occurs with handling and assembly during manufacturing.

MAX6818 µP Interfacing The MAX6818 has an output enable (EN) input that allows switch outputs to be three-stated on the µP data bus until polled by the µP. Also, state changes at the switch inputs are detected, and an output (CH) goes low after the debounce period to signal the µP. Figure 4 shows the timing diagram for enabling outputs and reading data. If the output enable is not used, tie EN to GND to “always enable’’ the switch outputs. If EN is low, CH is always high. If a change of state is not required, leave CH unconnected.

Pin Configurations (continued) TOP VIEW

IN1 1

GND 2

6

MAX6817

IN2 3

SOT23-6

OUT1

EN 1

20 VCC

IN1 2

19 OUT1

IN2 3

18 OUT2

IN3 4 IN4 5

5

VCC

4

OUT2

17 OUT3

MAX6818

16 OUT4

IN5 6

15 OUT5

IN6 7

14 OUT6

IN7 8

13 OUT7

IN8 9

12 OUT8

GND 10

11 CH

SSOP

___________________Chip Information MAX6816 TRANSISTOR COUNT: 284 MAX6817 TRANSISTOR COUNT: 497 MAX6818 TRANSISTOR COUNT: 2130 SUBSTRATE CONNECTED TO GND

_______________________________________________________________________________________

7

MAX6816/MAX6817/MAX6818

meets Level 4 (the highest level) of IEC1000-4-2, without the need for additional ESD-protection components.

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 D D D D D

Choice of Eight Latches or Eight D-Type Flip-Flops in a Single Package 3-State Bus-Driving Outputs Full Parallel Access for Loading Buffered Control Inputs Clock-Enable Input Has Hysteresis to Improve Noise Rejection (’S373 and ’S374) P-N-P Inputs Reduce DC Loading on Data Lines (’S373 and ’S374)

SN54LS373, SN74LS373 . . . DW, N, OR NS PACKAGE SN74S373 . . . DW OR N PACKAGE (TOP VIEW)

OC 1Q 1D 2D 2Q 3Q 3D 4D 4Q GND

description

19

3

18

4

17

5

16

6

15

7

14

8

13

9

12

10

11

VCC 8Q 8D 7D 7Q 6Q 6D 5D 5Q C

C for ’LS373 and ’S373; SN54LS373, SN54S373, . . . FK PACKAGE (TOP VIEW)

The eight latches of the ’LS373 and ’S373 are transparent D-type latches, meaning that while the enable (C or CLK) input is high, the Q outputs follow the data (D) inputs. When C or CLK is taken low, the output is latched at the level of the data that was set up.

2D 2Q 3Q 3D 4D

4

3 2 1 20 19 18

5

17

6

16

7

15

8

14 9 10 11 12 13

8D 7D 7Q 6Q 6D

4Q GND C 5Q 5D

The eight flip-flops of the ’LS374 and ’S374 are edge-triggered D-type flip-flops. On the positive transition of the clock, the Q outputs are set to the logic states that were set up at the D inputs.

20

2

1D 1Q OC VCC 8Q

These 8-bit registers feature 3-state outputs designed specifically for driving highly capacitive or relatively low-impedance loads. The high-impedance 3-state and increased high-logic-level drive provide these registers with the capability of being connected directly to and driving the bus lines in a bus-organized system without need for interface or pullup components. These devices are particularly attractive for implementing buffer registers, I/O ports, bidirectional bus drivers, and working registers.

1

C for ’LS373 and ’S373;

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. Copyright  2002, Texas Instruments Incorporated

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

On products compliant to MIL-PRF-38535, all parameters are tested unless otherwise noted. On all other products, production 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 OC

C

D

OUTPUT 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 Transparent Latches OC

C

1

OC

11

CLK C1

1D

3

4

3D

4D

5D

6D

7D

8D

16

1D

13

14

17

8D

18

for ’S373 Only

4

POST OFFICE BOX 655303

• DALLAS, TEXAS 75265

15

1D

16

1D

1D

for ’S374 Only

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

12

1D

C1 8Q

9

1D

C1 7Q 7D

19

8

6

1D

C1 6Q 6D

1D

C1 18

15

7

5

1D

C1 5Q 5D

1D

C1 17

12

4

2

1D

C1 4Q 4D

1D

C1 14

9

3

C1 3Q 3D

1D

C1 13

6

11

C1 2Q 2D

1D

C1 8

5

1

C1 1Q 1D

1D

C1 7

2

1D

C1 2D

’LS374, ’S374 Positive-Edge-Triggered Flip-Flops

19

1Q

2Q

3Q

4Q

5Q

6Q

7Q

8Q

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

D D D D D D D

KC PACKAGE (TOP VIEW)

3-Terminal Regulators Output Current up to 1.5 A Internal Thermal-Overload Protection High Power-Dissipation Capability Internal Short-Circuit Current Limiting Output Transistor Safe-Area Compensation Direct Replacements for Fairchild µA7800 Series

OUTPUT COMMON INPUT The COMMON terminal is in electrical contact with the mounting base. TO-220AB

O

C

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 these regulators can deliver up to 1.5 A of output current. The internal current-limiting and thermal-shutdown features of these regulators essentially make them immune to overload. In addition to use as fixed-voltage regulators, these devices can be used with external components to obtain adjustable output voltages and currents, and also can be used as the power-pass element in precision regulators.

I

KTE PACKAGE (TOP VIEW)

OUTPUT COMMON INPUT The COMMON terminal is in electrical contact with the mounting base.

The µA7800C series is characterized for operation over the virtual junction temperature range of 0°C to 125°C.

O

C

I

AVAILABLE OPTIONS PACKAGED DEVICES TJ

0°C to 125°C

VO(NOM) (V)

PLASTIC FLANGE MOUNT (KC)

HEAT-SINK MOUNTED (KTE)

5

µA7805CKC

µA7805CKTE

8

µA7808CKC

µA7808CKTE

10

µA7810CKC

µA7810CKTE

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. Copyright  2001, Texas Instruments Incorporated

PRODUCTION DATA information is current as of publication date. 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 µA78xx

+V

+VO

0.33 µF

0.1 µF

Figure 1. Fixed-Output Regulator

IN

+

µA78xx

VI

OUT

G 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

ǒ )Ǔ

NOTE A: The following formula is used when Vxx is the nominal output voltage (output to common) of the fixed regulator: VO

+V ) xx

V xx R1

I Q R2

Figure 3. Adjustable-Output Regulator

µA78xx

Input 0.33 µF

R1

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 Transmitters/Receivers

Features

The HIN232-HIN241 family of RS-232 transmitters/receivers interface circuits meet all ElA RS-232E and V.28 specifications, and are particularly suited for those applications where ±12V is not available. They require a single +5V power supply (except HIN239) and feature onboard charge pump voltage converters which generate +10V and -10V supplies from the 5V supply. The family of devices offer a wide variety of RS-232 transmitter/receiver combinations to accommodate various applications (see Selection Table).

• Requires Only Single +5V Power Supply - (+5V and +12V - HIN239)

The drivers feature true TTL/CMOS input compatibility, slewrate-limited output, and 300Ω power-off source impedance. The receivers can handle up to ±30V, and have a 3kΩ to 7kΩ input impedance. The receivers also feature hysteresis to greatly improve noise rejection.

• Multiple Drivers - ±10V Output Swing for 5V lnput - 300Ω Power-Off Source Impedance - Output Current Limiting - TTL/CMOS Compatible - 30V/µs Maximum Slew Rate

• Meets All RS-232E and V.28 Specifications

• High Data Rate. . . . . . . . . . . . . . . . . . . . . . . . . . . 120kbps • Onboard Voltage Doubler/Inverter • Low Power Consumption • Low Power Shutdown Function • Three-State TTL/CMOS Receiver Outputs

• 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 POWER SUPPLY VOLTAGE

NUMBER OF RS-232 DRIVERS

NUMBER OF RS-232 RECEIVERS

EXTERNAL COMPONENTS

LOW POWER SHUTDOWN/TTL THREE-STATE

NUMBER OF 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

PART NUMBER

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 VCC

FUNCTION 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 RIN ROUT

Transmitter Outputs. These are RS-232 levels (nominally ±10V). Receiver Inputs. These inputs accept RS-232 input levels. An internal 5kΩ pull-down resistor to GND is connected to each input. 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 NUMBER

TEMP. RANGE (oC)

PACKAGE

HIN232CB

0 to 70

16 Ld SOIC

HIN232CB-T

0 to 70

Tape and Reel

PKG. DWG. # M16.3

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

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

M24.3

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) TOP VIEW

HIN236 (SOIC) TOP VIEW T3OUT

1

24 T4OUT

15 GND

T1OUT

2

23 R2IN

14 T1OUT

T2OUT

3

22 R2OUT

R1IN

4

21 SD

R1OUT

5

20 EN

T2IN

6

19 T4IN

16 VCC

C1+ 1 V+ 2 C1- 3

13 R1IN

C2+ 4

12 R1OUT

C2- 5 6

11 T1IN

T2OUT 7

10 T2IN

V-

9 R2OUT

R2IN 8

T1IN

7

18 T3IN

GND

8

17 R3OUT

VCC

9

16 R3IN

C1+ 10

14 C2-

C1- 12

13 C2+

+5V

+5V

+ 1µF

16 1µF

1 NOTE 1

+ 3 4

NOTE 1

T1IN

+ 5

11

VCC C1+ C1C2+ C2-

+5V TO 10V VOLTAGE DOUBLER

+10V TO -10V VOLTAGE INVERTER

+5V 400kΩ

V+

2

+

NOTE 1 1µF

T1IN

V- 6 +

T2IN

T1

14

T2IN

10

T1OUT

T2 7

12

T2OUT

T4IN

R1IN

T1

+5V 400kΩ

T2

6

18

+5V 400kΩ

T3

+5V 400kΩ 19

T4

2

3

1

24

R2OUT

8

1µF

1µF T1OUT

T2OUT

T3OUT T4OUT

4 R1IN 5kΩ

R1 22

9

+

V- 15

R1OUT

5kΩ

R1

V+

11

+

+5V 400kΩ 7

5

13

R1OUT

9 10 VCC C1+ + +5V TO 10V 12 C1- VOLTAGE DOUBLER 13 C2+ + +10V TO -10V 14 VOLTAGE INVERTER C2-

NOTE 1

T3IN +5V 400kΩ

15 V-

V+ 11

23 R2IN

R2OUT R2IN

5kΩ

R2

5kΩ

R2

17

16 R3IN

R3OUT 15

20

5kΩ

R3

SD

EN

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

21

HIN232, HIN236, HIN237, HIN238, HIN239, HIN240, HIN241 Test Conditions: VCC = +5V ±10%, TA = Operating Temperature Range (Continued)

Electrical Specifications PARAMETER

TEST CONDITIONS

MIN

TYP

MAX

UNITS

120

-

-

kbps

TIMING CHARACTERISTICS Baud Rate (1 Transmitter Switching)

RL = 3kΩ

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 -3V to +3V, 1 Transmitter Switching

-

3

-

V/µs

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 C1+

S1

VOLTAGE INVERTER

S2

V+ = 2VCC

S5

C2+

S6

VCC

GND + -

+ C1

-

+

C3

VCC

GND

C1-

S3

S4

GND S7

C2-

+

C2

-

C4 V- = -(V+)

S8

RC OSCILLATOR

FIGURE 1. CHARGE PUMP

Detailed Description The HIN232 thru HIN241 family of RS-232 transmitters/receivers are powered by a single +5V power supply (except HIN239), feature low power consumption, and meet all ElA RS-232C and V.28 specifications. The circuit is divided into three sections: The charge pump, transmitter, and receiver.

Charge Pump An equivalent circuit of the charge pump is illustrated in Figure 1. The charge pump contains two sections: the voltage doubler and the voltage inverter. Each section is driven by a two phase, internally generated clock to generate +10V and -10V. The nominal clock frequency is 16kHz. During phase 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

to 5.5V. The output impedance of the voltage doubler section (V+) is approximately 200Ω, and the output impedance of the voltage inverter section (V-) is approximately 450Ω. A typical application uses 1µF capacitors for C1-C4, however, the value is not critical. Increasing the values of C1 and C2 will lower the output impedance of the voltage doubler and inverter, increasing the values of the reservoir capacitors, C3 and C4, lowers the ripple on the V+ and V- supplies. During shutdown mode (HIN236, HIN240 and HIN241), SHUTDOWN control line set to logic “1”, the charge pump is turned off, V+ is pulled down to VCC , V- is pulled up to GND, and the supply current is reduced to less than 10µA. The transmitter outputs are disabled and the receiver outputs are placed in the high impedance state.

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

Receivers

The transmitters are TTL/CMOS compatible inverters which translate the inputs to RS-232 outputs. The input logic threshold is about 26% of VCC , or 1.3V for VCC = 5V. A logic 1 at the input results in a voltage of between -5V and V- at the output, and a logic 0 results in a voltage between +5V and (V+ -0.6V). Each transmitter input has an internal 400kΩ pullup resistor so any unused input can be left unconnected and its output remains in its low state. The output voltage swing meets the RS-232C specifications of ±5V minimum with the worst case conditions of: all transmitters driving 3kΩ minimum load impedance, VCC = 4.5V, and maximum allowable operating temperature. The transmitters have an internally limited output slew rate which is less than 30V/µs. The outputs are short circuit protected and can be shorted to ground indefinitely. The powered down output impedance is a minimum of 300Ω with ±2V applied to the outputs and VCC = 0V.

The receiver inputs accept up to ±30V while presenting the required 3kΩ to 7kΩ input impedance even if the power is off (VCC = 0V). The receivers have a typical input threshold of 1.3V which is within the ±3V limits, known as the transition region, of the RS-232 specifications. The receiver output is 0V to VCC . The output will be low whenever the input is greater than 2.4V and high whenever the input is floating or driven between +0.8V and -30V. The receivers feature 0.5V hysteresis to improve noise rejection. The receiver Enable line EN, when set to logic “1”, (HIN236, 239, 240, and 241) disables the receiver outputs, placing them in the high impedance mode. The receiver outputs are also placed in the high impedance state when in shutdown mode. VCC RXIN -30V < RXIN < +30V

V+

ROUT 5kΩ

GND < VROUT < VCC

GND VCC 400kΩ

300Ω

TXIN

TOUT

GND < TXIN < VCC

V- < VTOUT < V+

FIGURE 3. RECEIVER

V-

FIGURE 2. TRANSMITTER

TIN OR RIN TOUT OR ROUT

VOL VOL tPHL

Average Propagation Delay =

tPLH

tPHL + tPLH 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 where ±12V power supplies are not available for conventional RS-232 interface circuits. The applications presented represent typical interface configurations.

C2 + 1µF TD

TD TTL/CMOS INPUTS AND OUTPUTS

RTS

HIN232 6

5 11

-

RS-232 INPUTS AND OUTPUTS

+ T1

14 T2

10

TTL/CMOS RTS INPUTS AND 12 RD OUTPUTS R2 9 CTS

7 13

R1

8

15

TD (2) TRANSMIT DATA RTS (4) REQUEST TO SEND RD (3) RECEIVE DATA CTS (5) CLEAR TO SEND SIGNAL GROUND (7)

FIGURE 9. SIMPLE DUPLEX RS-232 PORT WITH CTS/RTS HANDSHAKING

-

14 T2

10

+ C2 1µF

5

T1

11

12

TD (2) TRANSMIT DATA

7

RTS (4) REQUEST TO SEND

13

RD (3) RECEIVE DATA

RD 9

3

4 HIN232

3

CTS

DTR (20) DATA TERMINAL READY DSRS (24) DATA SIGNALING RATE SELECT

2 4

In applications requiring four RS-232 inputs and outputs (Figure 10), note that each circuit requires two charge pump 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 the reduction of the charge pump source impedance which effectively increases the output swing of the transmitters.

1

16

1 C1 + 1µF -

A simple duplex RS-232 port with CTS/RTS handshaking is illustrated in Figure 9. Fixed output signals such as DTR (data terminal ready) and DSRS (data signaling rate select) is generated by driving them through a 5kΩ resistor connected to V+.

C1 + 1µF -

+

R2

R1

8

CTS (5) CLEAR TO SEND

15 16 2

-

C3

+

+

C4

6 V- V+

2µF

6

-

2µF

2 16

+5V RS-232 INPUTS AND OUTPUTS

HIN232 C1 + 1µF DTR TTL/CMOS INPUTS AND OUTPUTS

DSRS

1

4

3

5 T1

11

14 T2

10 12

7 13

DCD R1

9

R2

R1

15

8

+ C2 1µF

-

DTR (20) DATA TERMINAL READY DSRS (24) DATA SIGNALING RATE SELECT DCD (8) DATA CARRIER DETECT R1 (22) RING INDICATOR 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:



Horizontal definition: 380line



Scan frequency: PAL/CCIR:50Hz or NTSC/EIA: 60Hz



Miniumum illumination: 3LUX



Sensitivity :



Output power :



Output frequency : 0.9G / 1.2G



Frequency control : adopt CPU frequency lock the wreath to control, with high

PAL:5.78X4.19mm or NTSC:4.69X3.45mm

+18DB=AGL NO-OFF 50MW / 300MB

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)

Related Documents


More Documents from ""

Being Icy Cool
December 2019 9
Bharti
November 2019 42
Currency Trading
November 2019 38
Insurance Guide
May 2020 18