119
Pulse I/O Board
Section 2-2
Starting the Pulse Output
PWM(––) is used to specify the port number, the pulse frequency, and the
duty factor, and to start pulse output.
Pulse output will start using the settings specified by PWM(––), and will con-
tinue with those settings until PWM(––) is executed again with different set-
tings, or until INI(61) is executed to stop pulse outputs from the specified port.
Stopping the Pulse Output
The pulse output from a port can be stopped by executing INI(61) with C=003.
Specify port 1 or 2 (P=001 or 002).
Example: Using PWM(––)
The following example shows PWM(––) used to start a 1.5 kHz pulse output
from port 1 and then change the duty factor from 50% to 25%.The pulse out-
put is then stopped with INI(61). Before running the program, check that the
settings in the PC Setup are as follows:
DM 6643: 1000 (variable duty factor pulse setting for port 1).
The following diagram shows the duty factor of the pulse output from port 1 as
the program is executed.
@PWM(
−−
)
F
P
D
P: Port
001: Port 1
002: Port 2
F: Output frequency
000 = 5.9 kHz
001 = 1.5 kHz
002 = 91.6 Hz
D: Duty factor
Specify either a 4-digit BCD constant or a word address
where the value of D is stored as a 4-digit BCD represent-
ing a percentage value. The setting must be between 0001
and 0099 (i.e., 1% to 99%).
@INI(61)
003
P
000
P: Port
001: Port 1
002: Port 2
00000
@PWM(
−−
)
001
001
#0050
00001
@PWM(
−−
)
001
001
#0025
00002
@INI(61)
003
001
000
When IR 00000 turns ON, a 1.5 kHz signal is output from
port 1 with a duty factor of 50%.
When IR 00001 turns ON, the duty factor is changed to
25%.
When IR 00002 turns ON, INI(61) stops the pulse output
from port 1.
50% duty factor pulses
25% duty factor pulses
IR 00001
turns ON
IR 00000
turns ON
IR 00002
turns ON
(Stop)
50%
50%
25%
75%
1.5 kHz
1.5 kHz