SETSYSTEM n, data
Purpose Allow changing of certain default system’s parameters. Currently only the following data are defined. More parameters may be defined in future. Some commands are specific to a PLC model and these will be mentioned in the relevant section of the hardware manual.

n

data

1

The data value determines the # of wait states (multiple of 0.15s for serial and 0.20s for Ethernet*) to wait for a response from a slave controller after executing a NETCMD$, READMODBUS, WRITEMODBUS, READMB2 or WRITEMB2 command.

*Note:
For PLCs with firmware before r77, the Ethernet port wait time is a multiple of 0.5s instead of 0.2s, which is for PLCs with firmware r77 or higher. The serial wait time is 0.15s for all firmware versions.

For Nano-10, FMD and F-series PLCs Only

SETSYSTEM 1, data affects the 4 COMM ports (COMM4 is Ethernet client connection) individually, where bit 0 & 1 are for COMM1, bit 2 & 3 are for COMM2 , bit 4&5 are for COMM3 and bit 6&7 are for COMM4.

By default data is set to &H55 (binary 01 01 01 01), which means a 2 wait multiple is used for all 4 COMM ports. This is about 0.30s for all 3 serial COMM ports, and about 0.40s the Ethernet port (PLCs with r77 or higher firmware).

Bit #
76
54
32
10
data
dd
dd
dd
dd
Comm port
4
3
2
1

dd =
00
01
10
11
# of Wait States
1
2
3
4

Note: maximum = 4 retries

In order to change the wait states for COMM3 you have to set the bit 4 & 5 of data.

E.g SETSYSTEM 1, &HFF

This will change all 4 COMM ports to wait for 4 cycles (0.60s for serial port and 0.80s for PLCs with firmware r77 or higher)

For T100MD+ and T100MX+

data (d) is applied to all 3 COMM ports simultaneously and can be any value from 0 to 255

e.g. SETSYSTEM 1, 3

The PLC will wait 3 x 150ms = 450ms for a valid response from the slave controller on all 3 serial ports.

2

# of retries if NETCMD$, READMODBUS, WRITEMODBUS, READMB2 or WRITEMB2  failed to get a valid response from slave controller.

For Nano-10, FMD and F-series PLCs

SETSYSTEM 2, data  affects the 4 COMM port individually (COMM4 is Ethernet client connection) , where bit 0 & 1 for COMM1, bit 2 & 3 for COMM2 , bit 4&5 for COMM3 and bit 6&7 for COMM4. By default data is set to &HAA (binary 10 10 10 10). This means 2 re-tries (a total of 3 tries) for all 4 COMM ports.

  data     :  nn nn nn nn        where nn = 00, 01, 10  or 11  (maximum = 3 re-try)
    Comm port :  4  3  2  1

In order to change the number of retries for COMM2 to 1 retry  you have to set the bit 2 & 3 of data.

E.g     SETSYSTEM 2, &HA5     'binary 10 10 01 10 

The above example set COMM2 to 1 retry and the other 3 ports are 2 retries.

For T100MD+ and T100MX+

data is applied to all 3 COMM ports simultaneously and can be any value from 0 to 255

e.g.    SETSYSTEM 2,5

The PLC will retry up to 5 times if it failed to communicate with the slave. Note longer waiting time when failure occur if you increase the number of retries.

3

0 - Respond as fast as possible to serial port hostlink commands received  from the host computer or another PLC.

1 - (default)  at least a 0.01s (10ms) must lapse before responding to host link commands received from the host computer or another PLC. This delay is needed for auto-switch type RS485 converter to allow time for the hardware transceiver to switch direction.

4

Set Enhanced Quadrature Encoding for HSC channels (see the PLC's User manual on High Speed Counter hardware for details)

5

0 :  All DM cleared when PLC is soft-reset.
n : DM #1 to #n will not be cleared when the PLC is soft-reset.

Applicable only to PLC with firmware r78 and above.

6

data = 3  :  READMODBUS and READMB2 use Modbus Function 03. WRITEMODBUS uses default (function 16)
data = 4  :  READMODBUS and READMB2 use Modbus Function 04. WRITEMODBUS uses default (function 16)

The following is applicable for PLC with firmware r77 and above only:
data = 6  -  WRITEMODBUS uses Modbus Function 06.  READMODBUS and READMB2 uses default (function 03)

Any other values of data will set READMODBUS and WRITEMODBUS back to default (03 for READ, 16 for WRITE)

7

Reserved

8

Allow the PLC to change its own ID from within TBASIC temporarily to the lower 8-bit value provided in the "data" parameter for individual COMM port. The new ID is volatile. It does not overwrite the default PLC ID which can only be changed from a host program using the "IWxx" command.

SETSYSTEM 8, n

    COMM1:  n = &H0001 to &H00FF 
    COMM2:  n = &H0101 to &H01FF
    COMM3:  n = &H0201 to &H02FF
    COMM4 (Ethernet): n = &H0301 to &H03FF

ID for the respective COMM port will be set to 01 to FF after running the above command.
(only applicable to PLC with firmware r76 and above)

9

data = 1  : to enable Fast I/O REFRESH ONLY
data = 0  : (default)  REFRESH all i/os

On FMD PLCs the fast I/Os are input 3 to 6 and output 5 to 8.
On F-series PLCs, the fast I/Os are inputs 1 to 12 and outputs 5 to 16.
All Nano-10 I/Os are fast I/Os so this command has no effect.

By running SETSYSTEM 9,1  - only the fast I/Os are refreshed when TBASIC REFRESH command is run. This has the advantage of reducing the REFRESH latency (especially when executed within a interrupt service custom function).

11

Add or subtract data seconds per day from the RTC to calibrate it for accuarcy. E.g. if the clock is 3 seconds too slow everyday, then run  SETSYSTEM 11, 3 once during 1st.Scan and the CPU will increase the RTC by +3 seconds every time when it past midnight.

data = -127 to +127 to adjust the RTC for accuracy after midnight.

data = 0: (default), no adjustment
data > 0: RTC crossover from 23:59:59 to 0:0:data directly and bypasses 0:0:0.
                          E.g. data  = 5, clock is adjusted faster by 5 seconds.
data < 0: RTC stop at 23:59:59 and wait until (-data) seconds later then cross over to 0:0:0
                          E.g. if data = -5, the RTC is slowed by 5 seconds.

Applicable only to PLC with firmare r78 and above

16

Total number of 8-bit digital I/O channel supported.
data = 16 (default) => 16 x 8 = 128 Inputs and 128 outputs.
If you don't use expansion board, and if you run SETSYSTEM 16, 3 then only inputs 1-24 and outputs 1-24 will be accessed during I/O scan. This can reduce the I/O scan time. Otherwise the default is to scan all 128 inputs and 128 outputs which consumes 0.5ms on an F-series PLC.
17

data = 0 : disable IR Remote (default)

data = 1 : enable IR Remote

Note: Only applicable to F-series PLCs (F2424 and F1616-BA). See users manual for more details.

20

0 - PULSEPERIOD and PULSEWIDTH 1 to 4 returns data with 0.1us resolution
1 - PUSLEPERIOD and PULSEWIDTH 1 to 4 returns data with 1us resolution.

(For PLC firmware r77 and above)
2 to 255 : Number of seconds of inactive incoming pulses before PULSEWIDTH
                            and PULSEFREQUENCY assume that incoming pulses has stopped.
                            Default is 5 seconds.

22

0 - Disable Dimmer interrupt
1 - Enable Dimmer interrupt

24

data is defined as a two-byte integer for configuring the HSC channel to be simple, enhanced x1, x2 or x4 count. (Applicable only to PLC with firmware r72 and above).

Upper byte : channel number (&H01 or &H02 or &H03)
Lower byte : &H00 (default) =simple ; &H01=x1; &H02=x2; &H03= x4

25

Applicable only to FMD PLCs for selecting the analog output type (0-5V or 0-10V). Please refer to Chapter 5 of the PLC's User Manual.

251

To force close an an incoming TCP server connection.
data = 0 to 5: Force-close a FServer and Modbus/TCP server connection
         = 11:  Force-close a FTP Server connection.

Applicable only to PLC with firmware r78 and above

252

0 - On Nano-10 and FMD PLC without the FRAM-RTC, this command is used to force save the emulated EEPROM content to the CPU Flash memory.

Important: This command should be executed every time a SETTIMERSV, SETCTRSV, or SET_IPADDR command is used so that the data is properly backed up to PLC FLASH memory. This must be done for all Nano-10 and FMD series PLCs with or without any FRAM-RTC module installed.

253

Control the RTC operation.
0 - Completely disable the RTC on the CPU
1 - (default) Enable the RTC on the CPU
2 - Disable hourly auto update of RTC data from FRAM-RTC (useful on systems that rely on RTC update from Internet Time Server)

You can also use this command to setup the date and time for an RTC alarm interrupt to occur. The interrupt handler can be defined using 

INTRDEF 19, n,1   ' where n is the custom function to handle the alarm interrupt.

The time and date when the alarm interrupt occurs can be defined using SETSYSTEM 253,data as follow:

data = 1hhmmss - set system alarm to occur when the RTC reaches the time "hh:mm:ss"
             E.g SETSYSTEM 253, 1130500    ' alarm at 13:05:00

When SETSYSTEM 253, 1hhmmss is run the alarm is set on the day when the RTC next reaches hh:mm:ss (so it could be the same day or the next day depending on current time).

Applicable only to PLC with firmware r72 and above

254

0 - Disable Ethernet port to save power - execute only when Ethernet connector is disconnected.
1 - (default) Enable Ethernet port.
2 - Clear ARP cache so that it will request ARP data before connection.

Applicable only to PLC with firmware r74 and above. Note - Do not disable Ethernet port when Ethernet connector is plugged into the switch or router. This is because if Ethernet is disabled while active connection is going on, the CPU can lock itself into undefined Interrupt error state.

255

data

All F-series FMD & Nano-10
>= r79 firmware

FMD & Nano-10
<= r78 firmware

&HB3

Time out in 2.24s Time out in 2.67s Time out in 4.47s

&HAB

Time out in 0.14s Time out in 0.17s Time out in 0.28s

&H03

Diable WDT (default)

Diable WDT (default) Diable WDT (default)

&H00

Reset WDT

Reset WDT

Reset WDT

This allows you to enable on-CPU Watch Dog Timer. If enabled and the CPU goes astray because of noise-induced trouble, the WDT will reset the CPU when it times out. Note that to simplify user's application the TBASIC O/S automatically resets the WDT during its normal execution except when the program is stucked inside a GOTO loop. Hence if your program is likely to spend longer time within a GOTO loop than the predefined timeout, you must run the SETSYSTEM 255, 0 command periodically  to reset the WDT before it times out, to prevent the WDT from resetting the CPU. However, the WDT will not kick in if your program is stucked inside a FOR..NEXT or WHILE.. ENDWHILE loop. WDT also will not activate if your program encounters undefined interrupt error in order to give the programmer a chance to investigate the cause that leads to the Undef. Interrupt error.

Applicable only to PLC with firmware r74 and above.

256

0  -  (default) do not process user interrupt during I/O scan  interrupt latency determined by scan time.
1  -  process pending user interrupt even during I/O scan (to minimize interrupt latency).

Available to PLC with firmware r50 and above.

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual