Omron C40K Video Game Controller User Manual


 
113
The following example shows how to save the comparison result immedi-
ately. If the content of HR 8 is greater than that of 9, 0200 is turned ON; if the
two contents are equal, 0201 is turned ON; if content of HR 8 is less than
that of HR 9, 0202 is turned ON. In some applications, only one of the three
OUTs would be necessary, making the use of TR 0 unnecessary. With this
type of programming, 0200, 0201, and 0202 are changed only then CMP(20)
is executed.
CMP(20)
HR 8
HR 9
0000
1905
0200
1907
0202
TR
0
1906
0201
Greater Than
Equal
Less Than
Address Instruction Operands Address Instruction Operands
0000 LD 0000
0001 OUT TR 0
0002 CMP(20)
HR 8
HR 9
0003 LD TR 0
0004 AND 1905
0005 OUT 0200
0006 LD TR 0
0007 AND 1906
0008 OUT 0201
0009 LD TR 0
0010 AND 1907
0011 OUT 0202
The following example uses TIM, CMP(20), and the LE flag (1907) to pro-
duce outputs at particular times in the timer’s countdown. The timer is started
by turning ON 0000. When 0000 is OFF, the TIM (10) is reset and the second
two CMP(20)s are not executed (i.e., executed with OFF execution condi-
tions). Output 0200 is output after 100 seconds; output 0201, after 200 sec-
onds; output 0202, after 300 seconds; and output 0204, after 500 seconds.
Example 1:
Saving CMP(20) Results
Example 2:
Obtaining Indications
during Timer Operation
DATA COMPARE – CMP(20) Section 5-14