Specifications
Event Multitasking - 13
PULSE MULTITASKING
Introduction
CAMBASIC supports eight timed (or pulsed) outputs. These are generated in software and have a resolution of 10 mS.
Each timer may be assigned through software to any digital I/O line on any CPU or expansion card. Once configured,
timing is done independently in the background. The timers have the following features:
1. The time resolution is 5 mS (10 ms in 9 Mhz systems)
2. The timers may be read at any time with the PULSE function.
3. The timers are 16–bit with a range from 0.005 (0.010 in 9 Mhz systems) to 327.67 (655.35
in 9 Mhz systems) seconds.
Defining a Pulsed Output
Setting up a timer is done with the PULSE statement. The syntax is:
PULSE n,address,bit,wait,time, polarity
Where
n is the timer number and has a range from 0 to 7.
address is the I/O address of an any 8–bit port either on or off the card.
bit is the particular bit of the port. The value ranges from 0 to 7.
time is the time in seconds that the specified bit is active. You may specify a time from 0.0 to 327.67
seconds.
polarity determines whether the specified bit will be active high or low. When polarity is 1, the bit
will go high during the active time. It will go low during the active time if the polarity is 0. The “0”
polarity is always used when driving opto module racks.
In the simplest mode, operation with the polarity active “high” would be as follows:
ON
OFF
0 1 2 3 4 5 6
Figure 2
Faster Code Execution
The data that you enter with the CONFIG PULSE statement is compiled into object code. Thus, the execution time on the
200 Hz (100 Hz in 9 Mhz systems) clock tick is only microseconds, rather than the milliseconds that it would take in
BASIC.
Operation of a Single Pulsed Output