Pulse multitasking – Remote Processing CAMBASIC User Manual

Page 203

Advertising
background image

Event Multitasking - 14

PULSE MULTITASKING

Introduction

CAM BASIC supports e ight timed (or pulsed) outputs. These ar e gener ated in softwa re and h ave a re solution of 5 m illi-
seconds Each timer is assigned through software to any digital I/O line on any CPU or expansion card. O nce configured,
timing is done independently in the backgr ound. T he timers have the following features:

1.

The time r esolution 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 MH z systems) seconds.

Defining a Pulsed Output
Setting up a timer is done w ith the PUL SE statement. The syntax is:

PULSE n,a ddress, 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 sec onds that the spe cified bit is active. You m ay specify a tim e from 0.0 05 to
327.67 seconds.

polarity determ ines whethe r the spec ified bit will be activ e 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 w hen driving opto m odule racks.

In the simplest mode, operation with the polar ity active “high” would be as follows:

ON

O F F

0

1

2

3

4

5

6

Figure 2

Faster Code Execution

T h e da t a t ha t y o u e n te r w it h t he P U L SE s ta t em e n t i s c o m pi le d in to o bj e ct co d e. T h u s, t h e e x ec u ti on ti m e o n th e 20 0 H z
( 1 00 H z in 9 M H z s y st e ms ) c l oc k ti c k i s o n ly m ic r o se c on d s, r a t he r th a n t he m il li se c on d s t ha t i t w o ul d t ak e in BA S IC .

Operation of a Single Pulsed Output

Time r 0 is configu red at add ress 0 and bit 1. T he output w ill go high for 0 .05 0 seconds as so on as the com mand is

Advertising