beautypg.com

Precaution, Sample program, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 396

background image

2 Instructions

2-360

CP1E CPU Unit Instructions Reference Manual(W483)

Precaution

Do not read or write the system word (C2) from any other instruction. DSW(210) will not operate cor-

rectly if the system word is accessed by another instruction. The system word is not initialized by
DSW(210) in the first cycle when program execution starts. If DSW(210) is being used from the first
cycle, clear the system word from the program.

DSW(210) will not operate correctly if I/O refreshing is not performed with the Input Unit and Output

Unit connected to the digital switch or thumbwheel switch after DSW(210) is executed. Consequently,
set the input time constant for the Input Units used for the data line input word to a value that is
shorter than the cycle time.

DSW(210) reads the 4-digit or 8-digit data once in 16 cycles, and then starts over and reads the data

again in the next 16 cycles.

When executed, DSW(210) begins reading the switch data from the first of the sixteen cycles, regard-

less of the point at which the last instruction was stopped.

Sample program

In this example, DSW(210) is used to read an 8-digit number from a digital switch and outputs the
resulting value constantly to D0 and D3. The digital switch is connected through CIO 3 and CIO 104.

D1000 is used as the system word.

I

O

D

C1

C2

DSW(210)

3

104

D0

#0001

D1000

P_On

Always ON Flag

This manual is related to the following products: