Home
User`s Manual
Contents
1. finclude stdio h finclude conio h LE Constant ss 02045 x define CH 2 no of channels define NUM 10 data of total number define BPS K baud rate unsigned char rbuf CH NUM receive buffer unsigned int ADR CH 0x3e8 0x2e8 I O address unsigned int rent CH 0 0 receive count Prototype void main void Main void main void unsigned char TI int dummy for i 0 i lt CH i RS 232C initialize outp ADR i 0x3 0x80 Line Control Register DLAB SET outp ADR 1 0x0 BPS amp Oxff Divisor Latch Baud Rate SET outp ADR i 0x1 BPS gt gt 8 amp Oxff outp ADR i 0x3 0x0 Line Control Register DLAB RESET outp ADR 1 0x3 0x7 Line Control Register Bit 0 1 Word Length 8 bit PREM BIE Oe mala 2 stop bit y for j 0 j lt
2. Device CHO ID 0 Compatible COM3 03E8 03EF IRQ5 1 Compatible COM3 03E8 03EF Not Used 2 Compatible COM4 02E8 02EF IRQ7 3 Compatible COM4 02E8 02EF Not Used 4 Enhanced mode 01A0 01A7 IRQ5 5 Enhanced mode 01A0 01A7 IRQ7 6 Enhanced mode 02A0 02A7 IRQ5 th Enhanced mode 02A0 02A7 IRQ7 8 Enhanced mode 9800 9807 IRQ9 9 Enhanced mode 9820 9827 IRQ5 A Enhanced mode 9840 9847 IRQ7 B Enhanced mode 9860 9867 Not Used C Enhanced mode 0700 0707 IRQ9 D Enhanced mode 0720 0727 IRQ7 E Reserved Reserved Reserved F Reserved Reserved Reserved N CAUTION If the model label on the main unit reads Rev D Device ID No C or D can be used for that product Please use it excluding Device ID No 8 9 A B when using in the Windows environment Operating under CPU SB30 Series When using the module under CONTEC s microcontroller unit CPU SB30 Series the OS must be set to recognize the I O address and interrupt level used by the COM IPD FIT GY In CPU SB30 Series this is called hardware installation Use the following installation procedure Compatible Mode Installation Procedure 1 Do not connect COM 1PD FIT GY to CPU SB30 Series Turn on the CPU SB30 Series 2 Select Start from Control Panel and start the Add Hardware 3 Click Next gt in response to Welcome to the Add Hardware Wizard in the Add Hardware Wizard 4 Select the Yes from the Has the hardware already been connected with the com
3. receive buffer volatile unsigned int ADR CH 0x1a0 0x2a0 I O address volatile unsigned int intcnt CH 0 0 interrupt counter volatile int IrqLevel IRQ5 interrupt level int OrgMasterImr original IMR unsigned char IntVector 2 0x0d OxOf interruput vector unsigned char PicMask 2 Oxdf Ox7f mask bit unsigned char IsrClear 3 0x65 0x67 0x61 ISR clear om BEOEOSDG x void main void void Initialize void initialize void ChgVect void change vector void ResVect void restore vector void interrupt far inthandler void interrupt handler void interrupt far OrgVect 0 original vector foe YAD xy void Initialize void unsigned int i j int dummy for i 0 i lt CH i outp ADR i 0x3 0x80 Line Control Register DLAB SET outp ADR i 0x0 BPS amp Oxff Divisor Latch Baud Rate SET outp ADR i 0x1 BPS gt gt 8 amp Oxff outp ADR 1 0x3 0x0 Line Control Register D
4. Output port 1 General Registers Starting I O D7 D6 D5 D4 D3 D2 D1 DO address 0h Transmit Holding Register THR 1h Interrupt Enable Register IER CTS RTS Xoff MODEM Receive Transmit Receive Interrupt Interrupt Interrupt Status Line Holding Holding 2 2 2 Interrupt Status Register Register Interrupt 2h FIFO Control Register FCR TX FIFO Trigger Trigger Enable MSB LSB 3h Line Control Register LCR Latch Break Parity Parity Enable Bits Enable 4h Modem Control Register MCR Clock IR Loop OP2 and Prescaler Mode Back INT Select Enable Enable Enable 2 2 5h YO Disabled 7h Scratch Pad Register SPR 7h Enhanced Mode Select Registers EMSR 3 LUNES mim Bit 3 Bit 2 1 For details see the Using an Interrupt section 2 These bits are enabled with EFR Bit 4 1 3 These registers are enabled with FCTR Bit 6 1 Figure 5 6 Output port General Registers Output port 2 Baud Rate Registers Starting I O D7 D6 D5 D4 D3 D2 D1 DO address Oh LSB of Divisor Latch DLL 1h MSB of Divisor Latch DLM Figure 5 7 Output port Baud Rate Registers CONTEC 28 COM IPD FIT GY 5 Using the Module Output port 3 Enhanced Registers Starting I O D7 D6 D5 D4 D3 D2 DI DO address Oh FIFO Level Counter Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC 1h Feature Control Register FCTR Rx Tx SCPAD Trig Trig RS485 TrRx RTS RTS Mode Swap Bit 1 Bit
5. 10 J hardware wait dummy inp Ox2ef outp ADR i 0x4 0x3 MODEM Control Register DTR RTS dummy inp ADR i 0x5 Line Status Register Dummy Read dummy inp ADR i 0x0 Receiver Buffer Register Dummy Read dummy inp ADR i 0x2 Interrupt ID Register Dummy Read dummy inp ADR i Ox6 Modem Status Register Dummy Read outp ADR i 0x1 0x1 Interrupt Enable Register for j 0 j lt NUM j send CHO to CH1 while inp ADR 0 0x5 amp 0x20 transmitter empty outp ADR 0 0x0 j while inp ADR 1 0x5 amp 0x1 data ready rbuf 1 rcnt 1 unsigned char inp ADR 1 0x0 rent 1 CONTEC 34 COM IPD FIT GY 5 Using the Module for j 0 j lt NUM j printf CHO 02x gt CH1 02x 4 rbuf 1 31 if rbuf 1 j j printf Verify Error in verify data else printf n printf in for j 0 j lt NUM j send CH1 to CHO while inp ADR 1 0x5 amp 0x20 transmitter empty outp ADR 1 0x0 j while inp ADR 0 0x5 amp 0x1 data ready rbuf 0 rcnt 0 unsigned char inp ADR 0 0x0 rent 0 for j 0 j lt NUM j printf CHI 02x gt CH0 02x j rbuf 0 y if rbuf 0 j j printf Verify Error in verify data else printf Nn I E End of file 9 CONTEC COM IPD FI
6. 0 Auto Inv Delay Delay control Bit 1 Bit 0 2h Enhanced Feature Register EFR Special Cont 3 Cont 2 Cont 1 Cont 0 Char Tx Rx Tx Rx Tx Rx Tx Rx select Control Control Control Control 4h Xon 1 Word 5h Xon 2 Word 6h Xoff 1 Word 7h Xoff 2 Word Figure 5 8 Output port Enhanced Register Output port 4 Interrupt Vector Registers Starting I O D7 D6 D5 D4 D3 D2 DI DO address 1Fh Interrupt Vector Registers Clock Clock Reserved selection selection Bit 1 Bit 0 Figure 5 9 Output port Interrupt Vector Registers CONTEC COM 1PD FIT GY 29 5 Using the Module Interrupt Vector Registers Output t MD D7 D6 D2 Di DO Starting I O address SIFE Reserved TM Clock selection see Setting a Baud Rate 00 Clock 0 mode 1 8432M Hz 01 Clock 1 mode 3 6864MHz 10 Clock 2 mode 7 3728MHz 11 Clock 3 mode 14 7456MHz Fixed at 0 Input port i D7 D6 DI Do Starting VO oe Reserved L CHO interrupt see Using an Interrupt 0 Interrupt detected 1 Nointerrupts Fixed at 0 Figure 5 10 Interrupt Vector Registers CONTEC COM IPD FIT GY 30 5 Using the Module Using an Interrupt Compatible Mode When the Module is operated in the compatible mode channel CHO is assigned to standard I O addresses COM3 and COMA respectively The interrupt levels will be IRQ5 for COM3 and IRQ7 for COM4 Enhanced Mode When the Module is being used
7. 2304 1536 1047 134 5 857 150 300 600 1200 1800 2000 2400 3600 4800 7200 9600 14400 19200 28800 38400 57600 76800 115200 153600 230400 460800 921600 9 CONTEC COM IPD FIT GY 17 4 Functions Automatic RTS Control Functions This function applies to half duplex mode communications As half duplex means that the same line is used for sending and receiving the RTS and CTS signals are used to switch between sending and receiving Normally RTS is set by writing to the corresponding register bit but on this module it is controlled by hardware This reduces the load on the CPU Other Functions Bus Isolation The communication lines are electrically isolated from each other and from the PC This isolation prevents electrical disturbances from occurring between the Module and the external circuitry The Module can therefore be used comfortably even when line noise can be easily generated to seemingly cause the Module to malfunction or break Surge Protection As surge protection is provided on all RS 422A 485 control lines you can safely use the modules in environments where you are concerned about surges causing incorrect operation or damage to the PC CONTEC 18 COM 1PD FIT GY 5 Using the Module 5 Using the Module Compatible and Enhanced Modes The COM 1PD FIT GY can operate in two modes the compatible mode in which the COM IPD FIT GY when connected to CONTEC s microcontroller unit acts
8. CH1 02d n intcnt 0 intent 1 printf Mn for j 0 j lt NUM j send CH1 to CHO while inp ADR 1 0x5 amp 0x20 transmitter empty outp ADR 1 0x0 j while intcnt 0 lt 10 printf Interrupt CH0 02d CH1 02d n intcnt 0 intcnt 1 printf Xn ResVect restore vector for j 0 j lt NUM j printf CHO 02x gt CH1 02x 4 rbuf 11 if rbuf 1 j j printf Verify Error in verify data else printf n printf Mn for j 0 lt NUM JFF printf CH1 02x gt CH0 02x j vbuf 0 5 if rbuf 0 j j printf Verify Error Mn else printf n printfi Xn printf Interrupt CH0 02d CH1 02d n intcnt 0 intcnt 1 End of file CONTEC COM IPD FIT GY 39 6 System Reference CONTEC 40 COM IPD FIT GY 6 System Reference Block Diagram Interface Connector CHO N ZN Receiver Driver UART XR16C2850 Compatible gt Control Circuit Device ID 1 Stack Connector Figure 6 1 Block Diagram 6 System Ref
9. ONU ERECTAE RARE Redi 13 How to Connect an Interface Connector 13 Types of Cable and Example Connections 14 4 FUNCTIONS 15 Communication EUnctlon eco eere Ro 15 Serial Data Transmission nane 15 RS 422A 485 Control Lines ii 15 Send and Receive Data Buffers eese eem ete Ie e ree erede 15 Setting the Baud Ra 16 CONTEC COM IPD FIT GY ii Automatic RTS Control Functions i 18 Other FUNCHOMNS eR 18 Bus Tsolatiom 225 torio roi o adero oe oe e Oo ete 18 Riiie e P M 18 5 USING THE MODULE 19 Compatible and Enhanced Modes rr 19 Operating u der CPU SB30 Sefies 4e eee IAN RAIN RE SEN rat 20 Checking Operations with the Diagnosis Program 22 What is the Diagnosis Program nenion seniii iia eee e Ree ie rie en eene 22 Check Method irre rte E E OO UR sient GRE NE I ee CUM Using the Diagnosis Program Details on I O Ports and R glsters i eorom e meo e o oo Pc ete 26 Interrupt Vector Registers eret eerte teint irte ehe bees e eve IRA 30 Ium 31 Incip AI RISO 32 Compatible Mode nene ER EE RE AIR i 33 Enhanced Mode ated aaa eorr ette to ii 36 6 SYSTEM REFERENCE 41 Block Dragt tn eee e RE A EE IRE IR ini 41 Equivalence Circuit cola 42 Sp CI Cat OM M M 43 Extertial Dimensions Em 44 CONTEC
10. as a standard serial port and the enhanced mode in which the COM 1PD FIT GY operates under CONTEC s unique control method Before building a system using the COM 1PD FIT GY a working understanding of the features of these modes may be in order Touse three or more channels of COM in the Windows environment select the enhanced mode and then use the COM DRV W32 driver Ex Device ID No 04h 07h OCh Compatible Mode The COM 1PD FIT GY can use two channels as standard serial ports COM 1PD FIT GY can be assigned to COM3 or COM4 The module uses the I O addresses assigned for a standard serial port As the module is handled as the standard serial port it can run under other driver software that can operate standard serial ports Although OS dependent the I O addresses in the COM 1PD FIT GY can be recognized by the system and used as standard ports You can use these addressed by checking the system settings Enhanced Mode The enhanced mode operates the COM 1PD FIT GY by using CONTEC s unique control method For I O addresses CONTEC designated addresses must be used When the COM DRV W32 driver is used it can be used in the same way as a standard serial port N CAUTION When using it in the OS other than Windows user needs to create the device driver for enhanced mode CONTEC COM IPD FIT GY 19 5 Using the Module Table 5 1 I O Address
11. of a single COM port using loopback communications See the figure below for the switch settings Switch setting for using a cross cable Switch settings for using loopback communications without a cross cable S 2 o a oo Bo Bo F B B B E F LS W 5E _ EN CONTEC 22 COM 1PD FIT GY 5 Using the Module Using the Diagnosis Program Starting the Diagnosis Program Run APISBP Apisbp ComDrw Utility CommChk CommChk exe from the supplied CD ROM Communication Settings COM Setup Specify the number of the COM port you wish to test If connecting two COM ports via a cross cable specify the respective COM ports in Devicel and Device2 When performing loopback communications on a single COM port set the same port number in both Device 1 and Device 2 Communication Settings Specify the Bits Second Data bits and other settings you wish to use 9 Diagnostic Program for Serial Communications Port COM Setup Test Item Device COM1 X Open Close the port every time Device2 COM2 2 Port Open Communication Settings Device Bits Second 9600 z Device2 Data bits 8 zl V From Devicel to Device2 Stop Bits 1 X Parity None Iv From Device2 to Deyice1 Duplex Full X Port Close Type of data Device Binary Codes 01h to FFh Device2 Ascii String t I
12. 00bps 1200m 9 600bps Communication cable 28AWG double shielded cable twisted pairs used for each signal line N CAUTION When connecting the module to a controller module the internal power consumption should be taken into account If the total current exceeds the capacity of the power supply unit the integrity of the operation cannot be guaranteed For further details please see the Controller Module manual 9 CONTEC COM IPD FIT GY 43 6 System Reference Table 6 2 Installation Environment Requirements Parameter Requirement description Operating temperature 0 50 C Storage temperature 10 60 C Humidity 10 90 No condensation Floating dust particles Not to be excessive Corrosive gases None Physical Dimensions 1 2 03 TI D UU DP 14 0 315 114 0 3 Co a oc Ed C 1 E 1 s ggg kar co 7 35 0 ULT TO eo DI C a It ao 3 CD PRIN cI co 45 0 rz nz Comm ai ED q 3 5 2
13. 5 2 64 7 14 0 Jo C C3 3 mm cme A amar Figure 6 4 Physical Dimensions CONTEC 44 COM IPD FIT GY COM 1PD FIT GY User s Manual CONTEC CO LTD March 2009 Edition 3 9 31 Himesato Nishiyodogawa ku Osaka 555 0025 Japan Japanese http www contec co jp English http www contec com Chinese http www contec com cn No part of this document may be copied or reproduced in any form by any means without prior written consent of CONTEC CO LTD 03192009 12102003 Management No A 46 812 03192009 rev7 Parts No LYDC896
14. 60800 128000bps 3 6 As the result contains a fractional part this baud rate cannot be set Clock 1 mode 230400 Desired baud rate Division register setting value Ex 230400 9600bps 24 As the result is an integer this baud rate can be set 230400 128000bps 1 8 As the result contains a fractional part this baud rate cannot be set Clock 0 mode 115200 Desired baud rate Division register setting value Ex 115200 9600bps 12 As the result is an integer this baud rate can be set 115200 76800bps 1 5 As the result contains a fractional part this baud rate cannot be set AN CAUTION See Chapter 5 Interrupt Vector Registers for selecting the clock frequency 1 8432 3 6864 7 3728 or 14 7456 MHz For use in compatible mode clock 0 1 8432 MHz is used as a fixed setting CONTEC 16 COM 1PD FIT GY 4 Functions Refer to the following baud rate setting examples Baud rates other than those listed below can also be set if they produce a valid setting Value in the equation described above Table4 1 Baud Rate Generator Programming Table Clock 0 mode Clock 1 mode Clock 2 mode Clock 3 mode 1 8432MHz 3 6864MHz 7 3728MHz 14 7456MHz Output Baud Rate Setup Baud Rate Setup Baud Rate Setup Baud Rate Setup baud rate Generator error Generator error Generator error Generator error register register register register 57600 28800 23040 14400 7680
15. COM 1PD FIT GY 1 Before Using the Product 1 Before Using the Product This chapter provides information you should know before using the product About the Module The COM 1PD FIT GY performs serial communication with an external device in compliance with RS 422A 485 capable of serving as COM3 or COMA of an F amp elT series microcontroller unit The module can also serve as an expansion COM port for a media converter RP COM FIT H RP COM FIT H AF or FX DS540 COM2 Please read this manual carefully to create application programs and configure the system such as setting the switches and connecting it to external devices Features RS 422A 485 serial communication ports The communication lines are electrically isolated from the module High speed communication is supported at up to 921 600bps 115 200bps in compatible mode A baud rate can be set by software The module has 128 byte FIFO buffers for transmit and receive Driver software is supplied to allow the serial ports to be used as standard Windows or Linux COM ports 1 The data transfer mode full duplex or half duplex can be set by a switch The board includes a 100 terminating resistor required for multi drop party line connections The resistor can be inserted into the signal line by a switch Surge protection is provided for each RS 422A 485 signal line Up to three units can be added at the time of enhanced mode as expansion ports for micro contro
16. F amp eIT Series Isolated RS 422A 485 1ch Communication Module COM 1PD FIT GY User s Manual CONTEC CO LTD Check Your Package Thank you for purchasing the CONTBC product The product consists of the items listed below Check with the following list that your package is complete If you discover damaged or missing items contact your retailer Product Configuration List Module COM I PD FIT GY 1 First step guide 1 CD ROM F amp elT Series Setup Disk 1 1 The CD ROM contains various software and User s Manual this manual CD ROM Module First step guide F amp eIT Series Setup Disk CONTEC COM 1PD FIT GY i Copyright Copyright 2003 CONTEC CO LTD ALL RIGHTS RESERVED No part of this document may be copied or reproduced in any form by any means without prior written consent of CONTEC CO LTD CONTEC CO LTD makes no commitment to update or keep current the information contained in this document The information in this document is subject to change without notice All relevant issues have been considered in the preparation of this document Should you notice an omission or any questionable item in this document please feel free to notify CONTEC CO LTD Regardless of the foregoing statement CONTEC assumes no responsibility for any errors that may appear in this document or for results obtained by the user as a result of using this product Trademarks F am
17. LAB RESET outp ADR 1 0x3 0x7 Line Control Register Bit 0 1 Word Length 8 bit fF X Bib los 2 stop bit prey for 0 j lt 10 j hardware wait dummy inp 0x2ef CONTEC COM IPD FIT GY 37 5 Using the Module outp ADR i 0x4 0x3 MODEM Control Register DTR RTS dummy inp ADR i 0x5 Line Status Register Dummy Read dummy inp ADR i 0x0 Receiver Buffer Register Dummy Read dummy inp ADR i 0x2 Interrupt ID Register Dummy Read dummy inp ADR i 0x6 Modem Status Register Dummy Read outp ADR i Oxl 0x1 Interrupt Enable Register outp ADR 0 0x1f 0x80 Select Clock Mode i aoe Change sector sree SaaS ae void ChgVect void OrgVec dos getvect IntVector IRQ5 OrgVect dos getvect IntVector IRQ7 _disable dos setvect IntVector IRQ5 inthandler dos setvect IntVector IRQ7 inthandler outp 0x21 OrgMasterImr inp 0x21 amp PicMask IRQ5 amp PicMask IRQ7 outp 0x20 IsrClear IRQ5 ISR clear outp 0x20 IsrClear IRQ7 ISR clear _enable enable fr restore vector Es void ResVect void _disable disable outp 0x21 OrgMasterImr _dos_setvect IntVect
18. OM IPD FIT GY or COM folder to display the properties screen 4 Select Resources Check the resource items and settings and look for any conflicts 5 If changing an I O address change the Basic configuration from the Setting based on To change an interrupt level click on Change setting C After checking the resources check again that the interrupt level value on the COM 1PD FIT GY match the settings in the OS 9 CONTEC COM IPD FIT GY 21 5 Using the Module Checking Operations with the Diagnosis Program method Use the Serial diagnosis program from the supplied CD ROM API SBP W32 to check that the module and driver software work normally thereby you can confirm that they have been set up correctly What is the Diagnosis Program These programs perform some simple checks on the board operation Two programs are provided Terminal program CTstCom exe Data entered from the keyboard is sent directly from the port The function of the program is equivalent to the Hyper Terminal program provided with Windows Serial Communications Diagnostic Program CommChk exe Performs actual communications and indicates whether the results are correct or not error The following describes the procedure for testing using the serial communications diagnostic program CommChk exe Check Method Obtain an RS 422A 485 cross cable If you do not have a cross cable you can use a switch on the board to perform testing
19. T GY 35 5 Using the Module Enhanced Mode Flowchart Start Initialize Change interrupt vectors Send CHO data Show an interrupt count Send CH1 data e Show an interrupt count Restore the interrupt vector Show data en End Interrupt processing Read inte vector register rrupt Count number of interrupts Read CHO data No Count number of interrupts Read CH1 data No End 36 CONTEC COM 1PD FIT GY 5 Using the Module Sample Program Sample program 2 UNITO lt gt UNIT1 Loop Test UNIT No 0 1 DEVICE ID 4 7 Mode Enhanced Mode Channel 0 1A0H 2A0H Baud Rate 115 200 bps Interrupt TRO5 TRO7 include stdio h include conio h include dos h frc COS TIL define CH 2 no of channels define NUM 10 data of total number define BPS 1 baud rate define IRQ5 0 Pe IROS FZ define TRO7 1 IRQ7 volatile unsigned char rbuf CH NUM
20. TD to be free from defects in material and workmanship for up to one year from the date of purchase by the original purchaser Repair will be free of charge only when this device is returned freight prepaid with a copy of the original invoice and a Return Merchandise Authorization to the distributor or the CONTEC group office from which it was purchased This warranty is not applicable for scratches or normal wear but only for the electronic circuitry and original modules The warranty is not applicable if the device has been tampered with or damaged through abuse mistreatment neglect or unreasonable use or if the original invoice is not included in which case repairs will be considered beyond the warranty policy How to Obtain Service For replacement or repair return the device freight prepaid with a copy of the original invoice Please obtain a Return Merchandise Authorization Number RMA from the CONTEC group office where you purchased before returning any product No product will be accepted by CONTEC group without the RMA number Liability The obligation of the warrantor is solely to repair or replace the product In no event will the warrantor be liable for any incidental or consequential damages due to such defect or consequences that arise from inexperienced usage misuse or malfunction of this device CONTEC 2 COM 1PD FIT GY 1 Before Using the Product Safety Precautions Understand the following definitions an
21. ause actual transmission and reception take place after a certain amount of data has been collected In contrast decreasing the FIFO trigger size or disabling FIFO memory shortens the timing of data transmission and reception but may increase the load on the CPU or miss some receiving data Since the FIFO trigger size is variable adjusting it depending on the system results in optimum performance 9 CONTEC COM IPD FIT GY 15 4 Functions Setting the Baud Rate The output baud rate can be set by setting the appropriate value to the Baud Rate Generator register The available setting range depends on which clock mode is used Clock 3 mode 15 921 600bps Clock 2 mode 8 460 800bps Clock 1 mode 4 230 400bps Clock 0 mode 2 115 200bps However some baud rate values do not have a corresponding Baud Rate Generator register setting If the result of substituting the baud rate into the equation below is an integer then that baud rate can be set If the result contains a fractional part the baud rate cannot be set Clock 3 mode 921600 Desired baud rate Division register setting value Ex 921600 9600bps 96 As the result is an integer this baud rate can be set 921600 128000bps 7 2 As the result contains a fractional part this baud rate cannot be set Clock 2 mode 460800 Desired baud rate Division register setting value Ex 460800 9600bps 48 As the result is an integer this baud rate can be set 4
22. by DDK CN5 D9M Male Connector type mfd by CONTEC COM 1PD Figure 3 1 Connecting an interface connector and connectors that can be used Transmit Data TxD Transmit Data TxD4 J 9 9 RxD Receive Data Request to Send RTS 7 RxD Receive Data 8 F CTS Clear to Send 9 CTS Clear to Send Request to Send RTS Signal Ground SG CHO 9 pin D SUB Female Figure 3 2 Signal Layout on the Interface Connector N CAUTION For TxD RxD and RTS big numbered pins are and small numbered pins are For CTS big numbered pins are and small numbered pins are This is the opposite of the other signals but is not a misprint The external metal frame shell of the connector is insulated from the unit or not in contact with any part of the unit When grounding is required for example as data transfer remains unstable ground the remote device to the earth 9 CONTEC COM IPD FIT GY 13 3 Connecting to an External Device Types of Cable and Example Connections The figures below show examples of how to connect the cable for the module The RS 422A 485 interface works based on a differential signal whereby the signal is carried by the potential difference between two lines and Using twisted pair cable is recommended to improve resistance to noise TxD A A TxD
23. d precautions to use the product safely Safety Information This document provides safety information using the following symbols to prevent accidents resulting in injury or death and the destruction of equipment and resources Understand the meanings of these labels to operate the equipment safely DANGER DANGER indicates an imminently hazardous situation which if not avoided will result in death or serious injury WARNING WARNING indicates a potentially hazardous situation which if not avoided could result in death or serious injury N CAUTION CAUTION indicates a potentially hazardous situation which if not avoided may result in minor or moderate injury or in property damage CONTEC COM 1PD FIT GY 8 1 Before Using the Product Handling Precautions CAUTION Take the following precautions when handling this module Do not modify the module CONTEC will bear no responsibility for any problems etc resulting from modifying this module Do not use or store the equipment in a hot or cold place or in a place that is subject to severe temperature changes Operating temperature range 0 to 50 C Do not use or store the equipment in a place subject to direct sunlight or near a heating device such as a stove Do not use or store the equipment in a dusty or humid place Operating humidity range 10 to 90 RH no condensation As this product contains precision electronic comp
24. duct Environment Use this product in the following environment If used in an unauthorized environment the module may overheat malfunction or cause a failure Operating temperature 0 50 C Humidity 10 90 RH No condensation Corrosive gases None Floating dust particles Not to be excessive Inspection Inspect the product periodically as follows to use it safely The ventilation slits are not covered and neither dust nor alien substance is attached to the ventilation slits IM ips IL When storing this product keep it in its original packing form 1 Put the module in the storage bag 2 Wrap it in the packing material then put it in the box 3 Store the package at room temperature at a place free from direct sunlight moisture shock vibration magnetism and static electricity Disposal When disposing of the product follow the disposal procedures stipulated under the relevant laws and municipal ordinances CONTEC 6 COM IPD FIT GY 2 Module Nomenclature and Settings 2 Module Nomenclature and Settings Nomenclature of Module Components Figure 2 1 shows the names of module components In the figure the indicated switch settings represent factory settings LED Indicator gt Device ID 9 sis Trans
25. erence CONTEC COM IPD FIT GY 41 6 System Reference Equivalence Circuit t O gt 1000 TxD RTS o TIT 47kO i 6 2ko e o lt 1000 RxD CTS O o c4 em a eR X TIT Figure 6 2 Circuitry Diagrams RS 422A 485 in Full Duplex i o l TxD RxD B l emo 6 2kO0 lt lt 1000 eko 47ko d Figure 6 3 Circuitry Diagrams RS 422A 485 in Half Duplex CONTEC 42 COM IPD FIT GY 6 System Reference Specification Table 6 1 Specification Item Specification Number of channels solation solation voltage Transfer method Baud rate Data length 5 6 7 8 bits Parity check Controller chip 162850 or equivalent The module has 128 byte receive and 128 byte transmit FIFO buffers Connecting distance Dimension mm Weight module itsel Module installation One touch connection to 35mm DIN rails 1 These items can be set by software 2 Data transmission at high speed may not be performed normally depending on the environment including the type of status of connected material of cable and environment 3 The table below lists an example of the relationship between baud rate and communication distance Communication Baud rate distance 300m 115 200bps 57 600bps 19 2
26. errun Receive meer Empty Ready 6h Modem Status Register MSR CD RI DSR CTS 7h Scratch Pad Register SPR 7h FIFO Level Counter FLVL 3 1 For details see the Using an Interrupt section 2 These bits are enabled with EFR Bit 4 1 3 These registers are enabled with FCTR Bit 6 1 Figure 5 2 Input port General Registers CONTEC 26 COM IPD FIT GY 5 Using the Module Input port 2 Baud Rate Registers Starting I O D7 D6 D5 D4 D3 D2 DI DO address Oh LSB of Divisor Latch DLL 1h MSB of Divisor Latch DLM Figure 5 3 Input port Baud Rate Registers Input port 3 Enhanced Registers Starting I O D7 D6 D5 D4 D3 D2 D1 DO address 0h FIFO Level Counter Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC Trig FC 1h Feature Control Register FCTR Rx Tx SCPAD Trig Trig RS485 TrRx RTS RTS Mode Swap Bit 1 Bit 0 Auto Inv Delay Delay control Bit 1 Bit 0 2h Enhanced Feature Register EFR Special Cont 3 Cont 2 Cont 1 Cont 0 Char Tx Rx Tx Rx Tx Rx Tx Rx select Control Control Control Control 4h Xon 1 Word 5h Xon 2 Word 6h Xoff 1 Word 7h Xoff 2 Word Figure 5 4 Input port Enhanced Registers Input port 4 Interrupt vector register Starting I O D7 D6 D5 D4 D3 D2 D1 DO address 1Fh Interrupt vector register Fixed at CHO i Reserved 0 Interrupt Figure 5 5 Input port Interrupt vector register CONTEC COM 1PD FIT GY 27 5 Using the Module
27. et CH1 32 CONTEC COM IPD FIT GY Compatible Mode Flowchart Start Set Baud Rate Generator Set transmission format WAIT time Set modem control output Line status register ummy READ RECEIVE register ummy READ Interrupt ID register ummy READ Modem status register ummy READ Final channel 1 1 Yes Send CHO data Pr I CH1 LSR DO N Bit 1 Fe es Receive CH1 data CHO LSR DONN Bit 1 Yes Receive CHO data Final data Show data i 5 Using the Module 9 CONTEC COM IPD FIT GY 33 5 Using the Module Sample Program Sample program 1 UNITO lt gt UNIT1 Loop Test UNIT No 0 1 DEVICE ID 0 2 Mode Compatible Mode Channel 0 03E8H COM3 02E8H COM4 Baud Rate 115 200 bps Interrupt N A
28. im omi RxD A A RxD L pen NAT ne ARTS n A RIS 1 Xes evs 7 T CTS n A CTS T CTS J CTS T LU Iw SG sc na ys Figure 3 5 Example Connection in Half Duplex A CAUTION If connecting between external devices and this board with faulty wiring it will become the cause of failure CONTEC 14 COM IPD FIT GY 4 Functions 4 Functions This section describes the functions of the module Communication Function Serial Data Transmission Sends and receives data in accordance with the RS 422A 485 standard The baud rate can be set independently in the range 2 921 600bps by software RS 422A 485 Control Lines The module include the RTS RTS CTS and CTS control lines The lines can be controlled or monitored by software from the application Send and Receive Data Buffers The module has a separate 128 byte send and 128 byte receive buffer The buffers operate as FIFO buffers and help reduce the load on the CPU for high speed communications or system operation The FIFO trigger size is a data buffer size that determines the timing of generating a hardware interrupt Increasing the FIFO trigger size decreases the number of times hardware interrupts occur for data transmission and reception thereby reducing the load on the CPU However this delays the timing of transmitting data to the remote device and the timing of notifying an application of data reception bec
29. in enhanced mode interrupt generation can be checked with the interrupt vector register IVR The Device ID switch is used to specify the interrupt line to be used When accepting an interrupt you can check by reading the IVR whether the interrupt has been generated within the interrupt service routine Before exiting from the executed interrupt service read the IVR again to check for any pending interrupt The XR16C2850 contains an internal register to enable itself for interrupts make them available or to check whether any interrupt has been generated For using the register refer to the data sheet for the XR16C2850 supplied by Exar Corporation For setting to use interrupts use the D2 bit in the modem control register MCR D2 bit of MCR Write 0 Enable when the power is turned on Write 1 Disable 9 CONTEC COM IPD FIT GY 31 5 Using the Module Examples Following is a COM 1PD FIT GY sample program The sample program executes transmission and reception between two COM 1PD FIT GY units To connect RTS and CTS to an external device in full duplex mode use a connection cable as illustrated below Figure 5 11 Cable Connection Diagram Code las Si i Pin Code SG TxD TxD RxD RxD RTS RTS CTS CTS ower Q 4 FP NA 9 1st set CHO SG RxD RxD N TxD TxD CTS CTS RTS RTS w e O 0 HH 2nd s
30. ller unit 2 Up to three units can be added as expansion ports for media converters RP COM FIT H RP COM FIDH AF FX DS540 COM2 Similar to other F amp elIT series products the system in the module itself incorporates a 35 mm DIN rail mounting mechanism as a standard item A connection to a controller module can be effected on a lateral stack basis in a unique configuration which permits a simple smart system configuration without the need for a backplane board 1 When using it as the expansion port for micro controller unit 2 Two units can be added at the time of compatible mode CONTEC COM 1PD FIT GY 1 1 Before Using the Product Customer Support CONTEC provides the following support services for you to use CONTEC products more efficiently and comfortably Web Site Japanese X http www contec co jp English http www contec com Chinese http www contec com cn Latest product information CONTEC provides up to date information on products CONTEC also provides product manuals and various technical documents in the PDF Free download You can download updated driver software and differential files as well as sample programs available in several languages Note For product information Contact your retailer if you have any technical question about a CONTEC product or need its price delivery time or estimate information Limited One Year Warranty CONTEC products are warranted by CONTEC CO L
31. mission mode terminators Interface connector COM 1PD Figure 2 1 Names of module components Setting a Device ID Depending on the specific Device ID that is set the COM 1PD FIT GY can be switched over between the compatible mode and the enhanced mode Table 2 1 shows the relationship between Device IDs and the modes For a description of the compatible and enhanced modes see Chapter 4 Using the Module The factory setting is 0 in which the COM 1PD FIT GY can be used as a COM3 standard port N CAUTION The setup method in this document assumes the combination with a microcontroller For the combination with a media converter read the manual for the media converter carefully for setup CONTEC COM 1PD FIT GY 2 Module Nomenclature and Settings Setup Method A device ID can be set by turning the rotary switch on the device face To set a device ID turn the switch knob Factory settings Device ID 0 Figure 2 2 Setting a Device ID Table 2 1 I O Address DeviceID CHO LO address h 0 osrs oser iRQs compatible cowa Enhanced mode 6 ozAo o2A7 IRQ5 Enhanced mode Enhanced mode 8 9800 9807 RQ9 Enhanced mode 9 9820 9827 IRQ5 Enhanced mode Enhanced mode B 9860 9867 NotUsed Enhanced mode Enhanced mode D o7zo o727 IRQ7 Enhanced mode AN CAUTION If the model label on
32. n damage to the module CONTEC COM 1PD FIT GY 2 Module Nomenclature and Settings Setting of Terminator The terminator setting switch controls whether or not a terminator is inserted into each signal line Set the terminators on or off in accordance with the devices with which you are communicating The terminators on the module are 100 resistors See Figure 2 4 for details on how to use terminators in a multi drop party line connection Each bit in the switch corresponds to a different signal line bit 7 for RxD bit 8 for CTS bit 9 for TxD and bit 10 for RTS Setting Procedure If you wish to use a terminator of other than 100Q set the terminator switch OFF and insert an external terminator Table 2 3 Setting of Terminator Inserte Not inserted Term ON Term OFF o i 9 1 Factory E setting Setting T in 1O 10 e e N N EL C Figure 2 3 Aor D Figure 2 3 B or C Both terminators Other than both of the line terminators of the line Terminator Terminator ea pps elim paste prem pm pee iI Mato i Wea f De 1 rd 1 1 twi j 1 i 1 E i 1 i i PS f i Enn iO NE i 1 i A B D Figure 2 3 Party Line Connection CAUTION When the data transfer mode is set to half duplex
33. n will be completed When using more than one unit in Compatible Mode repeat 2 15 17 Set DeviceID according to the I O address and interrupt level registered in the system 18 Always make sure that CPU SB30 Series is turned off when connecting COM 1PD FIT GY to CPU SB30 Series 19 Turn on CPU SB30 Series to start the OS This completes the installation After the completion of the installation always check the resources using the How to Verify Resources Managed by OS section as a reference Enhanced Mode Installation Procedure When it is used with Enhanced Mode COM driver of the bundled CD ROM is necessary Refer to COMDRV W32 Main_e html being attached to the bundled CD ROM for the way of installing it N CAUTION When using it with Enhanced Mode in the Windows the product cannot be used with Device ID 4 or 5 To use the product with Enhanced Mode select another Device ID How to Verify Resources Managed by OS Always check the PC resources I O address and interrupt level assigned to the COM 1PD FIT GY before actually using this product Use the following procedure to check the resources managed by the OS 1 Select System from Control Panel and click Hardware property sheet then open Device Manager 2 For Compatible mode double click on the Ports COM amp LPT folder For Enhanced mode double click on the Multi function adapters folder 3 Double click on the CONTEC CO LTD C
34. onents do not use or store in environments subject to shock or vibration Do not use or store the product near equipment generating a strong magnetic field or radio waves f you notice any strange odor or overheating please unplug the power cord immediately In the event of an abnormal condition or malfunction please consult the dealer from whom the equipment was purchased To avoid electric shock please do not touch the system with a wet hand Do not open the module casing CONTEC will disclaim any responsibility for equipment whose casing has been opened To prevent damage please do not subject the module to impact or bend it To prevent contact malfunction please do not touch the metallic pins on the external module connector The module contains switches that need to be properly set Before using the module please check its switch settings To avoid malfunction please do not change the module switch settings in an unauthorized manner Do not operate the device module when the power for the Controller Module is on To avoid malfunction please be sure to turn off the power for the Controller Module When disposing of the product follow the disposal procedures stipulated under the relevant laws and municipal ordinances CONTEC 4 COM 1PD FIT GY 1 Before Using the Product Regarding EMC Instruction Class A Notice and FCC Part 15 Class A Notice and VCCI Class A This product has acq
35. only set bit 9 ON Communications may not function if other bits are set ON CONTEC 10 COM 1PD FIT GY 2 Module Nomenclature and Settings The figure below shows the circuit associated with the data transfer mode setting switch and terminator setting switch o o 4 Terminator 2 oO o 7181 91 SE fiee a oca lo lo lo lo o o9L Terminator at 1 2W 1000 162850 Data transmission or Equivalent mode SOUT i OTxD gt OTxD ORxD BIN p ORxD OCTS CTS b OCTS ORTS RTS i ORTS DCD DTR DSR oe Figure 2 4 Setting Switch Circuits e LED Indicator RX Indicates that the module is receiving serial data green TX Indicates that the module is transmitting serial data green CONTEC COM 1PD FIT GY 11 2 Module Nomenclature and Settings CONTEC 12 COM 1PD FIT GY 3 Connecting to an External Device 3 Connecting to an External Device Interface Connector How to Connect an Interface Connector When connecting the Module to an external device you can use the supplied connector plug Lock nut UNC 4 40 inch screw Connector used DELC J9SAF 20L9 Female Connector type mfd by JAE equivalent C Applicable m 17JE 23090 02 D8C Male Connector type mfd
36. or IRQ5 OrgVect restore orgvect _dos_setvect IntVector IRQ7 OrgVect restore orgvect _enable enable interrupt handler void interrupt far inthandler void unsigned char sts0 stsl enable enable do sts0 unsigned char inp ADR 0 0x1f Int Vector Register if stsO amp Ox1 CHO status while inp ADR 0 0x05 amp 0x1 rbuf 0 intcnt 0 unsigned char inp ADR 0 0x0 intent 0 count times of an interrupt while sts0 amp Oxf do stsl unsigned char inp ADR 1 0x1f Int Vector Register if sts1 amp Ox1 CHO status while inp ADR 1 0x05 amp 0x1 rbuf 1 intcnt 1 unsigned char 1np ADR 1 0x0 intent 1 count times of an interrupt while stsl amp Oxf CONTEC 38 COM IPD FIT GY 5 Using the Module _disab1e disable outp 0x20 0x20 EOI fee mailri gt AAA S xf void main void unsigned int i j Initialize initialize ChgVect change vector for j 0 j lt NUM j send CHO to CH1 while inp ADR 0 0x5 amp 0x20 transmitter empty outp ADR 0 0x0 j while intcnt 1 lt 10 printf Interrupt CHO 02d
37. p elT is a registered trademark or trademark of CONTEC CO LTD Other company and product names that are referred to in this manual are generally trademarks or registered trade trademark CONTEC COM IPD FIT GY Table of Contents Check Your Package oce te dee ERE OA i Sonus ii Trademarks SR ii Table 0f Contents 5 rne ret P Re ETE E RO iii 1 BEFORE USING THE PRODUCT 1 About the Module seis ec br bison cil RB OU HO APUD av dearest 1 Features ncasa e e Eee PP GE EDDA EXC NERO EYE SERE SEEN RO 1 jeurironevinjno i 2 Web Site 2 Limited One Year Wartalityi arcana iano o eni aaa 2 How to Obtain Service nl 2 i 2 Safety Precaution Se oe ER ITO ERN UL ST NER UA RI ee 3 Safety Inform tion i eiae OD RN GUN I REO IO 3 Handling Precautions nanesi torrers EEEE E EE RE EIER CNET ENS ERGEBEN ES 4 Inspection 6 Much I E 6 Disposal PM 6 2 MODULE NOMENCLATURE AND SETTINGS 7 Nomenclature of Module Components nennen enne eter enne nnne 7 Setting a Device ID sos hee etie ene vete Rie RE E Medio d Setup Qu 8 Setting Transmission Mode o WR eret REESE En 9 Setting of Terminator ion ee RERO e ERR RR RR REG ERRORES RE 10 LED Indicator Et 11 3 CONNECTING TO AN EXTERNAL DEVICE 13 Interface Contiectot o e RO OE RR RU GREG
38. puter screen and click Next 5 The next select Add a New Device in response to Choose a Hardware Task and click Next 6 Select No select from a list Advanced in response to Do you want Windows to search for your new hardware and click Next 7 Select the Ports COM amp LPT folder from the Hardware types screen 8 Select Communications Port from Standard Types and press Next 9 On the Start Hardware Installation screen press Next 10 Code 34 occurs in the Completing the Add Hardware Wizard screen as resources are not assigned properly To assign resources appropriately select View or change resources for this hardware Advanced CONTEC 20 COM 1PD FIT GY 5 Using the Module 11 On the Properties screen of Add New Hardware Wizard press the Set Configuration Manually to specify an I O address and interrupt level 12 Change Base Configuration and select an available I O address Then press IRQ to specify IRQ Make sure that Conflict information is set to No devices are conflicting 13 Make sure that Conflicting device list is set to No conflicts Set the I O address and interrupt level in the same way as for DevicelD For details see Table 5 1 14 Press Complete to end the wizard 15 The message Do you want to restart now will appear Select Yes to restart the OS 16 Once the operation is completed according to the instructions the installatio
39. tarting I O D7 D6 D5 D4 D3 D2 D1 DO address Oh 1h 2h 3h 4h 5h 6h 7h 1Fh Interrupt vector register Figure 5 1 I O Ports N CAUTION Each port must be accessed in bytes to conform to device specifications Channel 0 register Non byte access to any port is not allowed such as word access or doubleword access 9 CONTEC COM IPD FIT GY 25 5 Using the Module Details on I O Ports and Registers The XR16C2850 s internal registers are port mapped differently depending on the value set in the Line Control Register LCR The General Registers are enabled at startup or with LCR Bit 7 0 and LCR other than OxBFh The Baud Rate Registers are enabled with LCR Bit 7 1 The Enhanced Registers are enabled with LCR OxBFh Input port 1 General Registers Starting I O D7 D6 D5 D4 D3 D2 D1 DO address 0h Receive Holding Register RHR 1h Interrupt Enable Register IER CTS RTS Xoff MODEM Receive Transmit Receive Interrupt Interrupt Interrupt Status Line Holding Holding 2 2 2 Interrupt Status Register Register Interrupt 2h Interrupt Status Register ISR FIFOs FIFOs RTS Int Int Int Enable Enable CTS Priority Priority Priority Bit 2 Bit 1 Bit 0 3h Line Control Register LCR Set Set Even Parity Stop HEDO 4h Modem Control Register MCR OP2 and Out 1 INT O INT Enable Enable LINT Disable 1 5h Line Status Register LSR FIFO THR amp THR Break Framing Parity Ov
40. terations number pis a Message Iterations Once Limited Il C Infinity Start Help 9 CONTEC COM IPD FIT GY 23 5 Using the Module Start test Click the Start button to start the test using the specified conditions View test result The test result is displayed in the Message window A successful completion message appears if the test completed OK Diagnostic Program for Serial Communications Port COM Setup Devicel COM3 we Device2 COME MA Communication Settings Bits Second 9600 v Data bits 8 M Stop Bits 1 X Parity None Duplex r Type of data Binary Codes 01h to FFh Ascii String nition String SendCommand terations Once C Limited C Infinity Num of Iterations r Test Item Open Close the port every time Port Open Devicel OK Device2 OK I From Device to Device2 K IV From Device2 to Devicel Ok Devicel OK Device2 OK Iterations number 1 Port Close Message Normal Termination 24 CONTEC COM IPD FIT GY 5 Using the Module I O Ports and Registers The module uses the XR16C2850 Exar Corporation upward compatible with the 16550 UART For details on the internal registers of the XR16C2850 and its control refer to the XR16C2850 data sheet In enhanced mode starting I O address 1Fh is used as an interrupt vector register T O Ports S
41. the main unit reads Rev D Device ID No C or D can be used for that product Please use it excluding Device ID No 8 9 A B when using in the Windows environment CONTEC 8 COM 1PD FIT GY 2 Module Nomenclature and Settings Setting Transmission Mode The data transfer mode setting switch is used to switch between full duplex and half duplex and to specify whether to use RTS CTS in full duplex mode Set the appropriate data transfer mode for the device with which you are communicating Bits 1 to 5 are used to set the data transfer mode Always set bit 6 is to OFF Setting Procedure Table 2 2 Setting Transmission Mode Full duplex Full Transmission Hat duplex When there are no Hal RTS and CTS When there are RTS and CTS RTS RTS gt CTS CTS E o o o oo oo oo Setting ta E Factory He E Bo setting no i 10 a t F IG L uU B N eR a mg EL N TXD is only used for data With above setting RTS and To connect RTS and CTS to transmission the sending CTS are connected in the the other unit and receiving modes should board communication is available be switched over using Communication is available the modem control without wiring of RTS and register CTS N CAUTION Do not use with bits 1 and 2 both set ON as this may result i
42. uired the above mentioned standard However a sufficient margin may not be secured for the standard In this case use a ferrite core SEIWA E04SR301334 or a compatible product for both ends of the COM cable When attaching the ferrite core coil it around once near the connector while leaving it open and then close it If a mouse is connected to your microcontroller as a rider to the EMC Directive for a Class A product a ferrite core SEIWA E04SR301334 or a compatible product must be used for the mouse cable When attaching the ferrite core coil it around twice near the connector while leaving it open and then close it FCC PART 15 Class A Notice NOTE This equipment has been tested and found to comply with the limits for a Class A digital device pursuant to part 15 of the FCC Rules These limits are designed to provide reasonable protection against harmful interference when the equipment is operated in commercial environment This equipment generates uses and can radiate radio frequency energy and if not installed and used in accordance with the instruction manual may cause harmful interference to radio communications Operation of this equipment in a residential area is likely to cause harmful interference at his own expense WARNING TO USER Change or modifications not expressly approved the manufacturer can void the user s authority to operate this equipment 9 CONTEC COM IPD FIT GY 5 1 Before Using the Pro
Download Pdf Manuals
Related Search
Related Contents
Aprovação para atmosferas explosivas do INMETRO para do 見える化の徹底活用 - e家カルテ・エコノミー Télécharger la brochure Genesis Native CTL-SYNC Owner`s Manual Doppler Radar for Biomedical Measurements - 2004 American Standard Colony Soft 3875.401 User's Manual Panorama Cyc 250 ita PDFファイル Copyright © All rights reserved.
Failed to retrieve file