ProXR ManualTable of ContentsGetting Started with ProXRSending Commands to ProXR Series Relay ControllersRelay Control CommandsAnalog to Digital Conversion Command SetTimer CommandsProXR Configuration CommandsThe ProXR Graphical User Interface (GUI)Warranty and Legal InformationGetting Started With ProXRIntroduction to ProXRThe ProXR Series Relay Controllers allow you to send simple commands to activate relays, read the status of relays, activate up to 16 relay timers, and control up to 256 total relays using the XR Expansion Port. All relays are electronically latched, simply send a command to turn the relay on, send a different command to turn the relay off. You can send commands to activate relays, deactivate relays, control all the relays at one time, plus you can send commands that tell a relay to turn on for a few seconds, minutes, or hours. You can assign 16 timers to any of the 256 relays, and set the timers to go off after the duration has expired. This manual will detail the capabilities and requirements of your ProXR Relay Controller Hardware Requirements
IMPORTANT POWER SUPPLY REQUIREMENTS
Setup Instructions
About USB CommunicationsWhen you plug any USB device into a computer, the motherboard of your computer begins sending a series of data packets to the remote device, and the remote device MUST respond....constantly, and without interruption. If there is ever a interruption in the data flow between the USB to Serial converter and the motherboard, your application will stop, and your motherboard will kick the USB device off the computer. The device will go offline, and you won't be able to use it again until you unplug the device, and then plug it back in. With all of the glory of USB communications, there are two things that developers of the USB protocol did not account for 1) making it easy to use and implement for the causal programmer, and 2) the biggest problem we currently face: USB's inability to self correct. In other words, USB does not have any form of error checking built into the protocol. It is a Zero Tolerance protocol, and if anything goes wrong...its a one strike and your out kind of protocol. The most unforgiving of ALL computer to device communication technologies. You have likely experience this yourself, that thumb drive didn't work when you plugged it in, so you unplugged it and plugged it back in...then it was fine. Or maybe your webcam froze and would not work until you either unplugged it or restarted your computer. And for us, we face an even greater challenge with the addition of the potential exposure to Electro-Magnetic Interference. EMI causes fluctuations in the communications between the controller and the computer, causing the motherboard of the computer to kick the USB device off of the system. USB Relay Controllers should not be used in any applications that will introduce EMI such as controlling inductive loads. ProXR HardwareRelay Status LEDs
If more than one bank is present on the board the power and busy indicator will only light up on the first bank and the relay status LEDs will again start on the 3rd LED and will correspond to the relays in the corresponding bank. 12V Power Input
Run/Config Jumper
Temperature Sensor
ProXR Expansion PortsThe XR Expansion Port
The UXP Expansion Port
Not all boards come with a UXP Expansion Port, if your controller does not have UXP in the product code thenit will not have a UXP Port and instead will have 8 A/D inputs. Analog to Digital InputsIf your controller's product code does not have UXP in it then it has 8 Analog to Digital Converters Inputs. Analog Inputs allow this controller to read 8 different voltage levels or contact closures. Input voltage is between 0 and +5VDC. Do not exceed this voltage rating or damage to the CPU will result. Do not apply voltage to the A/D Inputs while the board is powered down or damage to the board will result. There are two types of A/D Input connectors that come with ProXR Series Relay Controllers. They both function the same and differ only in how the sensors connect to the board. *EDit need pics of both as well as short instructions. Boards with UXP in the part number will not have A/D inputs and instead will have a UXP Expansion Port, which can be used to add A/D capabilities if needed. Relay Specifications:
All ratings above are for Resistive Loads. Divide current switching capabilities by 2 for Inductive Loads. Inductive loads not recommended for 1A DPDT relay controller models. Relay Types
Relay Timing
Sending Commands to the ProXR Series Relay ControllersThe ProXR Series Controllers are capable of sending and receiving data via serial communications. ProXR Controllers are compatible with just about any computer or microcontroller ever produced, including the Macintosh, Amiga, Basic Stamp, and of course, Windows & DOS based machines. Regardless of the system you are using, you will need access to a programming language that supports program control of the serial port on your computer. A terminal program is not suitable for controlling NCD Devices unless it supports transmission of Binary ASCII Character Codes. Commands should be sent using ASCII character codes 0-255 rather than ASCII characters (A, B, C etc.). See "ASCII Codes vs. Characters". Most systems require you to open the appropriate serial port (COM port) prior to sending or receiving data. Because there are so many different ways to send and receive data from various languages on various platforms, we will provide generic instructions that can be easily converted to your favorite language. For example, if this manual says "Send ASCII 254", the user will need to translate this instruction into a command that is capable of sending ASCII character code 254. To Send ASCII 254 from Visual Basic, you will use the following line:
In Qbasic, you can send ASCII 254 using the following line of code:
Note that sending ASCII character code 254 is NOT the same as sending ASCII characters 2, 5, and 4 from a terminal program. Typing 2, 5, and 4 on the keyboard will transmit three ASCII character codes. In your program, you may want to ask ProXR Controllers for the current status of relays, just to confirm their activation. If so, your programming language will support commands for reading data from the serial port. For your convenience, we have provided several programming examples in Visual Basic 6 for controlling the ProXR Series Controller. These examples should greatly speed development time. You may want to visit www.IORelay.com for the latest software and programming examples. Programming examples for the ProXR Series are much more extensive for Visual Basic users than for any other programming language. If you are not a VB programmer, you may consider looking at the VB source code, as it is easily translated into other popular languages. Regardless of your programming background, the provided Visual Basic source code is very easy to understand and will likely resolve any communication questions you may have. VB programming examples may be viewed in any text editor. The ProXR Command SetThe ProXR Series Controllers support an extensive command set, used to control relays, set operation modes, and store and recall relay status. Most users will only use a few of the functions built into this controller. The best way to learn the capabilities of the ProXR series is to carefully read through the command set. The "plain English" examples provide a quick, easy to understand definition of each command. The number in blue to the left of each command indicates the ASCII character code that must be sent to issue the command. All commands must be preceded with ASCII character code 254 to place the device in command mode. See examples at right. Some commands require that you specify a Bank value from 0-32, selecting the relay bank you would like to control. A value of 0 selects all banks. Bank values of 1-4 control up to 32 On-Board relays. When powered up, the default Bank value in the controller is always 1. Understanding Relay Banks and Basic Control Concepts:A Relay Bank is Simply a Group of 8 Relays. The ProXR Series Controllers allow you to control up to 256 relays (32 relay banks). You control which bank of relays you are speaking to at all times. It is VERY IMPORTANT that you understand that there are two ways to specify which relay bank you are talking to. These topics will be discussed in greater length later in this manual, providing you with specific instructions and program examples. This page will help prepare you for seeing two different command that do the same thing. In this manual, you will see the work "Bank". This word should be equated to a number from 0 to 32. A value of 1 speaks to relay bank 1 (the first 8 relays on the board). A value of 2 speaks to relay bank 2 (the second group of 8 relays on the board). A value of 32 speaks to the last group of 8 relays (which is connected to the main controller using the XR expansion ports). A value of 0 speaks to all banks of relays at one time. When bank 0 is selected, you can then specify a command to turn on relay 1, and relay 1 on all relay banks will be activated. There will be more examples of this and detailed information on each command. But understanding the concept of controlling multiple relays across multiple banks is very important to your understanding how our controller command set is organized. Bank Directed Commands:
Bank Specified Commands:
ASCII Codes vs. CharactersThe differences between ASCII codes and ASCII characters tend to generate a lot of confusion among first-time programmers. It is important to understand that a computer only works with numbers. With regard to serial data, the computer is only capable of sending and receiving numbers from 0 to 255. What confuses people is the simple idea that the numbers 0 to 255 are assigned letters. For instance, the number 65 represents the letter A. The number 66 represents the letter B. Every character (including numbers and punctuation) is assigned a numeric value. This standard of assignments is called ASCII, and is a universal standard adopted by all computers with serial communications. ASCII characters codes can be clearly defined as numbers from 0 to 255. ASCII characters however are best defined as letters, A, B, C, D, as well as punctuation, !@#$%, and even the numbers 0-9. Virtually all programming languages permit you to send ASCII in the form of letters or numbers. If you wanted to send the word "Hello" out the serial port, it is much easier to send the letters H, e, l, l, and o than it is to send the ASCII character codes that represent each letter. For the purposes of controlling NCD devices however, it is much easier to build a numeric command set. Especially when communicating to devices where you want to speak to lots of outputs (which are numbered), inputs (which are also numbered), or control specific devices using their device number (from 0 to 255). Put simply, it is easier to control NCD devices using ASCII character codes 0 to 255 than it is to use ASCII characters A, B, C, D, etc. Because terminal programs are ASCII character based, it may be difficult to generate the proper series of keystrokes that would be necessary to activate a particular function. Therefore, they are not suitable for controlling NCD devices. In a real world control application, a terminal program would not likely be used to control NCD devices anyway. Therefore, a programming language that supports the transmission and reception of ASCII character codes 0 to 255 is highly recommended. Relay Control CommandsCommand codes will be shown in blue. Send these values to the controller to activate the command. Any returned data will be shown in green. Warnings and special notes will be shown in red. The ProXR Series Controllers allow you to control up to 256 relays. Relays are divided into groups of 8 called Banks, and are addressed by their bank number. For instance, a ProXR series controller with 32 on-board relays has four on-board banks, the on-board relays respond to Bank values of 1-4. If you use the XR Expansion port to add another bank of 24 relays, then you will need to specify bank values of 5-7 to control the extra relays. The firmware doesn't actually know how many relays are attached to the relay controller, but it assumes there are 256 relays (banks values 1-32, which is the maximum supported number of relays for Version 1.0 firmware). In this manual, you will see two commands that appear to do the same thing, for example:
Controlling Individual Relays
Sample Code: Controlling Individual Relays
These commands are used to turn a relay on or off under computer control. Here is an actual code sample for VB6 that shows how to use these commands:
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) Changing Targeted Relay BankAll subsequent commands will be sent to the selected relay bank. This command only applies to commands values less than 100. Commands in the 100+ value range allow you to specify a relay bank as part of the command. NOTE: Complete details on relay banking is described on Pages 10 and 11 of this manual. Sample Code: Changing Relay Banks
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) Control Multiple Relays in a Bank
This command writes a byte of data directly to a relay bank. This allows you to easily set the status of 8 relays at one time. RelayData is a parameter value from 0-255. A value of 0 turns off all the relays. A value of 255 turns on all the relays. Other values set the status of the relays in the equivalent binary pattern of the RelayData parameter value. NOTE: A Bank Value of 0 applies this command to all relay banks. Sample Code: Setting Relay Bank Status
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) Controlling Multiple BanksUnder normal operation, you will send a command to the relay controller, and the relay controller will respond to your command by activating or deactivating a relay. This system works well if you only need to control 1-8 relays, but it does not necessarily work very well if you are taking advantage of the XR Expansion ports, allowing you to control up to 256 relays (32 relay banks). In these cases, you may want to set the status of all relays at the exact same time. The easiest way to do this is to turn off automatic relay refreshing. Once turned off, you can use the relay control command set to activate relays, but the commands will not appear to have any effect. The effects will not be seen until you manually refresh the relay bank. Rest assured, when auto refreshing is off, your relay control commands are working, the processor memory is copied to the physical relay bank memory when you manually refresh the relays. Follow this methodology to set the status of multiple relays across a number of banks:
Relay Refreshing Commands
Relay Refreshing: Controlling Large Groups of RelaysThe ProXR Series Controllers allow you to manually or automatically refresh relay banks. When you first receive your ProXR Series Controller, Relay Refreshing is turned on. Meaning every time you send a relay control command, the relays will respond to your commands. Turning off relay refreshing allows you to control when the relays actually switch. When refreshing is turned off, you can send relay control commands to the ProXR controller, and the controller will work just like normal, but the relays will never change state. You can then use the Manual Refresh command to set the status of all relays at one time. Whether you are controlling 1 or 235 relays, you will be able to refresh all relays at one time to any given state by taking manual control of the relay refreshing capabilities. Here are some simple programming examples in VB:
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
This command reports back a 0 or 1, indicating whether automatic refreshing is Off or On when power is first applied to the controller.
(Controller will report back ASCII Character Code 0 or 1)
This command stores the current status of relay refreshing in non-volatile memory. The next time the relay controller is powered up, refreshing will be set to the stored state.
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) Application: Manual Refreshing Relay BanksThis simple application example demonstrates the process required to activate more than 8 relays simultaneously. In the example below, we will demonstrate how to apply the Manual Refreshing command to large groups of relays. Step 1: Turn Off Automatic Refreshing
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) Step 2: Activate Several Relays on Several Relay Banks
|
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(108) MSComm1.Output = Chr$(1) |
'Enter Command Mode 'Turn On Relay 1 'On Bank 1 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(111) MSComm1.Output = Chr$(2) |
'Enter Command Mode 'Turn On Relay 4 'On Bank 2 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(113) MSComm1.Output = Chr$(3) |
'Enter Command Mode 'Turn On Relay 6 'On Bank 3 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
You can keep adding relay control commands to activate different relays on different banks, but keep in mind, these commands will not appear to function. These commands are changing the memory pattern for the relays inside the controller. You will not see the effects of your changes until you send a Manual Refresh command. You can return to automatic refreshing at any time. Turning on automatic refreshing does NOT refresh the relays until the NEXT relay control command is issued.
Step 3: Update All Relays at the Same Time (Manually Refresh)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(37) |
'Enter Command Mode 'Manually Refresh Relays Command |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
All Relays On/Off
254, 29 | Turn All Relays On |
254, 129, Bank | Turn All Relays On in Bank |
This command is used to activate all relays in a selected relay bank.
254, 30 | Turn All Relays Off |
254, 130, Bank | Turn All Relays Off in Bank |
This command is used to turn all relays off in a selected relay bank.
NOTE: A Bank Value of 0 applies this command to all relay banks.
254, 31 | Invert All Relays |
Sample Code: All Relays On/Off
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(29) |
'Enter Command Mode 'Activate All Relays in the Selected Relay Bank |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(129) MSComm1.Output = Chr$(2) |
'Enter Command Mode 'Activate All Relayss 'In Relay Bank 2 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) |
'Enter Command Mode 'Deactivate All Relays in the Selected Relay Bank |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(130) MSComm1.Output = Chr$(2) |
'Enter Command Mode 'Deactivate All Relays 'In Relay Bank 2 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Inverting Relays
254, 131, Bank | Invert All Relays in Bank |
This command is used to Invert the status of all relays. Relays that were on turn off, relays that were off turn on. For example:
254, 32 | Reverse All Relays |
Original Relay Pattern | 0 On |
1 Off |
2 On |
3 On |
4 Off |
5 Off |
6 Off |
7 Off |
Inverted Relay Pattern | 0 Off |
1 On |
2 Off |
3 Off |
4 On |
5 On |
6 On |
7 On |
Sample Code: Inverting Relays
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(31) |
'Enter Command Mode 'Invert All Relays in the Selected Relay Bank |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(131) MSComm1.Output = Chr$(3) |
'Enter Command Mode 'Invert All Relays 'In Relay Bank 3 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reversing Relays
254, 132, Bank | Reverse All Relays in Bank |
This command is used to reverse the current pattern of relays in a given relay bank. For example:
Original Relay Pattern | 0 On |
1 Off |
2 On |
3 On |
4 Off |
5 Off |
6 Off |
7 Off |
Reversed Relay Pattern | 0 Off |
1 On |
2 Off |
3 Off |
4 On |
5 On |
6 On |
7 On |
Sample Code: Reversing Relays
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(32) |
'Enter Command Mode 'Reverse All Relays in the Selected Relay Bank |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(132) MSComm1.Output = Chr$(3) |
'Enter Command Mode 'Reverse All Relays 'In Relay Bank 3 |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reading Relay Status
Reading the Status of Individual Relays
254,16-23 | Get the Status of an Individual Relay |
254,116-123, Bank | Get the Status of an Individual Relay in Bank |
This command allows you to read the on/off status of an individual relay. 16 (or 116) corresponds to relay 1, 23 (or 123) corresponds to relay 8. This command will return a 1 indicating the relay is ON or a 0 indicating the relay is OFF.
NOTICE: A BANK VALUE OF 0 IS INVALID FOR THIS COMMAND. RETURNED RESULTS MAY BE UNPREDICTABLE.
254, 24 | Get the Status of All Relays |
Sample Code: Reading the Status of Individual Relays
254,16 | Read the Status of Relay 0 in Selected Bank |
254,116,2 | Read the Status of Relay 0 in Bank 2 |
254,117,5 | Read the Status of Relay 1 in Bank 5 |
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(16) |
'Enter Command Mode 'Read On/Off Status of Relay 0 on Currently Selected Relay Bank |
(Controller will report back ASCII Character Code 0 or 1 indicating relay status)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(116) MSComm1.Output = Chr$(2) |
'Enter Command Mode 'Read On/Off Status of Relay 0 'In Relay Bank 2 |
(Controller will report back ASCII Character Code 0 or 1 indicating relay status)
Reading the Currently Selected Relay Bank
This command queries the relay controller and reports back the relay bank all commands are being sent to. The importance of relay bank selection is discussed heavily on pages 10 and 11 of this manual. You can redirect relay control commands to a different relay bank by sending 254, 49, Bank discussed later in this manual.
254,25 | Turn On Automatic Relay Refreshing |
Sample Code: Reading the Currently Selected Relay Bank
MSComm1.Output = Chr$(34) | 'Report Selected Relay Bank to User |
(Controller will report back ASCII Character Codes 0-26, indicating which relay bank commands will be directed to)
Reading the Status of Relay Banks
254, 124, Bank | Get the Status of All Relays in Bank |
This command allows you to read the status of a single bank of relays. A value of 0-255 is returned indicating the status of all 8 relays. The binary pattern of the value returned directly corresponds to the on/off status of each of the 8 relays in the selected relay bank. If the currently selected relay bank is 0, or if you specify relay bank 0, then the status of all 32 relay banks will be sent. In this condition, your program should be written to read 32 bytes of data from the serial port.
254, 27 | Turn Reporting Mode ON |
Sample Code: Reading the Status of Relay Banks
254,24 | Read the Status of All 8 Relays in a Selected Bank |
254,124,2 | Read the Status All 8 Relays in Bank 2 |
254,124,0 | Read the Status of All 8 Relays in All 26 Banks |
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(24) |
'Enter Command Mode 'Read Status of All Relays in Currently Selected Relay Bank |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(124) MSComm1.Output = Chr$(2) |
'Enter Command Mode 'Read Status of All Relays 'In Relay Bank 2 |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(124) MSComm1.Output = Chr$(0) |
'Enter Command Mode 'Read Status of All Relays 'In ALL Relay Banks |
(Controller will report back 26 ASCII Values from 0 to 255, Indicating the Status of all 26 Relay Banks, Beginning with Bank 1. Convert Returned Values to Binary to See Actual Relay Pattern)
Analog to Digital Conversion Command Set
About A/D Conversion
Some ProXR Series Enhanced Controllers support Analog to Digital Conversion. Often referred to as A/D or ADC, A/D conversion is the process of converting a voltage to a numeric value that can be read by your computer. The input channels on NCD A/D converters can support a voltage range of 0 to +5VDC. Exceeding this input voltage will damage the CPU on the ProXR controller. Regardless of the type of communication interface you may be using (RS-232, USB, Zigbee, etc.), the commands found on this page will work with ALL ProXR controllers that are equipped with 8-Channels of A/D conversion.
A/D conversion is most commonly used to read sensors, such as light and temperature sensors, but can also be used to read switches, magnets, or any sensor that provides an ON/OFF switch closure output -or- a sensor that provides a voltage within the 0-5VDC voltage range.
NCD Enhanced controllers support 8-Bit or 10-Bit Analog to Digital Conversion. A 8-Bit A/D conversion reads a voltage from 0-5VDC and converts it to a value from 0 to 255. A 10-Bit A/D conversion reads a voltage from 0-5VDC and converts it to a value from 0 to 1023. As you can see, a 10-Bit A/D conversion is more accurate, but it also takes longer to communicate the result to the computer because it requires two bytes to communicate a value of 0 to 1023 whereas a 8-Bit conversion only requires one byte. Effectively, 8-Bit A/D conversion is twice as fast, but 10-Bit A/D conversion is 4x more accurate.
Keep in mind, the commands found on this page apply ONLY to NCD controllers with 8-Channels of A/D conversion built in. These commands will not be processed by other controllers. The commands will are the same regardless of the communication interface you are using (RS-232, USB, Zigbee, etc.).
List of A/D Commands
254,150 | Read 8-Bit A/D Channel 1 | Returns 1 Byte 0-255 |
254,151 | Read 8-Bit A/D Channel 2 | Returns 1 Byte 0-255 |
254,152 | Read 8-Bit A/D Channel 3 | Returns 1 Byte 0-255 |
254,153 | Read 8-Bit A/D Channel 4 | Returns 1 Byte 0-255 |
254,154 | Read 8-Bit A/D Channel 5 | Returns 1 Byte 0-255 |
254,155 | Read 8-Bit A/D Channel 6 | Returns 1 Byte 0-255 |
254,156 | Read 8-Bit A/D Channel 7 | Returns 1 Byte 0-255 |
254,157 | Read 8-Bit A/D Channel 8 | Returns 1 Byte 0-255 |
254,158 | Read 10-Bit A/D Channel 1 | Returns 2 Bytes 0-1023 |
254,159 | Read 10-Bit A/D Channel 2 | Returns 2 Bytes 0-1023 |
254,160 | Read 10-Bit A/D Channel 3 | Returns 2 Bytes 0-1023 |
254,161 | Read 10-Bit A/D Channel 4 | Returns 2 Bytes 0-1023 |
254,162 | Read 10-Bit A/D Channel 5 | Returns 2 Bytes 0-1023 |
254,163 | Read 10-Bit A/D Channel 6 | Returns 2 Bytes 0-1023 |
254,164 | Read 10-Bit A/D Channel 7 | Returns 2 Bytes 0-1023 |
254,165 | Read 10-Bit A/D Channel 8 | Returns 2 Bytes 0-1023 |
254,166 | Read 8-Bit A/D All Channels Returns | Returns 8 Bytes, Each 0-255 |
254,167 | Read 10-Bit A/D All Channels Returns | Returns 16 Bytes, 2-Bytes per Channel, 8 Channels, Valuing 0-1023 per Channel. |
A/D Program Examples
Here are some simple programming examples in VB:
254,150 | Read Channel 1, 8-Bit |
---|---|
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(150) Value = GetData |
'Enter Command Mode 'Read Channel 1, 8-Bit 'Read Byte from the Serial Buffer |
(The controller will return a single byte from 0-255 indicating the voltage on the selected input channel)
254,158 | Read Channel 1, 10-Bit |
---|---|
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(158) MSB = GetData LSB = GetData Value = LSB + (MSB * 256) |
'Enter Command Mode 'Read Channel 1, 10-Bit 'Read MSB Byte from the Serial Buffer 'Read LSB Byte from the Serial Buffer 'Convert Returned Data to Value from 0-1023r> |
The controller will return two bytes indicating the voltage on the selected input channel, the first returned value is the Most Significant Byte MSB, the second byte sent to your computer will be the Least Significant Byte LSB. Using the formula VALUE= (LSB + (MSB * 256)), where VALUE will equate to a numeric value from 0 to 1023. Here is a code sample:
254,166 | Read All Channels, 8-Bit |
---|---|
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(166) Channel1 = GetData Channel2 = GetData Channel3 = GetData Channel4 = GetData Channel5 = GetData Channel6 = GetData Channel7 = GetData Channel8 = GetData |
'Enter Command Mode 'Read All Channels, 8-Bit 'Read Channel 1 from the Serial Buffer 'Read Channel 2 from the Serial Buffer 'Read Channel 3 from the Serial Buffer 'Read Channel 4 from the Serial Buffer 'Read Channel 5 from the Serial Buffer 'Read Channel 6 from the Serial Buffer 'Read Channel 7 from the Serial Buffer 'Read Channel 8 from the Serial Buffer |
254,167 | Read All Channels, 10-Bit |
---|---|
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(167) For X = 1 to 8 MSB = GetData LSB = GetData Debug.Print LSB + (MSB * 256) Next X |
'Enter Command Mode 'Read All Channels, 10-Bit 'Read MSB Byte from the Serial Buffer 'Read MSB Byte from the Serial Buffer 'Convert and Print Returned Data to Value from 0-1023 |
NOTICE:
GetData shown in the code above is a Function and is NOT a VB Command. GetData calls the code shown below, used for Reading a Byte of Data from the PC Serial Buffer:
Public Function GetData() Do DoEvents Until MSComm1.InBufferCount > 0 GetData = ASC(MSComm1.Input) End Function |
'Read a Byte of Data from the Controller in VB 'Start a Continuous Loop 'Service Other Windows Tasks (Very Important!!!) 'Continue Loop Until a Byte of Data is Received 'Read Data Byte from the Serial Port |
Simple Timer Commands
About ProXR Timers
16 User-Programmable Timers
The ProXR Series controllers have 16 user-programmable timers. Each independent timer can be assigned to any relay, and can be programmed to hold the relay in the On state, or to pulse the relay at the end of the timer.
The ProXR timing features are ideally suited for Watchdog, Keep Alive, and Server Reboot applications, as well as sprinkler systems, gate openers, and day/night lighting applications.
Relay Timing Features support two modes of operation: Duration and Pulse. Duration timing is ideally suited for keeping a light on overnight, watering the lawn for a given period of time, or other applications where a device should be activated for a period of time. Pulse timing mode is designed specifically for server reboot applications, whereby, if the timer is not reset periodically by your software, the timer will run out and reboot your computer.
Interactive Timing Commands
The ProXR timing commands can be used by themselves, or in conjunction with other commands, as building blocks to create some very sophisticated timing applications. The timing command set covers many aspects of relay activation/deactivation, making the ProXR series ideally suited for a broad range of timing tasks.
Limitations
The ProXR series controllers do NOT have an integrated real-time clock. NCD Devices are not typically stand-alone. They require computer interaction with the controller. Time scheduling is possible, but it would require a program to be written on the PC to handle the schedule. The timing features are suitable for applications where you may want a light to go on for 5 minutes, or you may want to keep a relay alive to prevent a server from automatically rebooting. The ProXR series controllers are capable of processing timing commands as long as 255 hours, 255 minutes, and 255 seconds (4 Days, 19 Hours, 19 Minutes, and 15 Seconds) + Deviation.
Timing Accuracy
The Accuracy of the relay timers is largely dependant on how many timers are in use, and how much communication you do with the controller while the timing commands are processing.
When a timer is already active, and you engage another timer, the duration of the previously set times may be increased by as much as one full second. You can enable all timers simultaneously if you need more accurate timing.
Best timing accuracy is achieved by setting up your timing commands and leaving the controller alone during the timing operations. Each time you communicate with the controller, you will slow down the timer (lengthening the time period the timer is set for). The more you communicate with the controller, the more you will slow down all timers. Timing accuracy tends to drift over time. This timing functions built into this controller should NOT be used if timing accuracy is critical. The timing feature are, however, very useful in applications where a little timing drift is not a big concern.
Timing Calibration
Timing is generically recalibrated for 60 seconds using 8 timers. Our test controller calibration value was 26,576. In other words, a calibration value of 26,576 equals 1 second when the controller is only processing timing tasks.
The calibration value was established on our prototype and may be off by as much as 3% based on individual resonator, processor, and temperature characteristics. Baud rate was set at 115.2K when this number was established. The calibration value may need to be changed for other baud rates, but 115.2K baud is the best choice for calibration.
You can adjust the calibration value at any time, but the calibration value can ONLY be stored while in setup mode. If you need to communicate frequently with the controller while the timing functions are active, you will need to decrease the calibration value. Reasonably accurate timing can be achieved with some experimentation.
It should also be stated that you can spend a week achieving perfect calibration for your controller, and if you were to plug the calibration number into a different controller, it will likely not be accurate.
In addition, the timing routines built into the firmware are huge. There are so many factors that affect timing, that even a well calibrated controller will not post consistent timing scores at all timing intervals. So you should NEVER expect to find a calibration value that works under every circumstance. It is not possible to achieve this level of accuracy without a real time clock. So before you waste hours finding a timing score for your controller that works perfectly at 10 seconds or 24 hours, then you should be warned that this is not possible.
Simple Timers
While all the timers in the timing commands are pretty easy to use, simple timers are the easiest. Once you have sent a simple timer command, the timer automatically starts counting down. There are two types of simple timers: Duration and Pulse.
Simple Duration Timers
These timers activated a relay for a user specified period of time. When the timer expires, the relay turns off. Here is an example sending a simple duration timer command:
Hold Relay 0 On for 8 Hours, 10 Minutes, 15 Seconds using Simple Duration Timer 0:
Hold Relay 0 On for 8 Hours, 10 Minutes, 15 Seconds using Simple Duration Timer 0:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(8) MSComm1.Output = Chr$(10) MSComm1.Output = Chr$(15) MSComm1.Output = Chr$(0) | 'Enter Command Mode 'Timer Setup Command 'Simple Duration Timer 0 Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Hold Relay 1 On for 10 Seconds using Simple Duration Timer 1:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(51) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(10) MSComm1.Output = Chr$(1) | 'Enter Command Mode 'Timer Setup Command 'Simple Duration Timer 0 Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command) |
When the above two commands have been sent. The heartbeat LED on the controller will slow down. Both relays 0 and 1 will turn on. Relay 0 will turn off after 8 hours, 10 minutes, and 15 seconds. Relay 1 will turn off after only 10 seconds. While the timers are running, you may send other relay control commands. It is also possible to manually turn off the relays while the timers are still running. In these cases, the timers will not appear to have any effect. You can also pause the timers using other commands.
Keep in mind, you have 16 timers to work with. If you ever need this many timers, it would be prudent to assign a different relay to each timer. Assigning the same relay to 2 timers will cause the relay to turn off when the first timer expires. The second timer will appear to have no effect.
After the timers have expired, the heartbeat LED on the relay controller will return to a steadily fast pace.
Also note that relays are assigned in numeric order of 0-255 when using the timing commands. Relay 0 is located on Bank 1, Relay 0. Relay 8 is located on Bank 2, Relay 0. Relay 255 is located on bank 32, Relay 7 (you will have to make use of the XR Expansion port to access this relay).
Simple Pulse Timers
Pulse timers are slightly different than duration timers. When a pulse timer is activated, the relay will not do anything until the timer has expired. Once expired, the relay will turn on for 1/4th of a second. This quarter second pulse is designed specifically to reboot a computer by connecting a relay directly to the RESET lines of a motherboard. While this may be used for other applications, the intent of the pulse timer is to reboot a computer should there be a lack of communication between the computer and the relay controller (indicative of a system crash).
Below is a simple example of setting up a pulse timer.
Pulse Relay 0 after 15 Seconds using Simple Pulse Timer 0:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(70) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(15) MSComm1.Output = Chr$(0) | 'Enter Command Mode 'Timer Setup Command 'Simple Pulse Timer 0 Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Pulse Relay 1 after 45 Seconds using Simple Pulse Timer 1:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(71) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(45) MSComm1.Output = Chr$(1) | 'Enter Command Mode 'Timer Setup Command 'Simple Pulse Timer 0 Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
In the examples above, Relay 0 will pulse after 15 seconds and Relay 1 will pulse after 45 seconds.
Mixing Duration and Pulse Timers
You can mix duration and pulse timers as your application requires, in any combination. Care should be taken not to mix timers. For example, on the previous page, we utilized timers 0 and 1 using the commands 50 and 51. On this page, we utilized timers 0 and 1 using the commands 70 and 71. The commands 50 and 70 both use timer 0. Likewise, the commands 51 and 71 use timer 1. Here is a simple overlap map that will help you keep track of what commands address specific timers. The table below shows the beginning command bytes:
Timer Number | Duration Timer | Pulse Timer | Duration Timer | Pulse Timer |
---|---|---|---|---|
0 | 254, 50, 50 | 254, 50, 70 | 254, 50, 90 | 254, 50, 110 |
1 | 254, 50, 51 | 254, 50, 71 | 254, 50, 91 | 254, 50, 111 |
2 | 254, 50, 52 | 254, 50, 72 | 254, 50, 92 | 254, 50, 112 |
3 | 254, 50, 53 | 254, 50, 73 | 254, 50, 93 | 254, 50, 113 |
4 | 254, 50, 54 | 254, 50, 74 | 254, 50, 94 | 254, 50, 114 |
5 | 254, 50, 55 | 254, 50, 75 | 254, 50, 95 | 254, 50, 115 |
6 | 254, 50, 56 | 254, 50, 76 | 254, 50, 96 | 254, 50, 116 |
7 | 254, 50, 57 | 254, 50, 77 | 254, 50, 97 | 254, 50, 117 |
8 | 254, 50, 58 | 254, 50, 78 | 254, 50, 98 | 254, 50, 118 |
9 | 254, 50, 59 | 254, 50, 79 | 254, 50, 99 | 254, 50, 119 |
10 | 254, 50, 60 | 254, 50, 80 | 254, 50, 100 | 254, 50, 120 |
11 | 254, 50, 61 | 254, 50, 81 | 254, 50, 101 | 254, 50, 121 |
12 | 254, 50, 62 | 254, 50, 82 | 254, 50, 102 | 254, 50, 122 |
13 | 254, 50, 63 | 254, 50, 83 | 254, 50, 103 | 254, 50, 123 |
14 | 254, 50, 64 | 254, 50, 84 | 254, 50, 104 | 254, 50, 124 |
15 | 254, 50, 65 | 254, 50, 85 | 254, 50, 105 | 254, 50, 125 |
*These timers do not automatically activate, they must be started using a different command. More on this a little later in the manual.
Advanced Timer Commands
To this point, we have discussed simple timers. These timers begin operation as soon as the command is received. This makes them easy to use, but also imposes a few restrictions in that timers cannot be synchronized perfectly with each other. So we decided to provide our users with a command set that allows you to define the times without initiating the timer. Instead, the timing data for all 16 timers are stored in temporary memory until they are initiated. The following commands store timing data, but do not trigger the countdown. You will use a different command to control which timers are counting down and which timers are "stalled".
Setup a Pulse Timer on Relay 0 for 15 Seconds using Timer 0:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(110) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(15) MSComm1.Output = Chr$(0) | 'Enter Command Mode 'Timer Setup Command 'Pulse Timer 0 Setup Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Setup a Duration Timer on Relay 1 for 35 Seconds using Timer 1:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(91) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(0) MSComm1.Output = Chr$(35) MSComm1.Output = Chr$(1) | 'Enter Command Mode 'Timer Setup Command 'Duration Timer 1 Setup Command 'Hours (0-255) 'Minutes (0-255) 'Seconds (0-255) 'Relay (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
In the examples above, two timers will be setup, but they will not start counting down until they are activated. Timers are activated using a separate command:
Begin Countdown of Timers 0 and 1:
LSB = 3 MSB = 0 MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(131) MSComm1.Output = Chr$(LSB) MSComm1.Output = Chr$(MSB) | '1 + 2 = 3 1 is for Timer 0, 2 is for Timer 2, See Table Below 'Keep all other timers off 'Enter Command Mode 'Timer Setup Command 'Control Active and Halted Timers Command '16-Bit Value, Least Significant Byte '16-Bit Value, Most Significant Byte |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
If you understand how binary works, this is a pretty simple command. A 16 bit value is used to control which timers are active and which timers are halted. Each of the 16 bits identifies with each of the 16 timers. A binary 0 in any bit location indicates the timer is off while a binary 1 in any bit location indicates the timer is on. If you are not familiar with binary, here is a crash course:
16 Timers have 16 Bits, but we have to divide these into two 8-Bit values to communicate these data via a serial port. We call these two different bytes LSB for Least Significant Byte and MSB for Most Significant Byte. Follow the section below to figure LSB and MSB Values:
Timer 0 has a value of 1 on the LSB | Timer 8 has a value of 1 on the MSB |
Timer 1 has a value of 2 on the LSB | Timer 9 has a value of 2 on the MSB |
Timer 2 has a value of 4 on the LSB | Timer 10 has a value of 4 on the MSB |
Timer 3 has a value of 8 on the LSB | Timer 11 has a value of 8 on the MSB |
Timer 4 has a value of 16 on the LSB | Timer 12 has a value of 16 on the MSB |
Timer 5 has a value of 32 on the LSB | Timer 13 has a value of 32 on the MSB |
Timer 6 has a value of 64 on the LSB | Timer 14 has a value of 64 on the MSB |
Timer 7 has a value of 128 on the LSB | Timer 15 has a value of 128 on the MSB |
To Turn On timers, add up the LSB and MSB Values.
For example: To turn on timers 0, 1, 2, and 3 we add up 1, 2, 4, and 8. So the LSB = 15.
To turn on timers 10, 12, 14, and 15, we add up 4, 16, 64, and 128. So the MSB = 212.
After you send the LSB and MSB timer data to the controller, the selected timers will be activated. All other timers will be halted.
Timer Query
The Timer Query command is used to view the current status of any timer. All timers are countdown in nature. Timer Query allows you to see how muh time remains before the timer expires. The example below illustrates the use the Timer Query command:
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(130) MSComm1.Output = Chr$(0) | 'Enter Command Mode 'Timer Setup Command 'Issue Timer Query Command 'Select a Timer to Query (0-15) |
The first byte sent back to the PC will contain the number of hours left on the selected timer.
The second byte sent back to the PC will contain the number of minutes left on the selected timer.
The third byte sent back to the PC will contain the number of seconds left on the selected timer.
The fourth byte sent back to the PC will contain the relay number the timer applies to (0-255).
Setting the Timer Calibration Value
As discussed earlier in the manual, you can calibrate the timer at any time. If the controller is in Configuration mode (all dip switches off), calibration data will be stored when this command is issued. Otherwise, the calibration value will be changed, but settings will be lost when power is cycled.
Calibrator = 26576 LSB = (Calibrator And 255) MSB = (Calibrator And 65280) / 256 MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(132) MSComm1.Output = Chr$(LSB) MSComm1.Output = Chr$(MSB) |
'26575 Counts Equals 1 Second 'Compute the LSB Value of the Calibrator 'Compute the MSB Value of the Calibrator 'Enter Command Mode 'Timer Setup Command 'Issue the Set Calibrator Command 'Send Calibrator LSB Value (0-255) 'Send Calibrator MSB Value (0-255) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reading the Timer Calibration Value
You may also read the calibration value stored in the controller by issuing the Calibrator Read command. This command returns two bytes of data to the user.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(133) | 'Enter Command Mode 'Timer Setup Command 'Issue the Set Calibrator Command |
The first byte sent back to the PC will contain the Timer Calibrator LSB Value
The second byte sent back to the PC will contain the Timer Calibrator MSB Value
Calibrator = (LSB + (MSB * 256)) | 'This math function "rebuilds" the calibration value |
Activating Calibrator Markers
Time calibrator markers are used to help calibrate the timer. When the calibrator markers have been activated, the controller will send our ASCII character code 90 at the beginning of any timing event. ASCII character code 91 will be sent at the end of any timing event. The time measured between the receiving 90 and 91 is used to help the user set the calibration value. These markers may prove useful if you need your PC to know when a timing even has occurred.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(134) |
'Enter Command Mode 'Timer Setup Command 'Issue the Set Calibrator Command |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Deactivating Calibrator Markers
This command turns off the calibration markers described above.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(135) | 'Enter Command Mode 'Timer Setup Command 'Issue the Set Calibrator Command |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
ProXR Configuration Commands
Reporting Mode
254, 28 | Turn Reporting Mode OFF |
This command sets and stores (in non-volatile EEPROM while in configuration mode only) the reporting mode status. Reporting mode, by default, is ON, meaning every time a command is sent to the controller, the controller will send an 85 back to the computer, indicating that the command has finished executing your instructions. We recommend leaving it on, but doing so requires 2-Way communication with the controller. You should turn it off if you intend to use 1-Way communication only. A delay between some commands may be required when using 1-Way communications. For optimum reliability, leave reporting mode on and use 2-Way communications with the ProXR Series controllers.
NOTE: Reporting Mode may be turned on or off at any time. The default power-up status of reporting mode is ONLY stored when the device is in configuration mode (all dip switches off when the controller is powered up).
Sample Code: Reporting Mode
NOTE: USE OTHER RELAY CONTROL COMMANDS TO SET RELAYS TO THE DESIRED POWERUP STATE BEFORE ISSUEING THIS COMMAND. FOR INSTANCE, IF YOU WANT ALL RELAYS TO COME ON AT POWERUP, USE OTHER RELAY CONTROL COMMANDS TO ACTIVATE ALL RELAYS, THEN ISSUE THIS COMMAND. THE NEXT TIME POWER IS APPLIED TO THE CONTROLLER, ALL RELAYS WILL AUTOMATICALLY ACTIVATE.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(27) |
'Enter Command Mode 'Turn On and Store Reporting Mode in EEPROM |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(28) |
'Enter Command Mode 'Turn Off and Store Reporting Mode in EEPROM |
(Controller will no-longer report back 85, commands that request data from the controller, such as relay status, will still function correctly.)
Test 2-Way Communication
This command is used to test 2-Way communications between the PC and the relay controller. This command does nothing except report back an ASCII character code 85 when executed.
254, 34 | Report to User the Selected Relay Bank |
Sample Code: Test 2-Way Communication
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(33) |
'Enter Command Mode 'Test 2-Way Communications with Relay Controller Command |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
MSComm1.Output = Chr$(254) | 'Enter Command Mode |
Power Up Relay Status Configuration
254, 42 | Store Power Up Default Status |
254, 142, Bank | Store Power Up Default Status in Bank |
This command stores the current status of the relays in a given bank into memory. The next time power is applied to the controller, relays will return to the stored on/off state. A bank value of 0 stores the pattern of all relays in all 26 banks.
254, 43 | Read Power Up Default Status |
This command is used to direct commands to a selected relay bank.
Sample Code: Relay Status Power Up
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(43) |
'Enter Command Mode 'Read Relay Settings in the Selected Relay Bank |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern) |
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(143) MSComm1.Output = Chr$(1) |
'Enter Command Mode 'Read Relay Settings 'In Relay Bank 1 |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern)
Read Power Up Relay Status Configuration
254, 143, Bank | Read Power Up Default Status in Bank |
This command reads the stored power-up default status of the relays in a given bank. A bank value of 0 reports back 26 bytes of data, indicating the stored pattern of all 26 relay banks.
254, 49, Bank | Direct Commands to Selected Relay Bank |
This command is used to direct commands to a selected relay bank.
Sample Code: Read Relay Status on Power Up
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(43) |
'Enter Command Mode 'Read Relay Settings in the Selected Relay Bank |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern)
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(143) MSComm1.Output = Chr$(1) |
'Enter Command Mode 'Read Relay Settings 'In Relay Bank 1 |
(Controller will report back ASCII Character Codes 0-255, Convert to Binary to See Relay Pattern)
Server Reboot Methodology
You can call it a watchdog timer, a keep-alive timer, or a server reboot timer. They can all mean about the same thing, as their goals are basically the same. The idea is simple: If the computer crashes, the computer cannot reset the timer built into the ProXR controller, so the controller reboots the computer. Implementation is not too difficult.
Implementing a Server Reboot Strategy for a Single Computer
A Server reboot system can work many ways. One possible strategy is a system whereby a server would boot up with a ProXR relay controller attached to the serial port. The relay controller would also be connected to the reset lines of server motherboard. As part of the startup items, a program would be launched to activate the pulse timer function for a period of 10 minutes (for example). The relay would do nothing since a pulse timer is used. Using this strategy, the relay controller would reboot the computer if communications is lost between the server and the relay controller. Once the timer in the relay controller has expired, it can only be restarted when the computer boots up normally. The monitoring program could be exited at any time. In which case, all timers would be cleared to prevent rebooting the computer.
Implementing a Server Reboot Strategy in a Network
The strategy above could be implemented on a single computer with an enhanced version of the software. The relay controller could be tied into the reset lines on the other computers as well. The program could be enhanced to "ping" other computers on the network. If one of them should fail to respond to your "ping", a command could be sent to reboot the computer that failed to respond. In this case, one computer (a main server) is protected, as well as all other computers on the network. The main server is acting as the watchdog for all the other computers on the network. The relay controller itself is acting as the watchdog for the main server computer.
While there are many other strategies that could be easily implemented, these strategies could perhaps serve as building blocks to greater, more powerful and sophisticated watchdog monitoring applications.
Setting Reps Value: Fighting Electromagnetic Interference (EMI)
Any relay controller has to consider EMI as a possible mechanism that can cause serious interference with normal operation. In extreme cases, EMI can cause the relays in a given relay bank to turn off, or even reboot the ProXR processor. We have taken several steps to help reduce EMI absorption on the logic side of the controller. However, there are some conditions that MAY still exist whereby EMI will cause all relays on a given bank to turn off.
When relay status information is sent from the controller to the relay bank, data is normally sent only one time. But the possibility does exist that the relay is turning on a device that generates a tremendous amount of EMI. Most of these kinds of devices, such as large DC motors, generate most of their EMI when power is first applied. During this time (the initial startup of the motor), huge amounts of EMI must be absorbed by the relays and inducted back onto the logic of the controller. It is during this time the controller becomes the most vulnerable to EMI absorption.
It is for this reason we have introduced the Repetitions (Reps) command. The Reps command is used to tell the controller to send relay control data Repeatedly to the relay banks. The theory is that motor will be fighting to turn on, generating EMI that can clear the relay logic circuits...but the controller can now fight back by telling the relay bank to go back on again.
Reps has been introduced as an experimental command, in hopes that we would have a solution for this problem should it ever arise for our customers. We would greatly appreciate any feedback our customers would be willing to provide on the usefulness of the Reps command. The value specified by the Reps command controls how many times relay status data is sent to the Relay control chips. Normally, Reps is set to a value of 1. But if you experience relays that turn themselves off when activated, try changing the Reps value to any number from 2 to 255 and see what happens. It takes more than a second to process each relay control command when Reps is set to 255.
Note: If the controller is in configuration mode, the Reps value will be stored in Non-Volatile EEPROM. Otherwise, the Reps value will be lost any time the controller is power cycled.
Set the Reps Value
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(137) MSComm1.Output = Chr$(128) | 'Enter Command Mode 'Timer and Setup Commands 'Set the Reps Value 'Reps(1-255) How Many Times Relays are Refreshed |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
This command reports back to the user the current Reps value.
Read the Reps Value
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(136) |
'Enter Command Mode 'Timer and Setup Commands 'Read the Reps Value Command |
The Controller will Report Back the Current Reps Value
Safe Parameters
Another "just-in-case" feature we have included in the ProXR firmware is a command that sets all the key variables inside the controller to Safe Parameters. If for some reason, the controller does not seem to be functioning properly, or it appears you have lost communication, try sending this command and see if it recovers. We have never needed this command, but just in case it proves to be useful under highly unusual circumstances... we thought we would throw it in anyway.
Recovery Attempt to Safe Parameters
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(147) | 'Enter Command Mode 'Timer and Setup Commands 'Setup Safe Parameters |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Setting the Character Delay Value
The Character Delay value determines the spacing between data bytes sent from the controller back to your PC. By default, CDEL is set to 35, which is known to be a conservatively safe value. The minimum allows CDEL value is 3 (we have not seen a PC that can handle this setting). If you want to boost performance, set the CDEL lower. A value of 7-10 should provide greatly improved communication speed.
Note: This command stores the CDEL value into Non-Volatile EEPROM while in configuration mode only. The CDEL value will have no effect in configuration mode (CDEL is ALWAYS 35 in configuration mode to ensure safe communications). This command is only processed in configuration mode, it is ignored in runtime mode. In runtime mode, you will receive ASCII character code 85 if this command is issued.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(139) MSComm1.Output = Chr$(10) |
'Enter Command Mode 'Timer and Setup Commands 'Set the CDEL Value of the Controller in Runtime Mode 'Improve Communication Speed in Runtime Mode |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reading the Character Delay Value
This command reads the stored character delay value from the controller. This command returns a value from 3 to 255.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(138) | 'Enter Command Mode 'Timer Setup Command 'Read the CDEL Value from the Controller Command |
The controller will report back a byte of data from 3 to 255 indicating the Character Delay value.
Setting the Attached Banks Value
The ProXR series controllers are shipped as though the customer has 256 relays attached. This allows the controller to be instantly compatible with several XR expansion boards, right out of the box. However, you can gain a performance increase by setting the Attached Banks value to the actual number of relays you are using. If you are using a 16 Relay ProXR controller, and you reduce the Attached Banks value to 2, relay control operations will be processed 16 times faster. If you have a 32 relay controller and you reduce the Attached Banks value to 4, relay control operations will be processed 8 times faster. To determine the appropriate Attached Banks value, divide the number of total relays you will be using by 8. Valid attached bank values are 1 to 32.
Warning: It is not possible to control relays beyond the Attached Value. Extra relays will appear to mirror previous banks and will not be directly controllable. If you experience any problems communicating to extra relay banks, the Attached Banks value should be checked. This Command ONLY Works in Configuration Mode.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(141) MSComm1.Output = Chr$(4) |
'Enter Command Mode 'Timer and Setup Commands 'Set Attached Banks Command 'Controller Processes 4 Banks of 8 Relays (32 Relays) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reading the Attached Banks Value
This command reports back a value from 1 to 32, indicating how many relays are attached to the relay controller. Note that this number is always set by the user. By default, this command return a value of 32. You can gain a performance increase by reducing the Attached Banks value. See Above: "Setting the Attached Banks Value"
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(140) |
'Enter Command Mode 'Timer and Setup Commands 'Read the Attached Banks Value |
This Command Reports Back a Value of 1 to 32, Indicating the Number of Relay Banks Attached to the ProXR Series controller. By default, this command will report back 32.
Setting the Test Cycle Value
When the ProXR series controllers are powered up in Configuration mode (all dip switches in the off position), the first instruction the controller processes is a function that tests all the on board relays. By default, the ProXR controller will test 4 banks of relays, which is the maximum number of relays that we currently product on a single circuit board. If you have a controller with fewer relays, you will speed up the test cycle by setting the controller to the actual number of relay banks on your ProXR controller. Valid Test Cycle values range from 0 to 32, allowing the controller to test all 256 relays (32 banks of 8). A Test Cycle value of 0 turns off automatic relay testing in configuration mode. Since this is a relatively harmless setting, this command works in both configuration and runtime modes.
Warning: We strongly encourage customers NOT to use configuration mode for daily use. As a reminder that the controller is in configuration mode, we recommend leaving the Test Cycle value to 1 or more. When the controller is in configuration mode, internal memory is not protected, and is fully changeable at any time. Runtime mode (and dip switch setting other than all switches in the off position) protects internal memory from accidental modification.
Warning: The ProXR controller will appear to lock up if the Test Cycle value is set greater than the total number of available relay banks. Rest assured, the controller has NOT locked up, it is testing extended banks. Leave the controller on for several seconds and the heartbeat LED will begin flashing.
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(146) MSComm1.Output = Chr$(4) |
'Enter Command Mode 'Timer and Setup Commands 'Set the Test Cycle Value 'Controller Tests 4 Banks of 8 Relays (32 Relays) |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Reading the Test Cycle Value
This command reports back a value from 0 to 32, indicating how many relays are tested when the controller is powered up in configuration mode (all dip switches in the off position). Note that this number is always set by the user. By default, this command return a value of 4. You can gain a performance increase by reducing the Test Cycle Banks value. See Above: Setting the Test Cycle Banks Value
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(145) | 'Enter Command Mode 'Timer and Setup Commands 'Read the Attached Banks Value |
This Command Reports Back a Value of 0 to 32, Indicating the Number of Relay Banks Tested when the ProXR Series controller is in configuration mode. By default, this command will report back 4.
Restoring Factory Default Settings
This command operates in configuration mode only (all dip switches in the off position). This command restores many internal parameters to the factory default settings. See below for a detailed list:
- E3C Device Number is Set to 0
- Auto Refresh is Activated
- Default Timing is Set to 26,576
- Relay Command Repetitions is Set to 1
- Character Delay is Set to 35
- Reporting Mode is Turned On
- Attached Relay Banks is Set to 32
MSComm1.Output = Chr$(254) MSComm1.Output = Chr$(50) MSComm1.Output = Chr$(144) |
'Enter Command Mode 'Timer and Setup Commands 'Restore Factory Default Settings |
(When Reporting Mode is ON, controller will send ASCII Code 85 to Acknowledge this command)
Helpful Routines and Safe Programming Practices
There are two helpful routines you may want to structure into your program that helps handle serial communications. First, the ClearBuffer routine can be called prior to sending each command to the relay controller, helping ensure the serial buffer is empty and the new command is not returning old data to your program. This has been a problem for some customers, and it is easily avoided. While this is not always necessary, it should be troubleshooting starting point if the controller seems to be sending you invalid data.
Clearing the Serial Buffer
Public Function ClearBuffer() While MSComm1.InBufferCount > 0 DUMP = Asc(MSComm1.Input) DoEvents Wend End Function |
'Read a Byte of Data from the Controller in VB 'If there is data in the serial port 'Read Data Byte from the Serial Port 'Service Other Windows Tasks (Very Important!!!) 'Repeat the Check Again, Loop will Repeat until Empty |
Reading a Byte of Data from the PC
Second, the GetData routine should be used to read data from the controller. This simple routine waits for data to arrive in the serial buffer. Once it arrives, it grabs the data, and stores the value in the GetData variable.
Public Function GetData() Do DoEvents Until MSComm1.InBufferCount > 0 GetData = ASC(MSComm1.Input) End Function |
'Read a Byte of Data from the Controller in VB 'Start a Continuous Loop 'Service Other Windows Tasks (Very Important!!!) 'Continue Loop Until a Byte of Data is Received 'Read Data Byte from the Serial Port |
The ProXR Graphical User Interface (GUI)
Installing and Running the ProXR Software
For your convenience, we have developed software that will test all the functions the ProXR series controllers have to offer. This application is available for free download from our web site at www.IORelay.com. This program was developed using Visual Basic 6 Professional on a Windows XP Professional computer. The compatibility with XP Home and other versions of Windows have NOT been tested. If you experience installation problems, please be aware that we may not be able to help. The installation is created by Visual Basic, we did not develop the install program. It should also be stated that the GUI is NOT required to use ProXR series controllers. While it is convenient and can help you change controller settings and configurations quickly, it is in no way critical to the operation of a ProXR controller. Keep in mind, ProXR controllers are simple devices that simply wait for your commands. ProXR controllers do not care what is generating the commands, only that the data is valid. We have fully documented the command set to this point. Whether you choose to use our GUI or develop your own, we have provided all the necessary information for you to get started. The next few pages will document our GUI to help get you better acquainted.
Sending Commands Directly to a Relay Bank
The commands on this window are used to address a specific relay bank. They may not look different than some of the other commands you have seen, but there is a distinctive difference in how they communicated relay control data to the controller.
Up until this point, you would use a separate command to specify a relay bank. All subsequent relay control commands will be directed to the bank. This method separates "Bank Specification" and relay control commands from each other. Meaning you use a command to specify a relay bank, you use another command for relay control.
The commands in this GUI specify a relay bank as part of the command. These commands should be considered more reliable because they will function properly if the controller has been power cycled. But they are slightly slower to process. Each command below transmits the Bank as a part of the command, ensuring commands are always directed to the correct relay.
Timer Commands
This GUI demonstrates the powerful timing commands the ProXR series controllers have to offer. The ProXR series controllers have 16 timers, ideal for watchdog, keep alive, and server reboot timing applications. ProXR controllers are also an ideal choice for duration timing applications, such as activating a light for 8 hours, or watering a lawn for 30 minutes. Additional timer commands allow you to monitor the current time remaining on each of the 16 timers, as well as halt/start timers in any order. The commands on this GUI have been enhanced with three white boxes that allow you to see what commands are actually being sent to the controller.
Advanced Timer Calibration Features Test
This GUI serves the purpose of demonstrating how the timers can be used in watchdog, keep alive, and server reboot timing applications. These commands are self explanatory for the most part.
Advanced Configuration Features
We have provided lots of notes directly on the Advanced Features Configuration screen. The ProXR controller should be in configuration mode (all dip switches in the off position) before these setting will be stored permanently in non-volatile EEPROM. Some settings can be changed during regular runtime operation, but they will not be stored.
Please see the notes below for each of the different controls.
Warranty and Legal Information
NCD warranty and legal information can be found on their site at /Relay/Relay/RETURN
Technical Assistance
Technical questions and support can be found at AccessNCD: http://iorelay.ning.com/.