TS-1400: Difference between revisions

From embeddedTS Manuals
(→‎Example Code: fixed baud rate a third time.)
No edit summary
Line 1: Line 1:
{{Infobox
{{Infobox
|title        = TS-1400
|title        = TS-1800
|image        = [[File:TS-1400.jpg|200px]]
|image        = [[File:ts-1800.jpg|200px]]
|titlestyle  =  
|titlestyle  =  
|headerstyle  = background:#ccf;
|headerstyle  = background:#ccf;
|labelstyle  = width:33%
|labelstyle  = width:33%
|datastyle    =  
|datastyle    =  
|data1        = Released March 2013
|data1        = Released May. 2014
|data2        = [http://www.embeddedarm.com/products/board-detail.php?product=TS-1400 Product Page]
|data2        = [http://www.embeddedarm.com/products/board-detail.php?product=TS-1800 Product Page]
|header3      = Documentation
|header3      = Documentation
|data4        = [ftp://ftp.embeddedarm.com/ FTP Path]
|data4       = [http://www.embeddedarm.com/documentation/ts-1700-schematic.pdf Schematic]
|header5      = Relays
|data5        = [http://www.embeddedarm.com/documentation/ts-1700-mechanical.pdf Mechanical Drawing]
|header6      = External Interfaces
|data6       = [ftp://ftp.embeddedarm.com/ FTP Path]
|data7        = [[#RJ45 Modbus|2x RJ45 Modbus]]
|header17    = DIN / DOUT / ADC
|header9      = Power Requirements
|data18      = 16 /  8  /  14
|data10       = 24V
|header19    = External Interfaces
|data11       = Operates between 0.435W-9.75W
|data20      = [[#RJ45 Modbus|2x RJ45 Modbus]] / USB / 2x 24 Pin IO
|header12     = Operating Temperature
|header30    = Power Requirements
|data13       = {{Cold|-40C}}
|data31       = 12-24V Modbus
|data14       = {{Hot|85C}}
|data32      = 5V USB
|header15     = Mechanical
|data33       = Operates around ??
|data16       = 164mm x 112mm
|header34     = Operating Temperature
|data17       = Height 58mm (with relays)
|data35       = {{Cold|-40C}}
|data18       = Weight 467g
|data36       = {{Hot|85C}}
|header37     = Mechanical
|data39       = 140mm x 102mm
|data30       = Height 35mm (approx without baseboard)
|data4-       = Weight 167
}}
}}


= Overview =
= Overview =
The TS-1400 is a modbus peripheral device which features 6x 24VDC 30A relays.
 
The TS-1800 is a Modbus peripheral device that provides 14 ADC channels, 8 digital outputs, and 16 digital inputs.


= Getting Started =
= Getting Started =
== Using TS-ARM Products ==
Our TS-ARM products use Debian Linux which can use Modbus to communicate with the TS-1400.  We have created a patch to libmodbus to allow guaranteed timing which is available [ftp://ftp.embeddedarm.com/ts-modbus/libmodbus-3.0.x-xuart.diff here].  For ARMEL(EABI) compatible systems we have debian package [ftp://ftp.embeddedarm.com/ts-modbus/libmodbus_3.0.3-1_armel.deb here].


To install this on a board, connect it to the internet and run these commands:
== Power Requirements ==
<source lang=bash>
The TS-1800 will operate within a range of 10-28 VDC on either Modbus port.  Power supplied on the Modbus port is passed along the bus as an active power rail on the other Modbus port.  Do not apply power to both Modbus ports.
wget ftp://ftp.embeddedarm.com/ts-modbus/libmodbus_3.0.3-1_armel.deb
 
dpkg -i libmodbus_3.0.3-1_armel.deb
= Features =
</source>
== TS Modbus Support ==
The TS-1800 can be utilized as a device in a chain of devices on the RS-485 Modbus port; or, as a single peripheral device pm a USB port.  When operating on the USB port, the default device address is 0xf6 (246) and the default bit rate is 1,000,000 bps.
When using all Technologic Systems Modbus devices we include functionality to create an arbitrary chain of stock peripherals to automatically enumerate all connected devices, configure them them, and generate an I/O map of all connected devices.
 
=== TS Modbus Autoconfiguration ===
The autoconfiguration works by using the optional mode pin on the RJ45 connector as designated in the MODBUS-2W standard. Technologic Systems uses this to indicate if it is a TS device. If it is asserted (low) to a TS device, then it will allow access to the [[#Holding Registers]] at address 0xfe. Normally 0xfe is not a valid address in Modbus, so this will not interfere with other devices.
 
This will identify the TS Modbus device model and revision, set the first device in the chain to 0x80, and then asserts the mode line to the next port to enumerate the next device. The next device address is set to 0x81, and they continue to increment 1 until no slave responds to the mode line indicating that all salve devices have been discovered. At this point the last device in the chain is configured to enable termination on the RS485 link, and all devices have their speed bumped up to 1M baud.


This package includes both the library and the supporting headers needed for building libmodbus compatible examplesFor other platforms other than OABI ARM you can use the sources provided by the [http://libmodbus.org/ libmodbus project].
== Funciontality ==
The TS-1800 provides the following electrically (optically) '''isolated''' interfaces:
* 8 Single Ended ADC channels in the range 0-30 or 0-7.5 VDC
** Channels 0-1, 2-3, & 4-7 may be configured in blockes to operate as 4-20 mA instrumentation ports
* 6 Differantial ADC channels in the range +/- 30 or +/- 7.5 VDC
* 8 digital outputs with 6-bit PWM with open drain 500 mA sink capacity
* 16 digital inputs (0-30 VDC)
 
Each ADC channel can be enabled or disabled individually and can be set for resolution (and associated sample rate) as follows:
* 12 bits per sample @ 240 SPS
* 14 bits per sample @ 60 SPS
* 16 bits per sample @ 15 SPS
 
= Register Interface =
== Holding Registers ==
The interface to all Modbus peripheral devices consists of a set of 127 holding registers. These registers are used to configure the device operation, read and write input output parameters, as well as various settings used to configurable Modbus Address, Termination enable, Data Format, and Bit RateThese settings are common to all of our Modbus peripherals and can be persisted in on-board flash memory.
 
NOTE: The device operates '''ONLY''' in Modbus RTU communications mode.  Modbus ASCII is not presently supported.
 
=== Common Configuration Holding Registers ===
 
{|class=wikitable style="text-align: center"
|-
! Address (hex)
! Address (dec)
! Access
! Description
! Example Values
|-
| 0x70
| 112
| Read/Write
| Modbus Mode RTU
| 1
|-
| 0x71
| 113
| Read/Write
| RS485 Bus Termination Enable
| 0: Disable termination
1: Enable termination
|-
| 0x72
| 114
| Read/Write
| Modbus Device Address
| 1-246 (0x01-0xf7)
|-
| 0x73
| 115
| Read/Write
| Modbus baud rate
| [[#Communication Bit Rate|Communication Bit Rate]]
|-
| 0x74
| 116
| Read Only
| Unit Model
| TS-1700
|-
| 0x75
| 117
| Read Only
| Verilog Version
| 1
|-
| 0x76
| 118
| Read Only
| ZPU Version
| 1
|-
| 0x77
| 119
| Read Only
| Current external bus supply voltage in millivolts
| e.g., 24000
|-
| 0x78
| 120
| Read Only
| Current internal unit temperature in 1/100th degrees Celsius
| e.g., 22000
|-
| 0x79
| 121
| Read/Wrtie
| Reserved
| N/A
|-
| 0x7a
| 122
| Read / Write
| Reserved
| N/A
|-
| 0x7b
| 123
| Read Only
| Reserved
| N/A
|-
| 0x7c
| 124
| Read Only
| Reserved
| N/A
|-
| 0x7d
| 125
| Read/Write
| Write value to pogrom configuration:
| Set to:
0xfeed: Persist configuration parameters (set Legacy Mode)
0xdead: Kill Legacy mode (Reset to 9600,N,8,1 @ 0xf7)
0xc0de: Copy configuration parameters to hardware: i.e., Bit rate, Address, Format.
The value is set to zero when completed OK or 0xfa17 (fail) for a failure such as an invalid parameter.
|-
| 0x7e
| 124
| Read Only
| Reserved
| N/A
|}


= Example Code =
=== Operational (holding) Registers ===
This code uses the patched libmodbus for xuart support communicating at 9600, 8n1, and with the default modbus address 247:


<source lang=c>
{|class=wikitable style="text-align: center"
// TS-1400 Coil-toggle example.
|-
// Written by Michael D Peters for Technologic Systems, Inc.
! Address (hex)
// Copyright March 22, 2013
! Address (dec)
//
! Access
// This code assumes six relays on a TS-1400 that is configured
! Description
// in legacy mode, 9600 baud, 8, N, 1, Device address 0xAC.
|-
//
| 0
// This code assumes the use of the Technologic Systems XUART
| 0
// controller, xuartctl, and the appropriately modified version
| Read / Write
// of LibmodbusPatch files available near here:
| Channel 0 ADC Result (Refer to details below)
// http://forum.embeddedarm.com/
|-
//
| 1
// These settings are modifiable in the #define block below.
| 1
//
| Read / Write
// This program demonstrates both methods of setting coils on
| Channel 1 ADC Result (Refer to details below)
// the TS-1400.
|-
// First by setting coils using the holding register address.
| 2
// Second by setting individual coils using the write coil command.
| 2
| Read / Write
| Channel 2 ADC Result (Refer to details below)
|-
| 3
| 3
| Read / Write
| Channel 3 ADC Result (Refer to details below)
|-
|-
| 4
| 4
| Read / Write
| Channel 4 ADC Result (Refer to details below)
|-
| 5
| 5
| Read / Write
| Channel 5 ADC Result (Refer to details below)
|-
| 6
| 6
| Read / Write
| Channel 6 ADC Result (Refer to details below)
|-
| 7
| 7
| Read / Write
| Channel 7 ADC Result (Refer to details below)
|-
| 8
| 8
| Read / Write
| Channel 8 ADC Result (Refer to details below)
|-
| 9
| 9
| Read / Write
| Channel 9 ADC Result (Refer to details below)
|-
| 10
| A
| Read / Write
| Channel 10 ADC Result (Refer to details below)
|-
| 11
| B
| Read / Write
| Channel 11 ADC Result (Refer to details below)
|-
| 12
| C
| Read / Write
| Channel 12 ADC Result (Refer to details below)
|-
| 13
| D
| Read / Write
| Channel 13 ADC Result (Refer to details below)
|-
| 14
| E
| Read / Write
| Internal 2 VDC reference for channels 8-13
|-
| 15-17
| F-11
| Read / Write
| Unused (Reserved)
|-
| 18
| 12
| Read / Write
| Output 0 Control (See below)
|-
| 19
| 13
| Read / Write
| Output 1 Control (See below)
|-
| 20
| 14
| Read / Write
| Output 2 Control (See below)
|-
| 21
| 15
| Read / Write
| Output 3 Control (See below)
|-
| 22
| 16
| Read / Write
| Output 4 Control (See below)
|-
| 23
| 17
| Read / Write
| Output 5 Control (See below)
|-
| 24
| 18
| Read / Write
| Output 6 Control (See below)
|-
| 25
| 19
| Read / Write
| Output 7 Control (See below)
|-
| 26-31
| 1A-1F
| Read / Write
| Unused (Reserved)
|-
| 32
| 20
| Read / Write
| DIO INPUT: Bits 0-15 will reflect the state of the state corresponding input pin (0 or 1).
|-
| 33
| 21
| Read / Write
| Unused (Reserved)
|-
| 34
| 22
| Read / Write
| DIO OUTPUT: Bits 0-7 are reflected to the corresponding DIO output pins subject to the control of the associated DIO control registers (0x12-0x19)
|-
|-
| 48
| 30
| Read / Write
| Channel 0 16-bit ADC raw value.  (Positive value only)
|-
| 49
| 31
| Read / Write
| Channel 0 extended channel data (Refer to details below)
|-
| 50
| 32
| Read / Write
| Channel 1 16-bit ADC value.  (Positive value only)
|-
| 51
| 33
| Read / Write
| Channel 1 extended channel data (Refer to details below)
|-
| 52
| 34
| Read / Write
| Channel 2 16-bit ADC value(Positive value only)
|-
| 53
| 35
| Read / Write
| Channel 2 extended channel data (Refer to details below)
|-
| 54
| 36
| Read / Write
| Channel 3 16-bit ADC value.  (Positive value only)
|-
| 55
| 37
| Read / Write
| Channel 3 extended channel data (Refer to details below)
|-
| 56
| 38
| Read / Write
| Channel 4 16-bit ADC value. (Positive value only)
|-
| 57
| 39
| Read / Write
| Channel 4 extended channel data (Refer to details below)
|-
| 58
| 3A
| Read / Write
| Channel 5 16-bit ADC value. (Positive value only)
|-
| 59
| 3B
| Read / Write
| Channel 5 extended channel data (Refer to details below)
|-
| 60
| 3C
| Read / Write
| Channel 6 16-bit ADC value.  (Positive value only)
|-
| 61
| 3D
| Read / Write
| Channel 6 extended channel data (Refer to details below)
|-
| 62
| 3E
| Read / Write
| Channel 7 16-bit ADC value.  (Positive value only)
|-
| 63
| 3F
| Read / Write
| Channel 7 extended channel data (Refer to details below)
|-
| 64-79
| 0x40-0x4F
| Read / Write
| Reserved: '''Warning:''' Do not access location 64 (0x40) of DIO operations can become spurious
|-
| 80
| 50
| Read / Write
| Channel 8 16-bit ADC value. (Positive and Negative values)
|-
| 81
| 51
| Read / Write
| Channel 8 extended channel data (Refer to details below)
|-
| 82
| 52
| Read / Write
| Channel 9 16-bit ADC value.  (Positive and Negative values)
|-
| 83
| 53
| Read / Write
| Channel 9 extended channel data (Refer to details below)
|-
| 84
| 54
| Read / Write
| Channel 10 16-bit ADC value.  (Positive and Negative values)
|-
| 85
| 55
| Read / Write
| Channel 10 extended channel data (Refer to details below)
|-
| 86
| 56
| Read / Write
| Channel 11 16-bit ADC value. (Positive and Negative values)
|-
| 87
| 57
| Read / Write
| Channel 11 extended channel data (Refer to details below)
|-
| 88
| 58
| Read / Write
| Channel 12 16-bit ADC value. (Positive and Negative values)
|-
| 89
| 59
| Read / Write
| Channel 12 extended channel data (Refer to details below)
|-
| 90
| 5A
| Read / Write
| Channel 13 16-bit ADC value. (Positive and Negative values)
|-
| 91
| 5B
| Read / Write
| Channel 13 extended channel data (Refer to details below)
|-
| 92
| 5C
| Read / Write
| Unused (Reserved)
|-
| 93
| 5D
| Read / Write
| Unused (Reserved)
|-
| 96
| 60
| Read / Write
| ADC Channel 0-7 Resolution & Speed
|-
| 97
| 61
| Read / Write
| ADC Channel 8-13 Resolution & Speed
|-
| 98
| 62
| Read / Write
| ADC Range
|-
| 99
| 63
| Read / Write
| ADC Channel Enable
|-
| 100
| 64
| Read / Write
| ADC Control
|-
| 101
| 65
| Read / Write
| High serial number (MAC)
|-
| 102
| 66
| Read / Write
| Middle serial number (MAC)
|-
| 103
| 67
| Read / Write
| Low serial number (MAC)
|-
|}


#include <stdio.h>
==== Output Channel Control Register ====
#include <stdlib.h>
#include <modbus.h>
#include <errno.h>


#define DEVICE_ID 0xf7
{|class=wikitable style="text-align: center"
#define SPEED 9600
|-
#define PORT "127.0.0.1:7350"
! Bit 15
#define RELAY_REGISTER 0x40
! Bits 14-6
! Bits 5-0
|-
| 1: Direct DIO output; 0: PWM DIO output
| Unused (Reserved)
| PWM Value - 0: Off; 63: 98.4% On
|-
|}


modbus_t *mb;
The PWM is scaled in increments of 1/64 (1.56%) per bit in the range of 0/64 through 63/64.  To set 100% you must set the Direct DIO Output bit in this register and then set the appropriate bit in the direct output register at holding register 34 (hex 22).  '''NOTE:''' The PWM range is 0 to 98.4%.  The easiest way to do direct per bit control is the set the appropriate output control register (0x12-0x19) to 0x8000 and manupulate the bit in DIO Output (0x22).  To use the full range of the PWM, set the appropriate output register bit (0x22) tp 1.  Then set the ADC control register to a value from 0 to 63 (0-98.4%) or 0x8000 (100%).


int main(int argc, char* argv[])
==== ADC Channel Control Registers ====
{
===== ADC Channel 16-bit Result details =====
int c = 0;


// modbus setup
ADC Channel 16-bit Result details
mb = modbus_new_rtu(PORT, SPEED, 'N', 8, 1);
The 8 single ended channels in holding registers 0-7 contain the following values based on the  range (gain) and 4-20 mA selection, this value is a 15-bit positive number representing:
if(!mb){
* 0 to +30 VDC (mV)
fprintf(stderr, "Unable to open bus at port %s.\n", PORT);
* 0 to +7.5 VDC (mV)
return 0;
* 4 to 20 mA (µA)
}


modbus_set_debug(mb, (argc > 1));
The 6 differential channels in holding registers 8-13 contain the following values based on the range (gain), this value is a 16-bit signed number representing:
modbus_set_slave(mb, DEVICE_ID);
* -30 to +30 VDC (mV)
modbus_connect(mb);
* -7.5 to +7.5 VDC (mV)


// Demo functions
===== Extended ADC Channel Result details =====
printf("Ticking relay pattern...\n");
c = set_multiple_relays();
if(c == -1){
return 0; // error output by function.
}


printf("Ticking individual relays...\n");
The 1st 16-bit value of the extended channel data contains the 16-bit ADC value as presented in the first 14 holding registers
c= set_single_relay();
if(c == -1){
return 0; // error output by function.
}


return 0;
The 2nd 16-bit value of the extended channel data contains the following additional information
}


// throws relays in a 24 position countup -- that's 64 iterations.
{|class=wikitable style="text-align: center"
// returns -1 and prints stderr if there was a problem,
|-
// returns 1 if no trouble was detected.
! Bit 15-8
int set_multiple_relays()
! Bits 7
{
! Bits 6-5
uint16_t c = 0;
! Bits 4
int d = 0;
! Bits 3-0
for(c = 0; c < 64; c++){
|-
d = modbus_write_register(mb, RELAY_REGISTER, c);
| Sequence number
usleep(100000);
| Channel is 4-20 mA current Loop if set to 1
if(d == -1){
| Resolution and Speed (See below)
fprintf(stderr, "Problem with write.  Error %d: %s",
| Channel Range (see below)
errno, modbus_strerror(errno));
| ADC Channel number
return -1;
|-
}
|}
}
return 1;
}


// Throws relays individually using the write relay modbus command.
* Resolution and Speed
// Throws each relay on and then off in sequence.
** 0: 12 bits @ 240 sps
// Returns -1 if error condition and writes an error to stderr.  Returns 1 otherwise.
** 1: 14 bits @ 60 sps
int set_single_relay()
** 2: 16 bits @ 15 sps)
{
int c = 0;
int d = 0;
d = modbus_write_register(mb, RELAY_REGISTER, 0);
while(c<6){
d = modbus_write_bit(mb, c, 0xffff);
usleep(1000000);
d = modbus_write_bit(mb, c++, 0x0);
if(d == -1){
fprintf(stderr, "Problem with write.  Error %d: %s",
errno, modbus_strerror(errno));
return d;
}
}
return 1;
}
</source>


To compile and run this as test.c:
* Range:
<source lang=bash>
** 0 0 to +30 V (Channel 0-7)
gcc `pkg-config --libs --cflags libmodbus` test.c -o test
** 0 -30 to +30 V (Channel 8-13)
./test
** 1 0 to +7.5 V or 4-20 mA (Channel 0-7)
</source>
** 1 -7.5 to +7.5 V (Channel 8-13)


= Power Requirements =
===== ADC Channels Configuration Register Details =====
The TS-1400 requires 0.435W under normal operation, and approximately 1.6W for each active relay.


= Features =
<u>'''ADC Channel 0-7 Resolution'''</u>
== TS Modbus Support ==
{{:Modbus Peripheral General}}


=== TS Modbus Autoconfiguration ===
{|class=wikitable style="text-align: center"
{{:Modbus Peripheral Autodiscovery}}
|-
! Bit 15:14
! Bit 13:12
! Bit 11:10
! Bit 9:8
! Bit 7:6
! Bit 5:4
! Bit 3:2
! Bit 1:0
|-
|  Ch 7
|  Ch 6
|  Ch 5
|  Ch 4
|  Ch 3
|  Ch 2
|  Ch 1
|  Ch 0
|-
|}


= Register Interface =
<u>'''ADC Channel 8-13 Resolution'''</u>
== Holding Registers ==
{{:Modbus Peripheral Holding Registers}}


=== Baud Rate ===
{|class=wikitable style="text-align: center"
The TS-1400 supports 15 speeds:
|-
! Bit 15:14
! Bit 13:12
! Bit 11:10
! Bit 9:8
! Bit 7:6
! Bit 5:4
! Bit 3:2
! Bit 1:0
|-
|  Unused
|  Unused
|  Ch 13
|  Ch 12
|  Ch 11
|  Ch 10
|  Ch 9
|  Ch 8
|-
|}


{{:Modbus Peripheral Baud}}
<u>'''ADC Channel Resolution (and implied speed) values'''</u>


== Operating Registers ==
{|class=wikitable style="text-align: center"
Coil addresses correspond to the appropriate relay (coil 0 == CN1).  Holding Register 0x40 is read/write and always reflects the current status of each coil in the first six bits:  Holding Register 0x40 bit 0:5 == Coil Register 0... 5 == Physical Relay 1... 6.
{|class=wikitable
|-
|-
! Address (hex)
! Valie
! Address (dec)
! Resolution (Bits)
! Access
! Speed (Samples per Second)
! Description
|-
|-
| COIL 0x0
| 0
| 0
| Read/Write
| 12
| Relay 0 (1 NO, 0 NC)
| 240
|-
|-
| COIL 0x1
| 1
| 1
| Read/Write
| 14
| Relay 1 (1 NO, 0 NC)
| 60
|-
| 2
| 16
| 15
|-
|}
 
<u>'''ADC Channel 0-13 Range'''</u>
 
The ADC channel range register contains a single bit per channel.  Setting the associated bit to 0 sets the 0-30 (channels 0-7) or +/- 30 (channels 8-13) VDC range.  Setting the associated bit to 1 sets the 0-7.5 (channels 0-7) or +/- 7.5 (channels 8-13) VDC range.
 
{|class=wikitable style="text-align: center"
|-
! Bit 15:14
! Bit 13
! Bit 12
! Bit 11
! Bit 10
! Bit 9
! Bit 8
! Bit 7
! Bit 6
! Bit 5
! Bit 4
! Bit 3
! Bit 2
! Bit 1
! Bit 0
|-
|  Unused / Reserved
|  C13
|  C12
|  C11
|  C10
|  C9
|  C8
|  C7
|  C6
|  C5
|  C4
|  C3
|  C2
|  C1
|  C0
|-
|}
 
<u>'''ADC Channel 0-13 Enable'''</u>
 
The ADC channel enable register contains a single bit per channel.  Setting the associated bit to 1 enables the channel during the confiuration cycle.
 
{|class=wikitable style="text-align: center"
|-
! Bit 15
! Bit 14
! Bit 13
! Bit 12
! Bit 11
! Bit 10
! Bit 9
! Bit 8
! Bit 7
! Bit 6
! Bit 5
! Bit 4
! Bit 3
! Bit 2
! Bit 1
! Bit 0
|-
|  Unused / Reserved
|  C13
|  C12
|  C11
|  C10
|  C9
|  C8
|  C7
|  C6
|  C5
|  C4
|  C3
|  C2
|  C1
|  C0
|-
|}
 
<u>'''ADC Control Register'''</u>
 
After setting the channel resolution, range, and enable parameters, this register is used to set the 4-20mA parameters and perform the unit configuration.  Setting the '''Start''' bit will begin the configuration.  When the unit configuration is completed, the '''Start''' bit will be cleared, and the '''Complete''' bit will be set.  If any erros occurred (generally an invalid setting), the '''Error''' bit will also be set.
 
{|class=wikitable style="text-align: center"
|-
! Bit 15
! Bit 14
! Bit 13
! Bit 12
! Bit 11
! Bit 10
! Bit 9
! Bit 8
! Bit 7:0
|-
|  Error
|  Complete
|  Unused
|  Start
|  Unused
|  C7:4
|  C3:2
|  C1:0
|  Unused
|-
|}
 
<references />
 
== Communication Bit Rates ==
The TS-1700 supports 15 speeds:
 
{{:Modbus Peripheral Baud}}
 
= Connectors =
== 2x RJ45 Modbus ==
Both RJ45 ports, and all of our Modbus based devices are designed to be compatible with 2W-MODBUS RJ45 following this pinout:
 
[[File:ModbusRJ45.png|200px]]
 
== USB Device Port ==
 
[[File:ts-1800-connectors-modbus.jpg|200px]]
 
 
== 22 Pin Terminal Block ==
The terminal block is a removable connector that provides all of the DIO and ADC connections.
 
<u>'''P1A / P1B - Top & Bottom Connector Signal Layout'''</u>
 
{|class=wikitable style="text-align: center"
|-
! Pin
! P1A (Top) Signal Description
!
! Pin
! P1B (Bottom) Signal Description
|-
| 1 (Left)
| ADC Channel 0
|
| 23 (Left)
| Isloated Gounrd
|-
|-
| COIL 0x2
| 2
| 2
| Read/Write
| ADC Channel 1
| Relay 2 (1 NO, 0 NC)
|
| 24
| Isloated Gounrd
|-
|-
| COIL 0x3
| 3
| 3
| Read/Write
| ADC Channel 2
| Relay 3 (1 NO, 0 NC)
|  
| 25
| Isloated Gounrd
|-
|-
| COIL 0x4
| 4
| 4
| Read/Write
| ADC Channel 3
| Relay 4 (1 NO, 0 NC)
|  
| 26
| Isloated Gounrd
|-
|-
| COIL 0x5
| 5
| 5
| Read/Write
| ADC Channel 4
| Relay 5 (1 NO, 0 NC)
|  
| 27
| Isloated Gounrd
|-
|-
| COIL 0x6
| 6
| 6
| Read/Write
| ADC Channel 5
| Relay 6 (1 NO, 0 NC)
|  
| 28
| Isloated Gounrd
|-
| 7
| ADC Channel 6
|
|  29
| Digital Input 0
|-
| 8
| ADC Channel 7
|
| 30
| Digital Input 1
|-
| 9
| ADC Channel 8
|
| 31
| Digital Input 2
|-
| 10
| ADC Channel 9
|
| 32
| Digital Input 3
|-
| 11
| ADC Channel 10
|
| 33
| Digital Input 4
|-
| 12
| ADC Channel 11
|
| 34
| Digital Input 5
|-
| 13
| ADC Channel 12
|
| 35
| Digital Input 6
|-
| 14
| ADC Channel 13
|
| 36
| Digital Input 7
|-
| 15
| Digital Output 0
|
| 37
| Digital Input 8
|-
| 16
| Digital Output 1
|
| 38
| Digital Input 9
|-
| 17
| Digital Output 2
|
| 39
| Digital Input 10
|-
| 18
| Digital Output 3
|
| 40
| Digital Input 11
|-
| 10
| Digital Output 4
|
| 41
| Digital Input 12
|-
| 20
| Digital Output 5
|
| 42
| Digital Input 13
|-
| 21
| Digital Output 6
|
| 43
| Digital Input 14
|-
| 22 (Right)
| Digital Output 7
|
| 44 (Right)
| Digital Input 15
|-
|-
| HOLDING 0x40
| 64
| Read/Write
| Bits 0:5 correspond with Relay 1-6
|}
|}


= Connectors =
[[File:TS-1800-IO.jpg|400px]]
== 2x RJ45 ==
 
Both RJ45 ports, and all of our Modbus based devices are designed to be compatible with 2W-MODBUS RJ45 following this pinout:


{|
[[File:ts-1800-label22-p1.jpg|400px]]
| [[File:ModbusRJ45.png|200px]]
| [[File:TS-1400_RJ45.png|300px|right]]
|}


= Product Notes =
= Product Notes =

Revision as of 15:09, 19 May 2014

TS-1800
Ts-1800.jpg
Released May. 2014
Product Page
Documentation
Schematic
Mechanical Drawing
FTP Path
DIN / DOUT / ADC
16 / 8 / 14
External Interfaces
2x RJ45 Modbus / USB / 2x 24 Pin IO
Power Requirements
12-24V Modbus
5V USB
Operates around ??
Operating Temperature
Cold -40C
Hot 85C
Mechanical
140mm x 102mm

Overview

The TS-1800 is a Modbus peripheral device that provides 14 ADC channels, 8 digital outputs, and 16 digital inputs.

Getting Started

Power Requirements

The TS-1800 will operate within a range of 10-28 VDC on either Modbus port. Power supplied on the Modbus port is passed along the bus as an active power rail on the other Modbus port. Do not apply power to both Modbus ports.

Features

TS Modbus Support

The TS-1800 can be utilized as a device in a chain of devices on the RS-485 Modbus port; or, as a single peripheral device pm a USB port. When operating on the USB port, the default device address is 0xf6 (246) and the default bit rate is 1,000,000 bps. When using all Technologic Systems Modbus devices we include functionality to create an arbitrary chain of stock peripherals to automatically enumerate all connected devices, configure them them, and generate an I/O map of all connected devices.

TS Modbus Autoconfiguration

The autoconfiguration works by using the optional mode pin on the RJ45 connector as designated in the MODBUS-2W standard. Technologic Systems uses this to indicate if it is a TS device. If it is asserted (low) to a TS device, then it will allow access to the #Holding Registers at address 0xfe. Normally 0xfe is not a valid address in Modbus, so this will not interfere with other devices.

This will identify the TS Modbus device model and revision, set the first device in the chain to 0x80, and then asserts the mode line to the next port to enumerate the next device. The next device address is set to 0x81, and they continue to increment 1 until no slave responds to the mode line indicating that all salve devices have been discovered. At this point the last device in the chain is configured to enable termination on the RS485 link, and all devices have their speed bumped up to 1M baud.

Funciontality

The TS-1800 provides the following electrically (optically) isolated interfaces:

  • 8 Single Ended ADC channels in the range 0-30 or 0-7.5 VDC
    • Channels 0-1, 2-3, & 4-7 may be configured in blockes to operate as 4-20 mA instrumentation ports
  • 6 Differantial ADC channels in the range +/- 30 or +/- 7.5 VDC
  • 8 digital outputs with 6-bit PWM with open drain 500 mA sink capacity
  • 16 digital inputs (0-30 VDC)

Each ADC channel can be enabled or disabled individually and can be set for resolution (and associated sample rate) as follows:

  • 12 bits per sample @ 240 SPS
  • 14 bits per sample @ 60 SPS
  • 16 bits per sample @ 15 SPS

Register Interface

Holding Registers

The interface to all Modbus peripheral devices consists of a set of 127 holding registers. These registers are used to configure the device operation, read and write input output parameters, as well as various settings used to configurable Modbus Address, Termination enable, Data Format, and Bit Rate. These settings are common to all of our Modbus peripherals and can be persisted in on-board flash memory.

NOTE: The device operates ONLY in Modbus RTU communications mode. Modbus ASCII is not presently supported.

Common Configuration Holding Registers

Address (hex) Address (dec) Access Description Example Values
0x70 112 Read/Write Modbus Mode RTU 1
0x71 113 Read/Write RS485 Bus Termination Enable 0: Disable termination

1: Enable termination

0x72 114 Read/Write Modbus Device Address 1-246 (0x01-0xf7)
0x73 115 Read/Write Modbus baud rate Communication Bit Rate
0x74 116 Read Only Unit Model TS-1700
0x75 117 Read Only Verilog Version 1
0x76 118 Read Only ZPU Version 1
0x77 119 Read Only Current external bus supply voltage in millivolts e.g., 24000
0x78 120 Read Only Current internal unit temperature in 1/100th degrees Celsius e.g., 22000
0x79 121 Read/Wrtie Reserved N/A
0x7a 122 Read / Write Reserved N/A
0x7b 123 Read Only Reserved N/A
0x7c 124 Read Only Reserved N/A
0x7d 125 Read/Write Write value to pogrom configuration: Set to:

0xfeed: Persist configuration parameters (set Legacy Mode) 0xdead: Kill Legacy mode (Reset to 9600,N,8,1 @ 0xf7) 0xc0de: Copy configuration parameters to hardware: i.e., Bit rate, Address, Format. The value is set to zero when completed OK or 0xfa17 (fail) for a failure such as an invalid parameter.

0x7e 124 Read Only Reserved N/A

Operational (holding) Registers

Address (hex) Address (dec) Access Description
0 0 Read / Write Channel 0 ADC Result (Refer to details below)
1 1 Read / Write Channel 1 ADC Result (Refer to details below)
2 2 Read / Write Channel 2 ADC Result (Refer to details below)
3 3 Read / Write Channel 3 ADC Result (Refer to details below)
4 4 Read / Write Channel 4 ADC Result (Refer to details below)
5 5 Read / Write Channel 5 ADC Result (Refer to details below)
6 6 Read / Write Channel 6 ADC Result (Refer to details below)
7 7 Read / Write Channel 7 ADC Result (Refer to details below)
8 8 Read / Write Channel 8 ADC Result (Refer to details below)
9 9 Read / Write Channel 9 ADC Result (Refer to details below)
10 A Read / Write Channel 10 ADC Result (Refer to details below)
11 B Read / Write Channel 11 ADC Result (Refer to details below)
12 C Read / Write Channel 12 ADC Result (Refer to details below)
13 D Read / Write Channel 13 ADC Result (Refer to details below)
14 E Read / Write Internal 2 VDC reference for channels 8-13
15-17 F-11 Read / Write Unused (Reserved)
18 12 Read / Write Output 0 Control (See below)
19 13 Read / Write Output 1 Control (See below)
20 14 Read / Write Output 2 Control (See below)
21 15 Read / Write Output 3 Control (See below)
22 16 Read / Write Output 4 Control (See below)
23 17 Read / Write Output 5 Control (See below)
24 18 Read / Write Output 6 Control (See below)
25 19 Read / Write Output 7 Control (See below)
26-31 1A-1F Read / Write Unused (Reserved)
32 20 Read / Write DIO INPUT: Bits 0-15 will reflect the state of the state corresponding input pin (0 or 1).
33 21 Read / Write Unused (Reserved)
34 22 Read / Write DIO OUTPUT: Bits 0-7 are reflected to the corresponding DIO output pins subject to the control of the associated DIO control registers (0x12-0x19)
48 30 Read / Write Channel 0 16-bit ADC raw value. (Positive value only)
49 31 Read / Write Channel 0 extended channel data (Refer to details below)
50 32 Read / Write Channel 1 16-bit ADC value. (Positive value only)
51 33 Read / Write Channel 1 extended channel data (Refer to details below)
52 34 Read / Write Channel 2 16-bit ADC value. (Positive value only)
53 35 Read / Write Channel 2 extended channel data (Refer to details below)
54 36 Read / Write Channel 3 16-bit ADC value. (Positive value only)
55 37 Read / Write Channel 3 extended channel data (Refer to details below)
56 38 Read / Write Channel 4 16-bit ADC value. (Positive value only)
57 39 Read / Write Channel 4 extended channel data (Refer to details below)
58 3A Read / Write Channel 5 16-bit ADC value. (Positive value only)
59 3B Read / Write Channel 5 extended channel data (Refer to details below)
60 3C Read / Write Channel 6 16-bit ADC value. (Positive value only)
61 3D Read / Write Channel 6 extended channel data (Refer to details below)
62 3E Read / Write Channel 7 16-bit ADC value. (Positive value only)
63 3F Read / Write Channel 7 extended channel data (Refer to details below)
64-79 0x40-0x4F Read / Write Reserved: Warning: Do not access location 64 (0x40) of DIO operations can become spurious
80 50 Read / Write Channel 8 16-bit ADC value. (Positive and Negative values)
81 51 Read / Write Channel 8 extended channel data (Refer to details below)
82 52 Read / Write Channel 9 16-bit ADC value. (Positive and Negative values)
83 53 Read / Write Channel 9 extended channel data (Refer to details below)
84 54 Read / Write Channel 10 16-bit ADC value. (Positive and Negative values)
85 55 Read / Write Channel 10 extended channel data (Refer to details below)
86 56 Read / Write Channel 11 16-bit ADC value. (Positive and Negative values)
87 57 Read / Write Channel 11 extended channel data (Refer to details below)
88 58 Read / Write Channel 12 16-bit ADC value. (Positive and Negative values)
89 59 Read / Write Channel 12 extended channel data (Refer to details below)
90 5A Read / Write Channel 13 16-bit ADC value. (Positive and Negative values)
91 5B Read / Write Channel 13 extended channel data (Refer to details below)
92 5C Read / Write Unused (Reserved)
93 5D Read / Write Unused (Reserved)
96 60 Read / Write ADC Channel 0-7 Resolution & Speed
97 61 Read / Write ADC Channel 8-13 Resolution & Speed
98 62 Read / Write ADC Range
99 63 Read / Write ADC Channel Enable
100 64 Read / Write ADC Control
101 65 Read / Write High serial number (MAC)
102 66 Read / Write Middle serial number (MAC)
103 67 Read / Write Low serial number (MAC)

Output Channel Control Register

Bit 15 Bits 14-6 Bits 5-0
1: Direct DIO output; 0: PWM DIO output Unused (Reserved) PWM Value - 0: Off; 63: 98.4% On

The PWM is scaled in increments of 1/64 (1.56%) per bit in the range of 0/64 through 63/64. To set 100% you must set the Direct DIO Output bit in this register and then set the appropriate bit in the direct output register at holding register 34 (hex 22). NOTE: The PWM range is 0 to 98.4%. The easiest way to do direct per bit control is the set the appropriate output control register (0x12-0x19) to 0x8000 and manupulate the bit in DIO Output (0x22). To use the full range of the PWM, set the appropriate output register bit (0x22) tp 1. Then set the ADC control register to a value from 0 to 63 (0-98.4%) or 0x8000 (100%).

ADC Channel Control Registers

ADC Channel 16-bit Result details

ADC Channel 16-bit Result details The 8 single ended channels in holding registers 0-7 contain the following values based on the range (gain) and 4-20 mA selection, this value is a 15-bit positive number representing:

  • 0 to +30 VDC (mV)
  • 0 to +7.5 VDC (mV)
  • 4 to 20 mA (µA)

The 6 differential channels in holding registers 8-13 contain the following values based on the range (gain), this value is a 16-bit signed number representing:

  • -30 to +30 VDC (mV)
  • -7.5 to +7.5 VDC (mV)
Extended ADC Channel Result details

The 1st 16-bit value of the extended channel data contains the 16-bit ADC value as presented in the first 14 holding registers

The 2nd 16-bit value of the extended channel data contains the following additional information

Bit 15-8 Bits 7 Bits 6-5 Bits 4 Bits 3-0
Sequence number Channel is 4-20 mA current Loop if set to 1 Resolution and Speed (See below) Channel Range (see below) ADC Channel number
  • Resolution and Speed
    • 0: 12 bits @ 240 sps
    • 1: 14 bits @ 60 sps
    • 2: 16 bits @ 15 sps)
  • Range:
    • 0 0 to +30 V (Channel 0-7)
    • 0 -30 to +30 V (Channel 8-13)
    • 1 0 to +7.5 V or 4-20 mA (Channel 0-7)
    • 1 -7.5 to +7.5 V (Channel 8-13)
ADC Channels Configuration Register Details

ADC Channel 0-7 Resolution

Bit 15:14 Bit 13:12 Bit 11:10 Bit 9:8 Bit 7:6 Bit 5:4 Bit 3:2 Bit 1:0
Ch 7 Ch 6 Ch 5 Ch 4 Ch 3 Ch 2 Ch 1 Ch 0

ADC Channel 8-13 Resolution

Bit 15:14 Bit 13:12 Bit 11:10 Bit 9:8 Bit 7:6 Bit 5:4 Bit 3:2 Bit 1:0
Unused Unused Ch 13 Ch 12 Ch 11 Ch 10 Ch 9 Ch 8

ADC Channel Resolution (and implied speed) values

Valie Resolution (Bits) Speed (Samples per Second)
0 12 240
1 14 60
2 16 15

ADC Channel 0-13 Range

The ADC channel range register contains a single bit per channel. Setting the associated bit to 0 sets the 0-30 (channels 0-7) or +/- 30 (channels 8-13) VDC range. Setting the associated bit to 1 sets the 0-7.5 (channels 0-7) or +/- 7.5 (channels 8-13) VDC range.

Bit 15:14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Unused / Reserved C13 C12 C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0

ADC Channel 0-13 Enable

The ADC channel enable register contains a single bit per channel. Setting the associated bit to 1 enables the channel during the confiuration cycle.

Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
Unused / Reserved C13 C12 C11 C10 C9 C8 C7 C6 C5 C4 C3 C2 C1 C0

ADC Control Register

After setting the channel resolution, range, and enable parameters, this register is used to set the 4-20mA parameters and perform the unit configuration. Setting the Start bit will begin the configuration. When the unit configuration is completed, the Start bit will be cleared, and the Complete bit will be set. If any erros occurred (generally an invalid setting), the Error bit will also be set.

Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7:0
Error Complete Unused Start Unused C7:4 C3:2 C1:0 Unused


Communication Bit Rates

The TS-1700 supports 15 speeds:

Value Communication Bit Rate Maximum CAT5 Cable Length
0 300 1200 meters
1 600 1200 meters
2 1200 1200 meters
3 2400 1200 meters
4 4800 1200 meters
5 9600 1200 meters
6 19.2K 1200 meters
7 38.4K 1200 meters
8 57.6K 1200 meters
9 115.2K 800 meters
10 230.4K [1] 400 meters
11 460.8K [1] 200 meters
12 1040K [1] 100 meters
13 2080K [1] 40 meters
14 4160K [1] 20 meters
  1. 1.0 1.1 1.2 1.3 1.4 On Linux systems, stting these bit rates requires code using ioctl() with the TCGETS2 and TCSETS2 parameters.

Connectors

2x RJ45 Modbus

Both RJ45 ports, and all of our Modbus based devices are designed to be compatible with 2W-MODBUS RJ45 following this pinout:

ModbusRJ45.png

USB Device Port

Ts-1800-connectors-modbus.jpg


22 Pin Terminal Block

The terminal block is a removable connector that provides all of the DIO and ADC connections.

P1A / P1B - Top & Bottom Connector Signal Layout

Pin P1A (Top) Signal Description Pin P1B (Bottom) Signal Description
1 (Left) ADC Channel 0 23 (Left) Isloated Gounrd
2 ADC Channel 1 24 Isloated Gounrd
3 ADC Channel 2 25 Isloated Gounrd
4 ADC Channel 3 26 Isloated Gounrd
5 ADC Channel 4 27 Isloated Gounrd
6 ADC Channel 5 28 Isloated Gounrd
7 ADC Channel 6 29 Digital Input 0
8 ADC Channel 7 30 Digital Input 1
9 ADC Channel 8 31 Digital Input 2
10 ADC Channel 9 32 Digital Input 3
11 ADC Channel 10 33 Digital Input 4
12 ADC Channel 11 34 Digital Input 5
13 ADC Channel 12 35 Digital Input 6
14 ADC Channel 13 36 Digital Input 7
15 Digital Output 0 37 Digital Input 8
16 Digital Output 1 38 Digital Input 9
17 Digital Output 2 39 Digital Input 10
18 Digital Output 3 40 Digital Input 11
10 Digital Output 4 41 Digital Input 12
20 Digital Output 5 42 Digital Input 13
21 Digital Output 6 43 Digital Input 14
22 (Right) Digital Output 7 44 (Right) Digital Input 15

TS-1800-IO.jpg


Ts-1800-label22-p1.jpg

Product Notes

FCC Advisory

This equipment generates, uses, and can radiate radio frequency energy and if not installed and used properly (that is, in strict accordance with the manufacturer's instructions), may cause interference to radio and television reception. It has been type tested and found to comply with the limits for a Class A digital device in accordance with the specifications in Part 15 of FCC Rules, which are designed to provide reasonable protection against such interference when operated in a commercial environment. Operation of this equipment in a residential area is likely to cause interference, in which case the owner will be required to correct the interference at his own expense.

If this equipment does cause interference, which can be determined by turning the unit on and off, the user is encouraged to try the following measures to correct the interference:

Reorient the receiving antenna. Relocate the unit with respect to the receiver. Plug the unit into a different outlet so that the unit and receiver are on different branch circuits. Ensure that mounting screws and connector attachment screws are tightly secured. Ensure that good quality, shielded, and grounded cables are used for all data communications. If necessary, the user should consult the dealer or an experienced radio/television technician for additional suggestions. The following booklets prepared by the Federal Communications Commission (FCC) may also prove helpful:

How to Identify and Resolve Radio-TV Interference Problems (Stock No. 004-000-000345-4) Interface Handbook (Stock No. 004-000-004505-7) These booklets may be purchased from the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402.

Limited Warranty

See our Terms and Conditions for more details.