Home

to USER MANUAL for ADR2205

image

Contents

1. K2 KO are de energized K6 K5 K4 K1 are energized RPKn Returns status of relay specified by n n 0 to 7 example RPK4 lt CR gt 1 K4 is energized contact closed ONTRAK CONTROL SYSTEMS INC 7 21 www ontrak net PK example Returns status of all relays in decimal format PK lt CR gt 128 K7 is energized PK6 thru PKO are de energized b Digital Input Commands There are four digital inputs on the ADR2205 labeled PAO to PA3 PORT A There are three commands provided to read the status of the inputs in various formats RPA example RPAn example PA example Returns status of all input lines in PORT A in binary format Order is MSB LSB RPA lt CR gt 0111 PA2 PA1 PAO are high PA3 is low Returns status of input line in PORT A specified by n n 0 to 3 RPA2 CR 1 PA2 is high Returns status of PORT A in decimal format PA CR 15 All inputs are high c Event Counter Commands The ADR2205 is equipped with a 16 bit event counter that accepts TTL or contact input There are three commands available to read and clear the event counter If the maximum count of 65535 is reached the counter will rollover to 00000 RE example CE example REC example ONTRAK CONTROL SYSTEMS INC 8 21 www ontrak net Returns decimal value of event counter RE lt CR gt 00456 Present count is 456 Clears event counter CE lt CR gt Event count
2. The event counter can be configured to accept TTL or dry contact inputs TTL type inputs may be connected directly to the ECA input while dry contacts must be connected between GND and the ECA input ECA is connected to the 5VDC supply via a 15K ohm pull up resistor NOTE C7 is a 0 1uF debounce capacitor for use with dry contact inputs This capacitor must be removed if the input signal is a TTL type Events are counted on the rising edge of the input which is when the TTL signal switches from low to high or the dry contact opens q of q HUHUHUUUHHUuL 00 q removed H n 068290926282 292222 hr K1 K2 m 19 gt INPUT li Contact TTI L Input Input Signal gee ow ou Figure 9 Typical Event Counter Connections Note The ADR2205 is shipped with C7 installed ONTRAK CONTROL SYSTEMS INC 16 21 www ontrak net The following sample BASIC program reads the count input and displays the count result continuously on the video screen 10 1 9600 8 1 5 5 5 AS 1 open com port 20 CLS clear screen 30 LOCATE 1 1 locate cursor 40 PRINT 1 CE clears event counter 50 PRINT PRESENT COUNT IS COUNT displays co
3. IAI Sets interrupt mode to active low Default A LOW signal generates an interrupt Tinnnnn Loads event counter trigger value nnnnn 0 to 65536 example TL10500 lt CR gt Event counter trigger is set to 10500 TS Returns event counter trigger value Example TS lt CR gt 10500 Trigger is currently set at 10500 e ID Command IDN Returns ID code 2205 may be omitted ONTRAK CONTROL SYSTEMS INC 9 21 www ontrak net f Watchdog Commands The ADR2205 is equipped with a host watchdog timer that allows the ADR2205 to reset when host communications is lost for a specific amount of time When enabled the watch dog timer counts down from a user specified value 1 to 255 seconds and resets the ADR2205 to the power up State if no commands valid or invalid are received from the host WE Enables the watchdog timer WD Disables the watchdog timer WR Returns status of watchdog timer 0 if disabled 1 if enabled MWddd Loads watchdog timer register with timeout value in seconds ddd 001 to 255 The default value is 5 seconds PW Returns watchdog timer timeout setting Notes To Operation 1 Upon timeout the ADR2205 is reset to the power up state with interrupts disabled watchdog disabled and all relay outputs OFF Also the timeout value is set to the default setting of 5 seconds 2 The watchdog status bit can be read Using the WR command by the host to determine if a watchdog
4. 3 ADR2205 COMMANDS a Relay Output Commands There are 8 relays outputs on the ADR2205 labeled KO K7 They can be controlled individually or as a port PORT K The following commands allow relays to be individually set or reset or the whole port to be configured with a single command Three commands also allow the reading of the relay status and are provided for applications where confirmation of commands is required SKn Sets closes contact of relay specified by n in port K n 0 7 example SK3 lt cr gt Relay K3 is energized and its contacts close RKn Resets opens contact of relay specified by n in port K n20 7 example RKO lt cr gt Relay KO is de energized and its contacts open SPKxxxxxxxx Outputs binary data to PORT K All eight bits must be specified Order is MSB LSB x 1 to set relay or 0 to reset relay example SPA10101000 lt CR gt Relays K7 K5 and K3 are energized contacts close and relays K6 K4 K2 K1 and KO are de energized contacts open Mkddd Outputs decimal data ddd to PORT K Relays are set or reset depending on binary equivalent of ddd ddd 000 to 255 example MK255 lt CR gt All Relays are energized contacts close NOTE The following three commands allow reading of the status of the relays and are provided for use if verification of commands is desired RPK Returns status of all Relays in binary format Order is MSB LSB example RPK lt CR gt 01110010
5. 5VDC 10 or 7 15VDC Supply Current 20mA Typical 40mA Maximum Relays De energized Supply Current 170mA Typical 200mA Maximum All Relays Energized Operating Temperature 0 50C Contact Outputs 8 Type SPST AC Rating 5 0 Amp 120 VAC Max DC Rating 5 0Amp 30VDC Max Relay Approvals UL CSA TUV Mechanical Life 5 000 000 Operation Minimum Electrical 100 000 Operations Minimum at full load Digital Inputs 4 Type TTL or Contact or up to 24VDC weak pull up Input Voltage High 2 00V minimum Input Voltage Low 0 7V maximum Event Counter 1 Type TTL or Contact Resolution 16 bits Communication Interface RS232 and RS485 9600 baud 8 bit words no parity 1 start bit Daisy chain via RS485 Visit our web site at http www ontrak net for additional applications and programming examples ONTRAK CONTROL SYSTEMS INC 20 21 www ontrak net APPENDIX C MOUNTING DIMENSIONS ADR Interface Mounting Dimensions inches 4 3 0 gt E o ADR101 ADR112 Ext Dim 3 0X 2 8 PME Hole Pat 2 6X2 4 Hole Dia 0 125 v1 FRONT 4 5 4 ADR2000A ADR2000B A 5 0 ADR2100 ADR2010 ADR2200 dka Ext Dim 5 4 X 2 8 Hole Pat 5 0 X 2 4 A Hole Dia 0 125 Y FRONT 4 7 8 ADRTERM 1 5 11 34 Hole Pat 7 4 X 1 1 7 4 ox EROR Hole Dia 0 125 ONTRAK CONTROL SYSTEMS INC 21 21 www ontrak net
6. timeout has occurred ONTRAK CONTROL SYSTEMS INC 10 21 www ontrak net 4 Sending Commands in BASIC to the ADR2205 OPENING A SERIAL FILE Commands may be sent to the ADR2205 using a terminal emulation program such as Hyperterminal by simply typing commands and pressing lt cr gt With BASIC the ADR2205 is connected to the computer via a serial cable and BASIC treats the ADR2205 as a serial file Before commands can be sent to the ADR2205 this serial file must be opened and initialized This should be done at the start of any program that is to access the ADR2205 The command to open a serial file is shown below 10 OPEN COM1 9600 n 8 1 CS DS RS AS 1 This line opens a serial file and labels it as serial file 1 This allows access to the ADR2205 using PRINT 1 and INPUT 1 commands SENDING COMMANDS Sending commands in BASIC to the ADR2205 can be done using PRINT 1 commands For example sending an RKO command could be done as shown below 20 PRINT 1 RKO Extra spaces inside the quotes are ignored by the ADR2205 Avoid sending commands on consecutive lines because a CR is not sent after the first command resulting in an unrecognized command A REM statement should be inserted between consecutive PRINT 1 commands as shown below 20 PRINT 1 SKO 30 REM FORCES CR 40 PRINT 1 RK6 Variable names may also be used with PRINT 1 commands One example of this shown below This program turns on each relay in sequence
7. ADR2205 RS232 RS485 RELAY I O INTERFACE USER MANUAL V1 0 Caution The ADR2205 is a static sensitive device Observe proper procedures for handling static sensitive devices ONTRAK CONTROL SYSTEMS INC 764 Notre Dame Avenue Unit 1 Sudbury Ontario CANADA P3A 2T2 705 671 2652 VOICE 705 671 6127 FAX www ontrak net WEB Ontrak Control Systems Inc reserves the right to change product specifications to improve the product Although every attempt has been made to insure accuracy of information contained in this manual Ontrak Control Systems Inc assumes no liability for inadvertent errors Warranty This ADR2205 is warranted from defects in workmanship and materials for a period of 90 days Liability for defects is limited to the purchase price of the product This warranty shall not apply to defects resulting from improper modifications or use outside published specifications Hyperterminal and Windows are trademarks of Microsoft Corporation APPLE MACINTOSH and MAC are trademarks of Apple Computer Inc PC XT AT PS 2 are trademarks of International Business Machines Inc COPYRIGHT 2001 ONTRAK CONTROL SYSTEMS INC TABLE OF CONTENTS READ ME FIRST 3 1 Communication options a The ADR2205 RS232 Interface 4 b The ADR2205 RS485 Interface 5 2 Powering the ADR2205 5 3 ADR2205 Command Set 6 a Relay Output Commands 7 b Digital Input Commands 8 C Event Counter Commands 8 d Interrupt Commands 9
8. NTROL SYSTEMS INC 12 21 www ontrak net RECEIVING DATA FROM THE ADR2205 If a command sent to the ADR2205 is a responsive command that is one that results in data being sent back to the host the data is retrieved using the fscanf command After this command is used the serial buffer must be re initialized using the rewind command The syntax for this command is rewind stdaux This command is executed after data is retrieved using the fscanf command For example the following commands send a RPAO command and stores the retrieved data in an integer variable named PAO fprintf stdaux RPAO XD fscanf stdaux 96D amp PAO0 rewind stdaux In this example the command PA read port A Jis sent to the ADR2205 and the retrieved data is stored in an integer variable named PORTA fprintf stdaux PA XD fscanf stdaux 96D amp PORTA rewind stdaux Visit our web page at www ontrak net for additional programming examples in BASIC Visual Basic C Labview and TestPoint ONTRAK CONTROL SYSTEMS INC 13 21 www ontrak net 6 Daisy Chain Options for the ADR2205 Daisy chaining ADR2205 series boards involves three steps A Setting Address Jumpers B Physically Connecting Boards C Sending commands A Setting Address Jumpers The ADR2205 can be daisy chained regardless of the type of serial interface provided by the host computer Each board on the chain must be assigned an address via the BCD address jum
9. PAO lt cr gt is sent To set K4 on board 7 the command 7SK4 lt cr gt is sent Spaces sent between the board address and commands are ignored Board zero will respond to both commands with no preceding address and commands preceded with a zero for reasons of continuity Never connect two boards with the same address on the same chain This will result in both boards responding at the same time and will cause contention on the network with possible damage to the ADR boards 7 Relay Output Connections There are eight N O relay outputs on the ADR2205 labeled KO thru K7 The relays are capable of switching up to 5A4mps 30VDC or 5Amps 120VAC Connections of AC or DC loads are made to TB1 RENN 2d c 909090908906 yo v wy wpe RELAY OUTPUT POWER Figure 7 Typical Relay Contact Connection ONTRAK CONTROL SYSTEMS INC 15 21 www ontrak net 8 Digital Input Connections The four digital inputs on the ADR2205 have pull up resistors built in allowing direct connection of dry contact inputs from any source including switches and relays TTL signal sources including TTL or NPN type proximity sensors can also be directly connected to PAO thru 222222222 ADR2205 909090906506 090606060606 rici woe vow ow wes Figure 8 Typical Digital Input Connections 9 Event Counter Connections
10. R2205 may also be supplied via the daisy chain cable See the Daisy chaining section of this manual for further information POWER UP USING A 5 VOLT REGULATED SUPPLY If the ADR2205 is to be powered using a regulated 5 volt power supply the 5VDC and GND connections are to be made to the ADR2205 via the main terminal block TB1 The supply must be able to provide a minimum of 200mA Care must be taken to avoid improper power supply connection as permanent damage to the ADR2205 may result if connected improperly No connection to J2 is to be made if the ADR2205 is powered by a regulated 5 volt supply POWER UP USING A WALL ADAPTOR The ADR2205 has an on board 5 volt regulator allowing the use of a 9 volt wall adaptor to power the internal circuits The regulator should be able to provide from 300 500mA MODE 68 950 1 The regulator must have a standard 2 1mm center negative coaxial connector The connector can then be inserted into J2 on the ADR2205 When the ADR2205 is powered by a wall adaptor the on board regulator also may provide a regulated 5 volts DC out to provide power to external circuits This 5 volt supply is available on TB1 The amount of current available depends on the number of relays to be energized at one time For safe operation no more than 50mA should be drawn from the power terminals to power external circuits ONTRAK CONTROL SYSTEMS INC 5 21 www ontrak net RELAY OUTPUT COMMAND SUMMARY SKn Sets closes contact Re
11. TERFACE The ADR2205 communicates via a standard RS232 port utilizing a simple three wire interface The only signals used are received data RC transmitted data TX and ground GND Most RS232 ports use hardware handshaking i e DTR DSR CTS RTS signals to control the flow of data on the port For this reason the cable required to connect to the ADR2205 must have jumpers on the DB9S end to satisfy these handshaking requirements IBM or compatible computers may be used as a host computer with the supplied cable The supplied cable has the following connections ADR IBM etc DB9P male 95 female RC 3 RED 3 TX TX 7 WHITE 2 RC GND 2 BLACK 5 GND r 7 RTS 8 CTS r 1 DCD 6 DSR 4 DTR Figure 1 Supplied Cable Wiring Diagram If the host computer has a 25 pin serial port connector a 9 pin to 25 pin adapter cable will be required to connect to the ADR2205 cable This adaptor is available at most computer dealers If the host computer has a female DB9 connector a male to male adapter is required to use the supplied cable This may be purchased at most computer dealers Apple Macintosh computers may be connected to the ADR2205 using MAC to DB9 DTE conversion cable Once connected to the RS232 based host computer or terminal the RS232 port should be configured to the following specifications to allow communication with the ADR2205 9600 baud 8 bit words 1 stop bit no parity If using BASIC or C c
12. an be connected from J3 to either J1 or J3 on additional ADR2205 interfaces Both J1 and J3 have identical pinouts for RS485 and power signals used for daisy chain applications Figure 5c shows a typical daisy chain application If a Powered daisy chain cable is used power need only be connected to J2 on any one ADR2205 in the chain To Host To Additional ADR s L Tj EEN ne ADR2205 IU oro sss n ADR2205 sss 0 eo eee L 31 nnnnnnnnn T Ae PORES n P p HENARES Lo L 90 Jd be DEBE REY cum 8 5 00 di Too oor cm 18 gt D PO e CH Ig POLI e i Ee aan SSS 26006060262626 060606260626 060062600626906 062626262626 y yY ee Ye wes y Figure 5c Typical Daisy Chain Application C Sending Commands Once a board is jumpered it will respond only to commands preceded by its address as a single digit integer number For example to read PAO on board 3 the command 3R
13. e ID Command 9 f Watchdog Commands 10 4 Using BASIC with ADR Products 11 5 Using TURBO C with ADR Products 12 6 Daisy Chain Options for the ADR2205 14 7 Relay Output Connections 15 8 Digital Input Connections 16 9 Event Counter Connections 16 10 Using Interrupt Functions 17 APPENDIX A CONNECTION DIAGRAM 19 B ELECTRICAL SPECIFICATIONS 20 C MOUNTING DIMENSIONS 21 ONTRAK CONTROL SYSTEMS INC 2 21 www ontrak net READ ME FIRST Thank you for purchasing this ADR2205 Relay I O Interface There are three steps to using the ADR2205 1 Connecting your computer or terminal to the ADR2205 2 Providing power to the ADR2205 3 Sending commands to the ADR2205 This manual will provide guidance for completing these steps along with BASIC and TURBO C programming tips Additional applications and programming examples are available on our web page at http www ontrak net FEATURES 8 contact outputs 5amps 120VAC 5amps 30VDC 4 digital inputs 16 bit contact or TTL input event counter interrupt capabilities on all inputs to eliminate polling on board RS232 to RS485 converter daisy chainable up to 10 boards daisy chainable power supply programmable watchdog timer power up via standard wall adapter optional simple yet versatile commands easy to use with Visual BASIC or TURBO C programs compatible with all ADR2000 series interfaces ONTRAK CONTROL SYSTEMS INC 3 21 www ontrak net 1a THE ADR2205 RS232 IN
14. er is cleared to 00000 Reads and clears event counter REC lt CR gt 12034 Count is returned 12034 and counter is reset to 00000 d Interrupt Commands ADR2205 has four digital input lines PAO PA1 PA2 PA3 that can be used to provide interrupt to the host when an input is active Additionally a sixteen bit trigger register can be loaded to provide an interrupt when the event counter reaches a specific count All inputs have built in pull up resistors tied to the 5 volt supply When interrupts are enabled bringing any line active or when the event counter reaches the trigger value a two digit value is returned to the host The first digit is the board address 0 9 and the second identifies the source of the interrupt 1 for PAO 2 for PA1 3 for PA2 4 for PA3 and 5 for an event counter match For example an interrupt on PAO on board 0 returns 01 an event counter match on board 3 returns 35 Interrupts generated at the same instant will be returned with highest priority given to PAO followed by PA1 PA2 PA3 and lastly an event counter match All interrupts are disabled on power up See the applications section titled Using Interrupt Functions for further details The Interrupt commands are IE Enables all interrupts ID Disables all interrupts IS Returns status of interrupts 0 if disabled 1 if enabled IAH Sets interrupt mode to active high A HIGH signal generates an interrupt
15. example it was not required as only one interrupt was possible at one time The counter interrupt 05 was not enabled until the switch interrupt 03 was received ONTRAK CONTROL SYSTEMS INC 18 21 www ontrak net APPENDIX A CONNECTION DIAGRAM J1 RS232 RS485 1 GND J3 2 GND RS485 3 RC RS232 1 GND 4 and 8 TR RS485 2 GND J2 5 and 9 TR RS485 4 and 8 TR RS485 7 45vypc 6 VDC 5 and 9 TR RS485 24mm 0188232 6 VDC Center Negative O poo oon O ADR2205 tuve ium ie 5721 C2001 ONTRAK CONTROL SYSTEMS i E nnnn ono UU ADDRESS 00 LT OU OU ole rene e U mna 909090609206 gers g gj yH 4H hj QH hp GH HH hp gt X ko K1 K2 K3 K4 K5 3 INPUT RELAY OUTPUT POWER ONTRAK CONTROL SYSTEMS INC 19 21 www ontrak net APPENDIX B ELECTRICAL SPECIFICATIONS ADR2205 Supply Voltage
16. lay specified by n n 0 to 7 RKn Resets opens contact Relay specified by n n 0 to 7 SPKxxxxxxxx Output binary data to Relay PORT K x 1 MKddd Outputs decimal data ddd to Relay PORT K ddd 0 to 255 RPK Returns status of all Relays in PORT K in binary format RPKn Returns status of Relay specified by nin PORT K n 0 07 PK Returns status of Relay PORT K in decimal format DIGITAL INPUT COMMAND SUMMARY RPA Returns status of all I O lines in PORT A in binary format RPAn Returns status of I O line specified by n n 0 to 3 PA Returns status of PORT A in decimal format EVENT COUNTER COMMAND SUMMARY CE Clear event counter RE Returns present count of event counter REC Returns present count of event counter and clears event counter INTERRUPT COMMAND SUMMARY IE Enable Interrupts ID Disable Interrupts IS Returns Interrupt Status 1 if enabled O if disabled TLnnnnn Loads Event Counter Trigger nnnnn 0 to 65535 TS Returns Event Counter Trigger Value IAH Sets Interrupt to active on HIGH input IAL Sets Interrupt to active on LOW input default WATCHDOG COMMAND SUMMARY WE Enables watchdog timer WD Disables watchdog timer WR Returns watchdog status 1 if enabled 0 if disabled MWddd Sets watchdog timeout to ddd seconds ddd 001 to 255 PW Returns watchdog timeout setting ID COMMAND IDN Returns 4 digit product identifier code ONTRAK CONTROL SYSTEMS INC 6 21 www ontrak net
17. onsult the appropriate section in this manual for details on how to configure your serial port If a terminal or terminal emulation program is used configure your terminal to the above specifications using the operations manual for your terminal equipment or terminal emulation program ONTRAK CONTROL SYSTEMS INC 4 21 www ontrak net 1b THE ADR2205 RS485 INTERFACE The ADR2205 5485 interface is a two wire connection meeting all the standards of the EIA RS485 interface specifications The supplied cable is NOT an RS485 cable To communicate via RS485 the host computer must have an RS485 port and be connected directly with two wires TR and TR A typical connection diagram is shown in figure 2 ADR Omega COM 485 DB9P male J1 or J3 DB9P male TX 5 8 TX TX 4 9 TX Figure 2 Typical RS485 Connection Note that both J1 and J3 are RS485 compatible ports Connection from the host to the ADR2205 should be made using J1 and then J3 is used to enable daisy chaining additional ADR2000 series products The host RS485 port should be configured with the following specifications to enable communications to the ADR2205 9600 Baud 8 bit words 1 stop bit no parity Line feeds should NOT be sent after commands as they may collide with data being returned from the ADR2205 2 PROVIDING POWER TO THE ADR2205 The ADR2205 may be powered using a regulated 5 volt power supply or a suitable wall adaptor Power to daisy chained AD
18. per block on the ADR2205 Up to ten boards may be daisy chained The following table shows how to jumper the address jumper block to select a board address Position 8 Position 4 Position 2 Position 1 Address OPEN OPEN OPEN JUMP 1 OPEN OPEN JUMP OPEN 2 EE OPEN JUMP OPEN JUMP 5 OPEN JUMP JUMP OPEN 6 ae ae ee Table 1 Address Jumper Settings B Physically Connecting Boards ADR2205 series interface boards have two DB9 connectors that allow daisy chaining The data format used in daisy chaining is RS485 regardless of the host communication type To connect boards on a chain a daisy chain cable must be constructed The cable must provide two connections for the RS485 signals A typical daisy chain cable is shown in Figure 5a DB9P male DB9P male TX 5 5 TX TX 4 4 TX Figure 5a Daisy chain cable Power may be shared in daisy chained ADR2205 series interfaces if two extra conductors are added to the daisy chain cable Care should be taken that the output current limitation on the power supply is not exceeded The connections for a powered daisy chain cable are shown in Figure 5B NOTE Power sharing is available only if power is applied via J2 7 15VDC ONTRAK CONTROL SYSTEMS INC 14 21 www ontrak net DB9P male DB9P male TX 5 5 TX T 4 4 TX 9VDC 6 6 9VDC GND 1 1 GND Figure 5b Powered Daisy Chain Cable The Daisy chain cable c
19. r value Notes To Operation 1 The IE command is used to enable all interrupts however the event counter match interrupt is not enabled unless a trigger value other than 0 is loaded into the trigger register using the TLnnnnn command The trigger register is loaded with 0 on power up To disable the event counter match interrupt an any time load the trigger register with 0 using the TLnnnnn command 2 The IS interrupt status command should be used following an ID interrupt disable command to verify interrupts have been disabled This may be required in cases where there is a possibility of an interrupt being generated when the ID command is issued The primary communication used by ADR2000 series interfaces is Half Duplex RS485 and interrupt data may collide with the ID command resulting in the ID command not being received by the ADR2205 3 Once an interrupt is generated and data is sent to the host no further interrupts will be generated by that particular input unless the IE command is sent When interrupt data is sent to the host that input is masked and the issuing the command IE is the only method to un mask the input ONTRAK CONTROL SYSTEMS INC 17 21 www ontrak net The following example shows use of the interrupts using Visual BASIC The application is a counter application which is initiated when an operator activates the Start Count button which is connected to PA2 At this point the event counter counts the pul
20. ses from the TTL compatible proximity detector and energizes KO when a count of 160 is reached ADR2205 DLA VAVAVIAVD AY 0906506060606 ow Wes m RELAY OUTPUT POWER HE 5 count L 2 ur 45 GND FAN 22 Compatible Inductive Prox RED Private Sub Start Click With MSComm1 Rem Ensure Relay is off Output RKO Chr 13 Rem Enable interrupts Output IE Chr 13 Rem Wait for interrupt from switch Do Dummy DoEvents Loop Until MSComm InBufferCount gt Rem Display interrupt in text window Text1 Text input Rem Clear event counter Output CE Chr 13 Rem Load trigger register with 160 enables counter interrupt Output TL160 Chr 13 Rem Wait for interrupt from event counter Do Dummy DoE vents Loop Until MSComm InBufferCount gt Rem Display interrupt in text window Text1 Text input Rem Energize relay KO Turns on RED lamp Output SKO Chr 13 End With End Sub Notes on operation of program 1 Waiting for interrupts requires a loop until 3 characters Interrupt Data CR are received by the serial input buffer 2 Interrupt data is retrieved to empty the input buffer and displayed in a text window for troubleshooting purposes 3 Interrupt data can be read as a variable and tested to determine source of interrupt In this
21. t fprintf and receive data through the serial port fscanf Commands used in TURBO C to access the ADR2205 require the following include files to be declared at the start of TURBO C programs include lt stdio h gt include lt bios h gt CONFIGURING THE SERIAL PORT The first step in accessing the ADR2205 via the serial port is configuring the serial port to the proper communication parameters which are 9600 baud 8 bit words no parity This is done using the bioscom command The syntax for this command is bioscom O settings com1 where settings is previously defined as HEX and com1 is defined as 0 Defining settings and com 1 should be done using define com1 0 define settings OxE3 These statements should be placed immediately following your include files The bioscom command needs only to be executed once before the ADR2205 is accessed SENDING COMMANDS TO THE ADR2205 To send commands to the ADR2205 the fprintf command is used For example the following command sends SKO Set relay KO command to the ADR2205 fprintf stdaux SKO xD The xD suffix sends a carriage return after the command which is needed by the ADR2205 to recognize a command Integer variables may also be used in the command line For example the following command sends a MKddd make port K ddd command where DOUT is a previously defined integer value of 0 to 255 fprintf stdaux MK d xD DOUT ONTRAK CO
22. unt data 60 PRINTZ1 RE isends RE command to ADR2205 70 INPUTZ1 COUNT retrieves count data 80 GOTO 50 repeat procedure 10 Using Interrupt Functions The ADR2205 has four digital input lines PAO PA1 PA2 PA3 that can be used to provide interrupt to the host when an input is active Additionally a sixteen bit trigger register can be loaded to provide an interrupt when the event counter reaches a specific count All inputs have built in pull up resistors tied to the 5 volt supply When interrupts are enabled bringing any line active or when the event counter reaches the trigger value a two digit value is returned to the host The first digit is the board address 0 9 and the second identifies the source of the interrupt 1 for PAO 2 for PA1 3 for PA2 4 for PA3 and 5 for an event counter match For example an interrupt on PAO on board 0 returns 01 an event counter match on board 3 returns 35 Interrupts generated at the same instant will be returned with highest priority given to PAO followed by PA1 PA2 PA3 and lastly an event counter match All interrupts are disabled on power up The Interrupt commands are IE Enables all interrupts ID Disables all interrupts IAH Sets interrupts to active HIGH IAL Sets interrupts to active LOW DEFAULT Is Returns status of interrupts 0 if disabled 1 if enabled Tinnnnn Loads event counter trigger value nnnnn 0 to 65536 TS Returns event counter trigge
23. with a slight delay determined by LINE 40 10 OPEN COM1 9600 n 8 1 CS DS RS AS 1 20 FOR X 0 to 7 30 PRINT 1 SK X 40 FOR D 1 to 100000 NEXT D 50 NEXT X 60 END RECEIVING DATA When reading the digital port event counter or relay status data is sent from the ADR2205 to the host computers serial buffer This data can be retrieved using INPUT 1 commands The INPUT 1 command should be used following PRINT 1 commands if data is expected to be sent by the ADR2205 If a single piece of data is expected then one variable name should be used with the INPUT 1 command If eight pieces of data are to be received as with the RPK command then eight variable names must be used with the INPUT 1 command Examples of both cases are shown below 20 PRINT 1 RPAO ONTRAK CONTROL SYSTEMS INC 11 21 www ontrak net 30 INPUT 1 PAODAT 40 PRINT 1 RPK 50 INPUT 1 K7STAT K6STAT K5STAT KASTAT K3STAT K2STAT K1STAT KOSTAT The variable names used in the INPUT 1 commands now contain the data sent by the ADR2205 The data can now be printed displayed saved or whatever is required by the application Visit our web page at www ontrak net for additional programming examples in BASIC Visual Basic and C 5 Sending Commands in TURBO C to the ADR2205 This section will demonstrate how to send and receive data from the ADR2205 using TURBO C It outlines the commands used to configure the serial port bioscom send data out through the serial por

Download Pdf Manuals

image

Related Search

Related Contents

Manual de Instalação Escad-up  Semelles KenkoStrides®  Rio Audio Rio 800 User's Manual  Metra Stereo Dash Kits Installation Instructions  TML1000  全体ページを見る(PDF:4.3MB)    BE-NL NX-10 User Manual.book  User instructions  Dossier de Presse  

Copyright © All rights reserved.
Failed to retrieve file