The text of a manual · part 18 of 23
Owner's Manual: BayTech M Series DAC, pages 171 to 180
Pages 171 to 180 of 229
The original document is the PDF (499 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the BayTech M3 DAC
Page 171
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________
REPORT INTERVAL You may program the PDI to report in repetitive periods using Schedule Reporting Method, where the PDI will report all event samples in the receive buffer after the specified Report Interval has elapsed. The PDI will report until the buffer is empty and then report again after the specified Report Interval has expired. The default Report Interval is 00:00 (every 24 hours). HOST ADDRESS Host Address is the designated host module where event samples are sent when using Immediate or Schedule Reporting Method. The Host Address consists of the Unit Number (1 to 32), Module Number (1 to 16), and Port Number (1 to 4) of the designated host module. The default Host Address is Unit 1, Module 1, Port 1. TIME TAG When Time Tag is enabled, a time tag is appended immediately after the event sample. The time tag consists of the month, day, year, hour, minute, and second at which the data was calculated. Time Tag may be enabled or disabled. The default Time Tag is disabled. TERMINATING CHARACTER(S) The Terminating Character(s) is added at the end of an event sample to match the requirements of the host terminal or application software. The Terminating Character(s) consists of one or two hexadecimal characters. The default Terminating Characters are 0D Hex <cr> followed by 0A Hex <lf>. DYNAMIC CONFIGURATION You may enable or disable Dynamic Configuration for the PDI. Dynamic configuration mode allows non-verbose or "on-the-fly" configuration commands to be issued to the PDI. The default Dynamic Configuration setting is disabled. DATA COMMANDS You may issue PDI data commands through a host module to perform single operations while temporarily overriding the module's current operating configuration. Some data commands apply to all types of DAC modules, while others apply to
159
Page 172
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ specific modules. Data commands may be entered repeatedly to get specific event samples. You may issue a single data command to obtain event samples from multiple channels. Data commands must be used to obtain event samples when using Command Reporting Method. PDI data commands are sent through a host module using the following procedure: 1.
Select the PDI from the host module by sending a select sequence which consists of the port select code ($BT - default), the desired module number (2 to 16), and a <cr> (0D Hex). For example, to select an PDI Module located in slot 15 using the default port select code, send $BT15<cr>.
2.
Once the PDI is selected, it will go into Command Mode and allow you to send data commands. The PDI data commands begin with two capital letters designating the specific command and are terminated with a <cr>. Most data commands also require a number between the command letters and <cr>. This number is typically the desired channel(s) for the data command. If you have a requirement to send the data command to multiple channels simultaneously, you may use one of the following formats as shown for the SA (sample) command: SA1,2,3,4,5,6,7,8<cr> SA1-8<cr> SA/0<cr> SA1,2,4-8<cr>
3.
Take a single sample for Ports 1-8 Take a single sample for Ports 1-8 Take a single sample for Ports 1-8 Take a single sample for Ports 1, 3, 4, 5, 6, 7, and 8
After you have sent the desired data commands to the PDI module, you may disconnect by sending $BT<cr>. You may disconnect from the PDI and select a different module or the base unit by sending $BTn<cr.
IMPORTANT: If the PDI is operating in self reporting mode (i.e., Immediate or Schedule Reporting Method) and a host device issues a data command, the host device must disconnect by sending the Port Select Code and <cr> before the PDI will resume sending event samples to the designated host module. CLEAR EVENT BUFFER COMMAND
160
Page 173
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________
The Clear Event Buffer (CB) command is used to clear all stored event samples from the buffer of the selected channel(s). The Clear Event Buffer command has the following format: CBn<cr> where n = Channel# (1 to 16 or 0 for all). CLEAR EVENT COUNTER COMMAND The Clear Event Counter (CC) command is used to reset the event counter for one or more channels to zero without reading the value of the event counter. The Clear Event Counter command has the following format: CCn<cr>
Where n = Channel# (1 to 16 or 0 for all). CLEAR EVENT LATCH DATA The Clear Event Counter (CR) command is used to clear the event latch buffer. The Clear Event Counter command has the following format: CRn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT ALL BUFFERED EVENTS COMMAND The Report All Buffered Events (RA) command instructs the PDI to report all event samples currently stored in the buffer of the selected channel(s). The Report All Buffered Events command has the following format: RAn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT EVENT COUNTER COMMAND The Report Event Counter (RC) command instructs the PDI to report how many times an event has occurred for one or more channels since the last time a counter reset command was issued. This command does not reset the event counter. The Report Event Counter command has the following format:
161
Page 174
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ RCn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT EVENT DURATION COMMAND The Report Event Duration (RD) command instructs the PDI to report how long the most recent recorded event for the selected channel(s) lasted. The Report Event Duration command has the following format: RDn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT EVENT LATCH DATA COMMAND The Report Event Latch Data (RL) command instructs the PDI to report the active state of the initial event and the time the initial event occurred (if time tagging is enabled). This command does not reset the latch buffer. The Report Event Latch Data has the following format: RLn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT EVENT COUNTER AND RESET COMMAND The Report Event Counter and Reset (RO) command instructs the PDI to report how many times an event has occurred for one or more channels and then reset the event counter to zero. The Report Event Counter and Reset command has the following format: ROn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT EVENT LATCH DATA AND RESET COMMAND The Report Event Latch Data and Reset (RR) command instructs the PDI to report the active state of the initial event, the time the initial event occurred (if time tagging is enabled), and then reset the latch buffer. The Report Event Latch Data and Reset command has the following format:
162
Page 175
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ RRn<cr> where n = Channel# (1 to 16 or 0 for all). REPORT A SINGLE BUFFERED EVENT COMMAND The Report A Single Buffered Event (RS) command instructs the PDI to report the first event sample stored in the buffer of the selected channel(s). The Report A Single Buffer Sample command has the following format: RSn<cr> where n = Channel# (1 to 16 or 0 for all). EVENT SAMPLE REPORTING An event is defined as a change-in-state of an input channel and return to the original state. An event may be started on a rising edge (LO to HI) or a falling edge (HI to LO) as determined by the Latch Polarity. On the V79 PDI-1 switch closure module, an input is considered to be at a "HI" or "1" state when it is closed (continuity) and a "LO" or "0" state when it is open (infinite resistance). On the V80 PDI-2 optically isolated module, an input is considered to be at a "HI" or "1" state when there is voltage detected and a "LO" or "0" state whenever there is no voltage detected. An event sample is the actual data associated with an event which is calculated by the PDI module and sent to the host computer/controller PDI event sample reporting depends on the Reporting Method used. When using Immediate Reporting Method, the PDI will report an event sample whenever an event occurs. When using Schedule Reporting Method, the PDI will report an event sample whenever a event occurs after the Report Start Time has elapsed. When using Command Reporting Method, the PDI will report an event sample or multiple samples on command only. The PDI module can observe, record, and report when an event happened, how long the event lasted, and how many events occurred for each individual channel. The initial occurrence of an event will set the event latch bit and store the associated time in the latch buffer. You may read the state of the initial event and the time it was recorded (if time tagging is enabled) by issuing the RL or RR commands. Each occurrence of an event starts the duration counter and increments the event counter. The duration counter measures event duration time in milliseconds with a maximum time of 65,535 stored. You may read the duration of the last recorded event by issuing the RD command.
163
Page 176
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________
NOTE: Duration measurements are not de-bounced. If the input circuit cycles between active and inactive before settling, only the settled value is reported. Therefore, if a PDI module is connected to a relay or switch that has "dirty" contacts, the total measurement will be less than the actual activation duration of the circuit by the amount of time spent settling. The event counter reflects the total number of events that have occurred since the event counter was last cleared using the CC or RO command. You may read the current event counter value by sending the RC or RO command. The event counter will trigger on the rising edge of an event when LO to HI Latch Polarity is selected or on the falling edge of an event when HI to LO Latch Polarity is selected. Examples of using the event counter would include counting items moving on a conveyor belt and process control where a pre-determined number of events must take place before a defined action may take place. NOTE: An event must have a duration greater than one millisecond plus the current debounce delay time to increment the event counter. EVENT SAMPLE PRESENTATION Event Sample presentation varies slightly in format depending on module configuration. Entries such as, time tag, data format, number of active channels, etc. all change how event samples appear to a host-controller. However, all event samples are presented in the same basic order of fields as follows: UU:MM,CC 1 or 0 MM/DD/YY HH:MM:SS where, UU is the M Series Unit Number MM is the PDI Module Number CC is the PDI Channel Number 1 channel status is "closed" (V79 PDI-1) or has voltage applied (V80 PDI-2) 0 channel status is "open" (V80 PDI-2) or has no voltage applied (V80 PDI-2) MM is the month (if Time Tag enabled) DD is the day (if Time Tag enabled) YY is the year (if Time Tag enabled) HH is the hour (if Time Tag enabled) MM is the minute (if Time Tag enabled) SS is the second (if Time Tag enabled) The following example shows event samples received using immediate or schedule reporting where the PDI is installed in Unit 1 Module 15 with Time Tagging enabled:
164
Page 177
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________
1:15,1 1 11/18/93 09:12:22<cr><lf> 1:15,2 1 11/18/93 09:12:22<cr><lf> UNIT MODULE CHANNEL CHANNEL STATUS DATE TIME The following examples show the messages received using data commands where the PDI is installed in Unit 1 Module 15 with time tagging enabled. If you select the module and issue the RD1<cr> command (Report Event Duration for Channel 1), the module will respond with a single message showing the Event Duration for Channel 1 similar to the following: 1:15,1 1320 11/18/93 09:12:22 where 1:15,1 represents Unit 1/Module 15/Channel 1, 1320 indicates the event duration is 1320 milliseconds, and 11/18/93 09:12:22 is the time tag. If you issue the RC1<cr> command (Report Event Counter for Channel 1), the module will respond with a message showing the Event Counter similar to the following: 1:15,1 823 11/18/93 09:12:22 where 1:15,1 represents Unit 1/Module 15/Channel 1, 823 indicates the number of recorded events is 823 times, and 11/18/93 09:12:22 is the time tag. If you issue the RS1<cr> command (Report Single Buffered Event for Channel 1), the module will respond with a message showing the input status for Channel 1 similar to the following: 1:15,1 1 11/18/93 09:12:22 where 1:15,1 represents Unit 1/Module 15/Channel 1, 1 indicates the first buffered sample for Channel 1 is closed (V79 PDI-1) or has voltage applied (V80 PDI-2), and 11/18/93 09:12:22 is the time tag. If you issue the RL1<cr> command (Report Event Latch Data for Channel 1), the module will respond with a message showing the state of the input that started the
165
Page 178
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ initial event. This will be "1" (closed) for LO to HI Latch Polarity or "0" (open) for HI to LO Latch Polarity if using the V79 PDI-1. This will be "1" (voltage detected) for LO to HI Latch Polartiy or "0" (no voltage detected) for HI to LO Latch Polarity if using the V80 PDI-2. If time tagging is enabled, the time the initial event occurred will be appended to the event sample. V82 OPERATION The V82 Programmable Control Module (PCM-1) is used to monitor, control, and report information about devices connected to the M-Series peripheral modules. The M-Series peripheral modules are used to interface directly to various devices such as security/alarm systems, process control systems, medical data systems, and environmental control systems. Bay Tech provides C library functions specific to the various peripheral modules. These functions allow you to write C programs to perform data acquisition and control applications such as process control, remote control and monitoring and data gathering. Programming the V82 PCM-1 is accomplished by writing a C-based source program, compiling and linking this program for use on the 64180 microprocessor, and downloading the corresponding HEX file to the flash EPROM. The C library functions provided are specific for the 2500AD software, Inc. 64180 C compiler. IMPORTANT: Before you begin writing your source program, you should determine what types of peripheral modules are installed in the M-Series chassis. You should note the module location where the peripheral modules are installed (Module 1 to Module 16). You should also familiarize yourself with the basic operation of the peripheral modules. All source programs should have a “.C” extension (e.g., BAYTECH.C). 1. The name of the prototype header file is “cstartup.h”. The functions included in this file are listed below: int delay(unsigned int); char *ctime(); int serout(int,int,char *); int serin(int, int, char *); int charsout(int, int, char *); int charsin(int, int, char *); int dial(int, int, char *); int hang_up(int, int); int atod(int, int, char *);
166
Page 179
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ int disc_in(int, int); int rlyset(int, int); int rlyrst(int, int); 2. Once you have written your source code, you should compile it using the 2500AD 64180 C Compiler. When the 2500AD compiler goes into its linking procedure, it looks for a .LNK file. Bay Tech supplies a file named “T.LNK” that is used for this purpose. Below is an example batch file that will perform the necessary compile and link commands for the 2500AD compiler. C64180 –d %1 ADLINK t %1 For example, if the name of the batch file is “RUN.BAT” and the name of the source code is “BAYTECH.C”, then RUN BAYTECH from your DOS prompt and the 2500AD compiler will compile and link the source file. Do not include the “.C” suffix when typing RUN BAYTECH. Once the source program has been compiled and linked, the 2500AD compiler will create a file called “BAYTECH.HEX” which is used to actually program the V82 PCM-1 as described below. 3. Downloading a HEX file to the module while it is in configuration mode programs the V82 PCM-1. The HEX file is generated after the source file has been compiled and linked. Use the following procedure to place the V82 PCM-1 into configuration mode: 3a. Programming changes are made from the service port, a V71 host module, or a V93 modem module. If you are using the service port or a V71 host module, connect a terminal to the service port or V71. Configure the terminal’s serial parameters to match those of the service port or V71. The default parameters for both ports are 9600 bps, 8 data bits, 1 stop bit, and no parity. The service port is fixed at these parameters. The V71’s parameters can be changed. If you are using the V93 host modem module, make a connection with the V93 modem over a dial-up line. Enter the appropriate password if the V93 Password is enabled. 3b. Place the V82 PCM-1 into command mode by sending the Port Select Code (default is $BT), the appropriate Unit Number followed by a colon (1: to 30: - only if using a cascading
167
Page 180
M SERIES DAC BASE UNIT AND MODULE OPERATION ____________________________________________________________________________ application), the appropriate module number (1 to 16), and <cr>. 3c. Access configuration mode by sending $CONFIG <cr>. Once the V82-PCM-1 is in configuration mode, download the created HEX file. This can be done using a communications package or via DOS commands. For example, if using DOS, you can create a batch file to send the necessary commands similar to the following: ECHO $BT>COM1: ECHO $CONFIG>COM1: COPY BAYTECH>HEX /B COM1: In this example, the file created when the source code was compiled and linked was named BAYTECH.HEX. Once the HEX file has been downloaded to the V82 PCM-1 flash EPROM, the M<-series DAC unit will reset and the new program becomes effective. IMPORTANT: If your program inputs data from a V71 or V93 host module (e.g., serin(1, 1, data); where Module 1 is a V71 host module), you must make a connection to the V82 PCM-1 module Port 2 from the host module before performing any data acquisition. For example, if the V82-PCM-1 is installed as Module 4, send$BT4,2<cr> to the host module to make the necessary connection to the V82 PCM-1. 4. Function Descriptions: 4a. int delay(unsigned int a) Input: a - delay interval Output: 0 – successful Description: The delay(…) function halts program execution for a specified number of milliseconds. Example: int get_connect(); int got_connect; * *
168