Remote-processing CAMBASIC Uživatelský manuál Strana 203

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 208
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 202
Event Multitasking - 14
PULSE MULTITASKING
Introduction
CAM BASIC supports eight timed (or pulsed) outputs. These ar e gener ated in softwa re and have a re solution of 5 milli-
seconds Each timer is assigned through software to any digital I/O line on any CPU or expansion card. Once configured,
timing is done independently in the backgr ound. T he timers have the following features:
1. The time resolution is 5 mS (10 mS in 9 M Hz systems)
2. The timers may be r ead at any time with the PULSE function.
3. The timers are 16– bit with a range from 0. 005 (0.010 in 9 MH z systems) to 327.67
(655.35 in 9 MHz systems) seconds.
Defining a Pulsed Output
Setting up a timer is done with the PUL SE statement. The syntax is:
PULSE n,address, bit,w ait,tim e, p olarity
Where
n is the timer reference 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 tim e from 0.005 to
327.67 seconds.
polarity determ ines whethe r the specified bit will be active high or low . W hen polar ity 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 polar ity 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 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
Timer 0 is configu red at address 0 and bit 1. T he output will go high for 0.050 seconds as soon as the com mand is
Zobrazit stránku 202

Komentáře k této Příručce

Žádné komentáře